/* pages.css, per-page layout, scoped by body[data-page] or a page-root class.
   Reads only tokens.css variables + component classes. Loaded last.

   Started in M1 with the About page. Later milestones append the projects
   catalogue, project hub, post, role, and home-shelf layouts here. */

/* =========================================================================
   ABOUT  (about.html, body[data-page="about"])
   ========================================================================= */
/* Wider than the standard content column: 70vw, with a floor so it doesn't get
   cramped on smaller screens (width:100% still keeps it inside tiny viewports). */
.about-page {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    max-width: max(70vw, 680px);
}

.about-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-7);
    align-items: start;
}

/* One colour for the bio. base.css paints every <strong> amber, which turned
   the paragraphs into a patchwork of highlighted phrases; keep the weight,
   drop the colour change. */
.about-body, .about-body p, .about-body strong { color: var(--text); }

.about-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}
.about-actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

.about-body p { font-size: var(--fs-400); }

.about-contact {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

.about-portrait {
    width: 100%;
    max-width: 340px;
    height: auto;
    aspect-ratio: 1 / 1;
    justify-self: center;
    align-self: center;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-pop);
    object-fit: cover;
}

@media (max-width: 760px) {
    .about-grid { grid-template-columns: 1fr; }
    .about-portrait { justify-self: center; max-width: 280px; order: -1; }
    .about-header { flex-direction: column; align-items: flex-start; }
    .about-page { text-align: center; }
    .about-header, .about-actions, .about-contact { justify-content: center; align-items: center; }
    .about-body { text-align: left; }
}

/* =========================================================================
   Shared page bits
   ========================================================================= */
.loading-note { color: var(--text-muted); text-align: center; padding: var(--space-6); }
.data-error {
    background: var(--surface-0);
    border: 1px solid var(--danger);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    color: var(--text);
}
.data-error h2 { color: var(--danger); margin-bottom: var(--space-3); }

/* =========================================================================
   HOME  (index.html, body[data-page="home"])
   ========================================================================= */
.home-page { display: flex; flex-direction: column; gap: var(--space-8); }

/* Collections get the most room on the page, full width, generous spacing. */
.home-collections { padding: var(--space-4) 0 var(--space-2); }
.home-collections .section-title { font-size: clamp(1.8rem, 4vw, 2.4rem); margin-bottom: var(--space-6); }

/* --- Featured: alternating showcase rows over the project's own artwork --- */
/* Featured breaks out of the 1200px page column to 80vw, so the showcase rows
   get far more room than the intro card / collections above and below them. */
.home-featured {
    position: relative;
    width: 80vw;
    left: 50%;
    transform: translateX(-50%);
}
.featured-chips { margin-bottom: var(--space-6); }
.featured-list { display: flex; flex-direction: column; gap: var(--space-6); }

/* Each row also shifts to the opposite side of the page, so the list visibly
   zigzags left → right → left as you scroll (the art always hugs the outer edge). */
.featured-row {
    position: relative;
    width: 97%;
    margin-right: auto;          /* odd rows sit left */
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    transition: border-color var(--ease), box-shadow var(--ease);
}
.featured-row.is-flipped { margin-right: 0; margin-left: auto; }   /* even rows sit right */
.featured-row:hover { border-color: var(--border-strong); box-shadow: var(--shadow-card-hover); }
.featured-row__bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.featured-row__shade {
    position: absolute; inset: 0;
    background: linear-gradient(100deg, rgba(11, 14, 25, 0.93) 0%, rgba(11, 14, 25, 0.78) 55%, rgba(11, 14, 25, 0.9) 100%);
}
.featured-row__status {
    position: absolute; top: var(--space-4); right: var(--space-4); z-index: 6;
    background: var(--accent); color: var(--on-accent);
    border-radius: var(--radius-pill); padding: 5px 15px;
    font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
    box-shadow: var(--shadow-card);
}
/* The badge floats over the top-right corner, so whichever column sits on that
   side gets clearance and its content can never run under the tag. */
