/* =========================================================
   home.css — homepage-only sections:
     1. Skills marquee  (.marquee-*, generated by skills.py)
     2. Recent articles (overrides on ArtiPress card markup, scoped to #articles)
     3. Contact panel   (.contact-*)
   Project cards (used here and on /projects) live in components/project-card.css.
   ========================================================= */

/* =========================================================
   1. Skills marquee
   Two layouts share the #skills anchor: .marquee-wide (text + four vertical
   icon columns) and .marquee-narrow (text + two horizontal icon rows). The tile
   px sizes below must stay in sync with the constants in skills.py.
   ========================================================= */

/* shared panel shell */
.panel.marquee-panel {
    position: relative;
    background-color: var(--tertiary-contrast-color);
    border-radius: var(--panel-radius);
    height: auto;
    max-height: none;
    min-height: 0;
    margin: 50px 0;
    overflow: hidden;
}

/* shared icon tile */
.marquee-tile {
    --accent: #ffffff;
    position: relative;
    overflow: hidden;
    width: var(--marquee-tile);
    height: var(--marquee-tile);
    flex: 0 0 var(--marquee-tile);
    border-radius: 18px;
    border: 1px solid var(--divider-color);
    background: var(--primary-2-contrast-color);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

/* accent reveal on hover/focus (matches the skills page cards) */
.marquee-tile::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(to top, color-mix(in srgb, var(--accent) 9%, transparent), transparent 65%);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.marquee-tile > * {
    position: relative;
    z-index: 1;
}

.marquee-tile img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.marquee-tile.light {
    background: rgba(255, 255, 255, 0.95);
    border-color: transparent;
}

a.marquee-tile {
    cursor: pointer;
}

/* initials placeholder for skills without an icon */
.marquee-tile-initials {
    font-weight: 300;
    font-size: 1.15rem;
    color: var(--secondary-text-color);
}

.marquee-tile:hover,
.marquee-tile:focus-visible {
    transform: translateY(-4px) scale(1.02);
    border-color: color-mix(in srgb, var(--accent) 32%, var(--divider-color));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
    outline: none;
}

.marquee-tile:hover::before,
.marquee-tile:focus-visible::before {
    opacity: 1;
}

@keyframes marquee-vert-up   { from { transform: translateY(0); }    to { transform: translateY(-50%); } }
@keyframes marquee-vert-down { from { transform: translateY(-50%); } to { transform: translateY(0); } }
@keyframes marquee-horiz-left  { from { transform: translateX(0); }    to { transform: translateX(-50%); } }
@keyframes marquee-horiz-right { from { transform: translateX(-50%); } to { transform: translateX(0); } }

/* ---------- WIDE variant ---------- */
.marquee-wide {
    /* icon-grid tokens live here so the grid can reserve the columns' exact width */
    --marquee-tile: 96px;
    --marquee-gap: 14px;
    --marquee-cols: 4;
    --marquee-area: calc(var(--marquee-cols) * var(--marquee-tile) + (var(--marquee-cols) - 1) * var(--marquee-gap));
    padding: 0 var(--panel-pad-x);   /* no vertical padding -> icons full-bleed */
}

.marquee-grid {
    display: grid;
    /* text takes the flexible column (shrinks + wraps as the window narrows);
       the icon block keeps its fixed width so it never collapses */
    grid-template-columns: minmax(0, 1fr) var(--marquee-area);
    gap: 40px;
    align-items: stretch;
}

.marquee-text {
    padding: var(--panel-pad-y) 0;
    max-width: 600px;
}

.marquee-text h2 { margin: 0 0 16px; }
.marquee-text p { margin: 0; }
.marquee-text .learn-more { display: inline-block; margin-top: 22px; }

.marquee-cols { position: relative; }

.marquee-cols-inner {
    position: absolute;
    inset: 0;
    display: flex;
    gap: var(--marquee-gap);
    justify-content: flex-end;
}

/* clip the vertical scroll, but let the hover lift/scale/shadow show on the sides */
.marquee-col {
    width: var(--marquee-tile);
    flex: 0 0 var(--marquee-tile);
    overflow-x: visible;
    overflow-y: clip;
}

.marquee-col-track {
    display: flex;
    flex-direction: column;
    gap: var(--marquee-gap);
    width: max-content;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-duration: var(--marquee-dur, 30s);
    will-change: transform;
}

.marquee-col-up   .marquee-col-track { animation-name: marquee-vert-up; }
.marquee-col-down .marquee-col-track { animation-name: marquee-vert-down; }
.marquee-cols:hover .marquee-col-track { animation-play-state: paused; }

/* ---------- NARROW variant ---------- */
.marquee-narrow {
    --marquee-tile: 72px;
    --marquee-gap: 12px;
    display: none;   /* shown only on small screens */
    padding: var(--panel-pad-y) var(--panel-pad-x);
}

.marquee-narrow h2 { margin: 0 0 14px; }
.marquee-narrow p { margin: 0; }

/* bleed the rows out through the panel padding so they run edge to edge */
.marquee-rows {
    display: flex;
    flex-direction: column;
    gap: var(--marquee-gap);
    margin: 24px calc(-1 * var(--panel-pad-x)) 22px;
}

.marquee-row {
    overflow-x: clip;
    overflow-y: visible;   /* clip horizontal scroll; let hover show vertically */
}

.marquee-row-track {
    display: flex;
    flex-direction: row;
    gap: var(--marquee-gap);
    width: max-content;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-duration: var(--marquee-dur, 34s);
    will-change: transform;
}

.marquee-row-up   .marquee-row-track { animation-name: marquee-horiz-left; }
.marquee-row-down .marquee-row-track { animation-name: marquee-horiz-right; }
.marquee-rows:hover .marquee-row-track { animation-play-state: paused; }

.marquee-narrow .marquee-tile img { width: 38px; height: 38px; }
.marquee-narrow .marquee-tile-initials { font-size: 1rem; }
.marquee-narrow .learn-more { display: inline-block; }

/* ---------- swap panels at the breakpoint ---------- */
@media (max-width: 900px) {
    .marquee-wide { display: none; }
    .marquee-narrow { display: block; }
}

@media (prefers-reduced-motion: reduce) {
    .marquee-col-track,
    .marquee-row-track { animation: none; }
}

/* =========================================================
   2. Recent articles (homepage)
   Responsive layout on top of ArtiPress's card CSS, scoped to #articles so the
   /articles list page is unaffected.
   ========================================================= */

/* Keep the card image proportional at any width (ArtiPress pins a fixed pixel
   height); an aspect-ratio lets the height track the width instead. */
#articles .artipress-article-card .lqip-wrapper,
#articles .artipress-article-card > img.article-card-thumbnail {
    height: auto;
    aspect-ratio: 3 / 2;
}