.featured-row:not(.is-flipped) .featured-row__info,
.featured-row.is-flipped .featured-row__art { padding-top: 42px; }

/* Roughly a third of the viewport, with headroom; sides swap every other row. */
.featured-row__grid {
    position: relative; z-index: 2;
    display: flex; align-items: center; gap: var(--space-7);
    padding: var(--space-6);
    min-height: 44vh;
}
.featured-row.is-flipped .featured-row__grid { flex-direction: row-reverse; }
/* Near-even split with a rule between them, so each row reads as two distinct
   columns rather than an image with a caption beside it. */
.featured-row__art { flex: 1.05 1 0; min-width: 0; }
.featured-row__info {
    flex: 1 1 0; min-width: 0;
    padding-left: var(--space-6);
    border-left: 1px solid rgba(255, 255, 255, 0.14);
}
.featured-row.is-flipped .featured-row__info {
    padding-left: 0; border-left: 0;
    padding-right: var(--space-6);
    border-right: 1px solid rgba(255, 255, 255, 0.14);
}
.featured-row__cover { width: 100%; border-radius: var(--radius); box-shadow: var(--shadow-card); }

/* Keep the embedded slideshow inside the row's height budget. */
.featured-row .pshow__stage { max-height: 36vh; }
.featured-row .pshow__thumb { width: 80px; }

.featured-row__kicker { font-size: 0.76rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: var(--space-2); }
.featured-row__title { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0; line-height: 1.1; }
.featured-row__date { color: var(--text-muted); font-size: 0.9rem; margin-top: var(--space-2); }
.featured-row__tags { margin-top: var(--space-3); }
.featured-row__summary {
    margin-top: var(--space-3); color: var(--text); font-size: 0.95rem; line-height: 1.55;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.featured-row__bullets { margin: var(--space-3) 0 0; padding-left: var(--space-5); display: flex; flex-direction: column; gap: 4px; }
.featured-row__bullets li { color: var(--text); font-size: 0.9rem; line-height: 1.45; opacity: 0.92; }
.featured-row__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-5); }

/* Short screens (720p-class): trim the row so more than one fits on screen. */
@media (max-height: 800px) {
    .featured-row__grid { min-height: 0; padding: var(--space-5); }
    .featured-row .pshow__stage { max-height: 40vh; }
    .featured-row .pshow__thumb { width: 64px; }
    .featured-row__title { font-size: clamp(1.3rem, 2.2vw, 1.7rem); }
    .featured-row__summary { -webkit-line-clamp: 2; }
    .featured-row__bullets li { font-size: 0.85rem; line-height: 1.35; }
    .featured-row__bullets li:nth-child(n+4) { display: none; }
    .featured-row__actions { margin-top: var(--space-4); }
}

/* --- Compact variant: the catalogue rows. Same look as a featured row, about a
   quarter of the screen tall, cover art instead of a slideshow, and the whole
   row is a link so it carries no buttons. --- */
.featured-row--compact { color: var(--text); }
.featured-row--compact:hover { color: var(--text); border-color: var(--accent); }
.featured-row--compact .featured-row__grid {
    min-height: 25vh;
    /* Badge clearance lives on the grid, not on one column: putting it on a
       column made flipped rows taller than their neighbours. */
    padding: calc(var(--space-5) + 18px) var(--space-5) var(--space-5);
    gap: var(--space-5);
}
.featured-row--compact .featured-row__art { flex: 0 0 34%; }
/* The cover is sized from viewport HEIGHT so the row stays about a quarter of
   the screen on short displays too; object-fit crops instead of letterboxing. */
.featured-row--compact .featured-row__cover {
    width: 100%;
    height: clamp(104px, 15vh, 200px);
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}
.featured-row--compact .featured-row__info { padding-left: var(--space-5); }
.featured-row--compact.is-flipped .featured-row__info { padding-left: 0; padding-right: var(--space-5); }
.featured-row--compact .featured-row__title { font-size: clamp(1.2rem, 2.2vw, 1.6rem); }
.featured-row--compact .featured-row__summary { -webkit-line-clamp: 2; font-size: 0.9rem; margin-top: var(--space-2); }
.featured-row--compact .featured-row__tags { margin-top: var(--space-3); }
/* Clearance is handled by the grid's padding above, so neither column adds
   height of its own and flipped rows match their neighbours exactly. */
.featured-row--compact:not(.is-flipped) .featured-row__info,
.featured-row--compact.is-flipped .featured-row__art { padding-top: 0; }

/* Short screens: a 2-line summary plus a wrapping tag list set a height floor
   the row can't get under, and the wrapping made rows uneven (211 vs 184).
   One summary line and a single clipped tag row fixes both. Must come AFTER the
   compact rules above, which have equal specificity. */
@media (max-height: 800px) {
    .featured-row--compact .featured-row__grid { padding: calc(var(--space-4) + 14px) var(--space-4) var(--space-4); }
    .featured-row--compact .featured-row__cover { height: clamp(92px, 15vh, 150px); }
    .featured-row--compact .featured-row__summary { -webkit-line-clamp: 1; margin-top: var(--space-2); }
    .featured-row--compact .featured-row__tags { flex-wrap: nowrap; overflow: hidden; margin-top: var(--space-2); }
    .featured-row--compact .featured-row__title { font-size: clamp(1.05rem, 1.8vw, 1.3rem); }
}

@media (max-width: 860px) {
    .featured-row--compact .featured-row__info,
    .featured-row--compact.is-flipped .featured-row__info { padding-left: 0; padding-right: 0; }
    .featured-row--compact .featured-row__art { flex: 0 0 auto; }
    .featured-row--compact .featured-row__cover { height: clamp(140px, 22vh, 220px); }
}

@media (max-width: 860px) {
    .home-featured { width: 100%; left: auto; transform: none; }
    .featured-row, .featured-row.is-flipped { width: 100%; margin-left: 0; margin-right: 0; }
    .featured-row__grid,
    .featured-row.is-flipped .featured-row__grid { flex-direction: column; align-items: stretch; min-height: 0; gap: var(--space-5); }
    /* Stacked: the divider would sit across the layout, so drop it. */
    .featured-row__info,
    .featured-row.is-flipped .featured-row__info { padding: 0; border: 0; }
    /* Stacked, the badge sits over the art, which is first. */
    .featured-row:not(.is-flipped) .featured-row__info { padding-top: 0; }
    .featured-row.is-flipped .featured-row__art,
    .featured-row:not(.is-flipped) .featured-row__art { padding-top: 42px; }
    .featured-row .pshow__stage { max-height: none; }
    .featured-row__summary { -webkit-line-clamp: 5; }
}

/* Intro card, text + portrait side by side (the old about-card treatment). */
.home-intro {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-7);
    align-items: center;
}
.home-intro__kicker { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.9rem; margin-bottom: var(--space-3); }
.home-intro__title { font-size: clamp(2.4rem, 6vw, 3.6rem); margin: 0 0 var(--space-5); }

/* Both paragraphs read as one block: shared measure, one rhythm, the lead
   slightly larger and brighter so it steps down into the supporting line. */
.home-intro__copy {
    max-width: 62ch;
    display: flex; flex-direction: column; gap: var(--space-4);
    margin-bottom: var(--space-6);
    border-left: 3px solid var(--accent-dim);
    padding-left: var(--space-5);
}
.home-intro__copy p { margin: 0; color: var(--text); line-height: 1.65; }
.home-intro__lead { font-size: var(--fs-400); color: var(--text-strong); }
.home-intro__copy p + p { font-size: 0.98rem; opacity: 0.85; }
.home-intro__actions { display: flex; gap: var(--space-3); flex-wrap: wrap; }

/* Portrait + social links stack together on the right. */
.home-intro__aside { justify-self: end; display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }
/* height:auto so the img's width/height attributes (there for CLS) can't force
   the intrinsic 1280px height once CSS has constrained the width. */