/* Medium widths: lay the card out horizontally (image left, text right). */
@media (max-width: 768px) {
    #articles .artipress-article-card {
        flex-direction: row;
        align-items: flex-start;
        gap: 18px;
    }
    #articles .artipress-article-card .lqip-wrapper,
    #articles .artipress-article-card > img.article-card-thumbnail {
        flex: 0 0 42%;
        width: 42%;
        margin: 0;
    }
    #articles .artipress-article-card .text-content {
        flex: 1 1 auto;
        min-width: 0;
    }
}

/* Narrow / phone widths: back to a vertical card (image on top of the text). */
@media (max-width: 480px) {
    #articles .artipress-article-card {
        flex-direction: column;
        gap: 0;
    }
    #articles .artipress-article-card .lqip-wrapper,
    #articles .artipress-article-card > img.article-card-thumbnail {
        flex: none;
        width: 100%;
        margin: 0 0 10px;
    }
}

/* =========================================================
   3. Contact panel — gold accent panel + macOS terminal form
   ========================================================= */
#contact {
    padding: 0 !important;
    overflow: hidden;
    height: auto;
    max-height: none;
}

#contact .contact-grid {
    display: flex;
    min-height: 460px;
}

#contact .contact-accent {
    flex: 0 0 34%;
    background: linear-gradient(155deg, var(--primary-color), var(--primary-color-darker));
    color: var(--primary-contrast-color);
    padding: 46px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 26px;
}

#contact .contact-accent h2 {
    color: var(--primary-contrast-color);
    margin: 0 0 14px;
    font-size: 2.2rem;
}

#contact .contact-accent p {
    color: color-mix(in srgb, var(--primary-contrast-color) 80%, transparent);
    margin: 0;
    line-height: 1.6;
}

#contact .contact-accent p a {
    color: var(--primary-contrast-color);
    font-weight: 600;
    text-decoration: underline;
}

#contact .contact-socials {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

#contact .contact-socials a {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--primary-contrast-color) 12%, transparent);
    transition: transform .2s ease, background .2s ease;
}

#contact .contact-socials a:hover {
    transform: translateY(-3px);
    background: color-mix(in srgb, var(--primary-contrast-color) 22%, transparent);
}

#contact .contact-socials a img {
    height: 22px;
    width: auto;
    display: block;
}

#contact .contact-form-side {
    flex: 1;
    padding: 46px 40px;
    background-color: var(--quaternary-contrast-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

#contact .contact-term {
    width: 100%;
    max-width: 640px;
    border: 1px solid var(--divider-color);
    border-radius: 14px;
    background: #061826;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

#contact .contact-term-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #0a2030;
    border-bottom: 1px solid var(--divider-color);
}

#contact .contact-term-bar .term-dot { width: 12px; height: 12px; border-radius: 50%; }
#contact .contact-term-bar .term-dot-red { background: #ff5f56; }
#contact .contact-term-bar .term-dot-yellow { background: #ffbd2e; }
#contact .contact-term-bar .term-dot-green { background: #27c93f; }
#contact .contact-term-bar .term-title { margin-left: 10px; color: var(--secondary-text-color); font-size: 0.8rem; }

#contact .contact-term-body { padding: 26px 28px 30px; }

#contact #contact-form { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

#contact .contact-field { margin-bottom: 14px; }
#contact .two-column-inputs .contact-field { flex: 1; }

#contact .contact-field label {
    display: block;
    color: var(--primary-color);
    font-size: 0.82rem;
    margin-bottom: 5px;
}

#contact .contact-field label::before { content: "> "; color: var(--secondary-text-color); }

#contact input,
#contact textarea {
    background: #04121d;
    border: 1px solid var(--divider-color);
    border-radius: 8px;
    font-family: var(--primary-font-family);
    color: #cdeafe;
    margin: 0;
}

#contact textarea { min-height: 130px; }

#contact input:focus,
#contact textarea:focus { outline: none; border-color: var(--primary-color); }

#contact button {
    width: auto;
    background: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
    font-family: inherit;
    transition: background .2s ease, color .2s ease;
}

#contact button:hover { background: var(--primary-color); color: var(--primary-contrast-color); }

@media (max-width: 850px) {
    #contact .contact-grid { flex-direction: column; }
    #contact .contact-accent { flex-basis: auto; }
}

@media (max-width: 680px) {
    #contact .contact-accent { padding: 28px 20px; }
    #contact .contact-form-side { padding: 22px 14px; }
    #contact .contact-term-body { padding: 18px 16px 22px; }
    /* stack the email field under the name field */
    #contact .two-column-inputs { flex-direction: column; gap: 0; }
}