.home-intro__portrait { width: 100%; max-width: 300px; height: auto; aspect-ratio: 1 / 1; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); object-fit: cover; }
/* Icons span the portrait's width and space out evenly beneath it. */
.home-intro__socials {
    width: 100%; max-width: 300px;
    display: flex; justify-content: space-between; align-items: center; gap: var(--space-3);
}
.home-intro__socials a { width: 48px; height: 48px; display: block; flex: 0 0 auto; }
.home-intro__socials img { width: 100%; height: 100%; object-fit: contain; }

@media (max-width: 760px) {
    .home-intro { grid-template-columns: 1fr; text-align: center; }
    .home-intro__aside { justify-self: center; order: -1; }
    .home-intro__portrait { max-width: 240px; }
    .home-intro__copy { text-align: left; margin-left: auto; margin-right: auto; }
    .home-intro__actions { justify-content: center; }
}

/* =========================================================================
   PROJECTS catalogue  (projects.html)
   ========================================================================= */
.filter-bar { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-6); }
.filter-row { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: center; }
.filter-chip {
    background: var(--surface-1);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    color: var(--text);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: var(--space-2) var(--space-4);
    cursor: pointer;
    transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

/* The catalogue reuses the home page's featured showcase row (blurred artwork,
   scrim, alternating sides) via .featured-row + .featured-row--compact, defined
   in the HOME section above. Only the column layout lives here. */
.project-grid { display: flex; flex-direction: column; gap: var(--space-4); }

/* =========================================================================
   PROJECT HUB  (project.html)
   ========================================================================= */
/* Two-column card over the blurred background (original-site style):
   info (~1/3) | slideshow + summary (~2/3). A scrim keeps text readable. */
/* The title card breaks out of the page column to 70vw; the posts list below
   deliberately stays at the normal content width. */
.hub-hero {
    position: relative;
    /* 70vw, but never narrower than the column it sits in: on smaller screens
       70vw would otherwise make the title card narrower than the posts below. */
    width: max(70vw, 100%);
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: var(--space-6);
    min-height: 320px;
}
@media (max-width: 900px) {
    .hub-hero { width: 100%; left: auto; transform: none; }
}
.hub-hero__bg {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; z-index: 0;
}
.hub-hero::before {
    content: '';
    position: absolute; inset: 0; z-index: 1;
    background: linear-gradient(110deg, rgba(11, 14, 25, 0.92) 0%, rgba(11, 14, 25, 0.72) 45%, rgba(11, 14, 25, 0.55) 100%);
}
.hub-hero__grid {
    position: relative; z-index: 2;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 2fr;
    gap: var(--space-6);
    align-items: start;          /* grow downward; never vertically centre a tall column */
    padding: var(--space-6);
}
.hub-hero--nomedia .hub-hero__grid { grid-template-columns: 1fr; }
.hub-hero__info { min-width: 0; }
.hub-hero__media { min-width: 0; }
/* When the status tag is present, drop the slideshow below it so it can never
   sit on top of ("block") the tag, the card just grows downward instead. */
.hub-hero--status .hub-hero__media { padding-top: calc(var(--space-6) + 8px); }
@media (max-width: 900px) {
    .hub-hero--status .hub-hero__media { padding-top: 0; }
}
.hub-bullets {
    margin: var(--space-5) 0 0;
    padding-left: var(--space-5);
    display: flex; flex-direction: column; gap: var(--space-2);
}
.hub-bullets li { color: var(--text); font-size: 0.95rem; line-height: 1.5; }
.hub-hero__summary { margin-top: var(--space-4); color: var(--text); font-size: 0.95rem; }
@media (max-width: 900px) {
    .hub-hero__grid { grid-template-columns: 1fr; }
    .hub-hero__media { order: -1; }
}
/* Status tag pinned to the top-right of the hero card (e.g. "Actively Developing"). */
.hub-status {
    position: absolute;
    top: var(--space-4);
    right: var(--space-4);
    z-index: 5;   /* always above the hero grid / slideshow */
    background: var(--accent);
    color: var(--on-accent);
    border-radius: var(--radius-pill);
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: var(--shadow-card);
}
.hub-hero__kicker { font-size: 0.85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); margin-bottom: var(--space-2); }
.hub-hero__title { margin: 0; }
.hub-hero__date { color: var(--text-muted); margin-top: var(--space-2); }
.hub-hero__tags { margin-top: var(--space-4); }
.hub-hero__play { margin-top: var(--space-5); }

.hub-posts__title { margin-bottom: var(--space-5); }

/* Posts read as a single vertical column of wide, short rows (thumbnail beside
   the text) rather than a grid of tall cards. */
.post-list { display: flex; flex-direction: column; gap: var(--space-4); }
.post-card {
    display: flex;
    align-items: stretch;
    gap: var(--space-5);
    color: var(--text);
    padding: 0;
}
.post-card:hover { color: var(--text); transform: translateX(4px); }
/* Same forced sizing as the catalogue rows. */
.post-card .card__media {
    flex: 0 0 auto;
    width: clamp(180px, 24%, 260px);
    aspect-ratio: 16 / 9;
    height: auto;
    align-self: center;
    object-fit: cover;
}
.post-card .card__body {
    flex: 1; min-width: 0;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5) var(--space-4) 0;
}
.post-card .card__title { font-size: 1.15rem; }
.post-card .card__text {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    font-size: 0.92rem;
}
@media (max-width: 640px) {
    .post-card { flex-direction: column; }
    .post-card .card__media { flex: 0 0 auto; width: 100%; }
    .post-card .card__body { padding: var(--space-4); }
    .post-card:hover { transform: none; }
}
.post-card__badge {
    display: inline-block; align-self: flex-start;
    background: var(--accent-dim); color: var(--accent);
    border: 1px solid var(--accent); border-radius: var(--radius-pill);
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
    padding: 2px 10px;
}
.post-card__date { color: var(--text-muted); font-size: 0.88rem; }
.load-more { display: block; margin: var(--space-6) auto 0; }

/* =========================================================================
   POST PAGE  (post.html)
   ========================================================================= */
/* Posts run at 50vw, with a floor so they don't get cramped on smaller screens.
   The header, slideshow and body all stretch to that width rather than staying
   pinned to the old fixed column. */
.post-page { max-width: max(50vw, 680px); }
.post-header { max-width: 100%; margin: 0 auto var(--space-6); }
.post-page .post-body { max-width: 100%; }
/* Showcase posts lead with the project's slideshow (see page-post.js). */
.post-showcase-media { max-width: 100%; margin: 0 auto var(--space-7); }
.post-back { display: inline-block; margin-bottom: var(--space-4); font-weight: 600; }
.post-title { margin: 0 0 var(--space-2); }
.post-meta { color: var(--text-muted); }

/* =========================================================================
   404  (404.html)
   ========================================================================= */
.notfound { text-align: center; max-width: 640px; margin: var(--space-7) auto; }
.notfound__code { font-size: clamp(3.5rem, 12vw, 6rem); font-weight: 900; line-height: 1; color: var(--accent); letter-spacing: 0.02em; }
.notfound__title { margin: var(--space-4) 0 var(--space-3); }
.notfound__text { color: var(--text); margin-bottom: var(--space-6); }
.notfound__actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }

/* =========================================================================
   ROLE landing page  (role.html)
   ========================================================================= */
.role-header { text-align: center; max-width: 760px; margin: 0 auto var(--space-7); }
.role-headline { color: var(--accent); margin-bottom: var(--space-4); }
.role-intro { font-size: var(--fs-400); color: var(--text); margin-bottom: var(--space-5); }
.role-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--space-5); }
.role-feature { display: flex; flex-direction: column; }
.role-feature:hover { transform: none; box-shadow: var(--shadow-card); border-color: var(--border); background: var(--surface-1); }
.role-feature__link { display: block; }
.role-feature__title { display: inline-block; margin-bottom: var(--space-2); }
.role-feature__bullets { margin: 0 0 0 var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.role-feature__bullets li { font-size: 0.98rem; color: var(--text); }
