/* ============================================================
   CSS CUSTOM PROPERTIES
   ============================================================ */

:root {
    --color-background:      #FFFFFF;
    --color-text-primary:    #292929;
    --color-text-secondary:  #B7B7B7;
    --color-ui-background:   #EEEEEE;

    /* Viewport edge inset — controls edge-anchored UI (TB., SANDBOX, © 2026, LEGAL NOTICE) */
    /* NOT a grid margin. The composition grid has 0px outer margin. */
    /* Desktop values set in min-width: 769px. Mobile values below come from
       the mobile Single Work mockup (402px frame: 15px sides, 16px top). */
    --page-inset-x:          15px;
    --header-inset-top:      16px;
    --footer-inset-bottom:   28px;

    /* Header row: pills + logo GIF all centred on the pill row's axis. */
    --pill-height:           24px;
    --header-gif-width:      50px;

    /* ── Canonical 12-column composition grid ──────────────────
       Source of truth: Figma grid settings
         Count:  12   Type: Stretch   Width: Auto
         Gutter: 20px   Margin: 0px
       One place to update if grid spec changes.
       See docs/GRID-SYSTEM.md for full reference.
    ──────────────────────────────────────────────────────────── */
    --grid-cols:             12;
    --grid-gutter:           20px;
}

/* ============================================================
   SCROLLBAR — hidden globally on the frontend
   ============================================================
   Hides the native browser scrollbar visually on all frontend
   pages. Scrolling itself is never disabled — only the bar UI
   is removed. wp-admin is unaffected (separate stylesheet).
   ============================================================ */

html {
    scrollbar-width: none;          /* Firefox */
}

html::-webkit-scrollbar {
    display: none;                  /* Chromium, Edge, Safari */
}

/* ============================================================
   RESET & BOX SIZING
   ============================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

* {
    margin: 0;
    padding: 0;
}

/* ============================================================
   BODY
   ============================================================ */

body {
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 400;
    font-size: 11px;
    line-height: 1.4;
    text-transform: uppercase;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, h3, h4, h5, h6 {
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-primary);
    line-height: 1.4;
}

p {
    font-size: 11px;
    color: var(--color-text-primary);
}

/* ============================================================
   LINKS
   ============================================================ */

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================================
   MEDIA
   ============================================================ */

img,
video,
svg {
    display: block;
    max-width: 100%;
}

/* ============================================================
   BUTTONS
   ============================================================ */

button {
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    padding: 0;
    line-height: 1;
}

/* ============================================================
   PILL COMPONENT + NAV LINK
   ============================================================
   Both share the UI control type and the pill row's height (same
   axis, same baseline). Only .pill has a surface.
   .pill     — contextual controls (project × / title / →, About ×).
   .nav-link — global navigation (ABOUT, CONTACT, SANDBOX): plain
               text, the element box IS the text, so it sits exactly
               on its grid line / safety inset. ::after keeps an
               invisible pill-sized hit area (old pill padding).
   ============================================================ */

.pill,
.nav-link {
    display: inline-flex;
    align-items: center;
    color: var(--color-text-primary);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-weight: 500;
    font-size: 11px;
    height: var(--pill-height);
    padding: 0 0 1px; /* 1px bottom: optical correction for Helvetica Neue cap metrics */
    border: none;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    line-height: 1;
}

.pill {
    background-color: var(--color-ui-background);
    padding: 0 16px 1px;
    border-radius: 999px;
}

.nav-link {
    position: relative; /* hit area anchor; edge-anchored items override with absolute */
}

.nav-link::after {
    content: '';
    position: absolute;
    inset: 0 -16px;
}

/* ============================================================
   GRID UTILITY — 12 COLUMNS
   ============================================================
   Apply to any full-width block-level element to establish the
   canonical composition grid. 0px outer margin — columns begin
   at the element's left edge (which must be at the viewport
   left edge for the geometry to match Figma).
   ============================================================ */

.grid {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
    column-gap: var(--grid-gutter);
}

/* ============================================================
   GRID PLACEMENT — THREE-PROPERTY MODEL
   ============================================================
   Every composition element has three independent properties:

   1. AREA     → grid-column: [start] / [end]
      Which columns the element occupies. Defines its horizontal
      extent. Use grid lines (1–13) to specify start and end.

   2. ALIGNMENT → justify-self: stretch | start | end | center
      Where the element sits within its assigned grid area.
      Default: stretch — element FILLS its grid area.
      Use start/end/center for intrinsic-width elements that
      must not grow to fill the area (pills, labels, links).

   3. WIDTH    → follows from ALIGNMENT
      stretch  → element fills the full grid area width
      start/end/center → element uses its natural content width

   Alignment helper classes — use on a direct child of .grid
   alongside grid-column declarations in page CSS:
   ============================================================ */

/* Intrinsic-width, left-aligned in its grid area */
.g-start  { justify-self: start;  }

/* Intrinsic-width, right-aligned in its grid area */
.g-end    { justify-self: end;    }

/* Intrinsic-width, centered in its grid area */
.g-center { justify-self: center; }

/* No .g-stretch — stretch is the CSS Grid default.
   Omit any helper class for fill/block elements. */

/* ============================================================
   SITE HEADER
   ============================================================ */

.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    pointer-events: none;
}

/*
 * Uses the canonical 0-margin composition grid — identical geometry
 * to .grid, debug overlay, and page content containers.
 * Columns span the full viewport width (0px outer margin, 20px gutter).
 * TB. and SANDBOX are absolutely positioned inside .site-header, so
 * they don't participate in this grid and are unaffected by it.
 */
.site-header__inner {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
    column-gap: var(--grid-gutter);
    padding-top: var(--header-inset-top);
    align-items: center;
    pointer-events: none;
}

/*
 * LOGO (animated GIF, links Home) — EDGE-ANCHORED, the identity slot
 * previously held by the TB. pill. No pill / background.
 * Vertical: box centred on the pill row's axis (the figure's mean centre
 * across all 29 frames is the box centre, measured).
 * Horizontal: the asset has transparent padding — across all frames the
 * figure never comes closer than 9.6% of the box width to its left edge —
 * so the box is pulled left by that much: the visible figure starts on the
 * safety inset, like TB. did.
 */
.site-header__logo {
    position: absolute;
    top: calc(var(--header-inset-top) + var(--pill-height) / 2);
    left: calc(var(--page-inset-x) - var(--header-gif-width) * 0.096);
    width: var(--header-gif-width);
    transform: translateY(-50%);
    pointer-events: auto;
}

.site-header__logo img {
    width: 100%;
    height: auto;
}

/* Slightly larger invisible hit area than the (already roomy) GIF box. */
.site-header__logo::after {
    content: '';
    position: absolute;
    inset: -6px;
}

/*
 * Desktop navigation.
 * display: contents makes the <nav> invisible to the grid,
 * letting each nav link participate directly as a grid child.
 * This preserves the <nav> landmark for accessibility while
 * enabling individual column placement.
 */
.site-header__nav {
    display: contents;
}

/* ABOUT — GRID-ALIGNED. Right edge aligns to right edge of column 9 (4th column from right). */
.site-header__about {
    grid-column: 9;
    justify-self: end;
    pointer-events: auto;
}

/* CONTACT — GRID-ALIGNED. Right edge aligns to right edge of column 10 (3rd column from right). */
.site-header__contact {
    grid-column: 10;
    justify-self: end;
    pointer-events: auto;
}

/*
 * SANDBOX — EDGE-ANCHORED.
 * Positioned absolutely relative to .site-header (position: fixed).
 * Independent of the composition grid column count.
 * (display: none on mobile)
 */
.site-header__sandbox {
    position: absolute;
    top: var(--header-inset-top);
    right: var(--page-inset-x);
    pointer-events: auto;
}

/* Sandbox not public (inc/sandbox-access.php): same text, same place, faded.
   No pointer, no invisible hit area. */
.site-header__sandbox[aria-disabled="true"] {
    opacity: 0.3;
    cursor: default;
}

.site-header__sandbox[aria-disabled="true"]::after {
    content: none;
}

/* NAV UNDER LAYER — separate fixed stacking context, z-index 40.
   Sits below the About backdrop (z-index 50) so elements here are naturally
   covered by the backdrop rather than sitting above it.
   Same 12-column grid geometry as .site-header__inner. */
.site-nav-under-layer {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
    pointer-events: none;
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
    column-gap: var(--grid-gutter);
    padding-top: var(--header-inset-top);
    align-items: center;
}

/* ============================================================
   SITE FOOTER
   ============================================================ */

.site-footer__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--footer-inset-bottom) var(--page-inset-x);
}

.site-footer__copyright,
.site-footer__legal {
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: var(--color-text-primary);
    text-decoration: none;
}

/* ============================================================
   GENERIC PAGE (index.php) — Legal Notice, 404
   Same typography and placement as the Single Work intro: grid line 4,
   title → 16px → secondary-colour text. Mobile: the one-column inset.
   ============================================================ */

.page {
    display: grid;
    grid-template-columns: repeat(var(--grid-cols), minmax(0, 1fr));
    column-gap: var(--grid-gutter);
    padding: 132px 0 80px;
    min-height: 100vh;
    min-height: 100dvh;
}

.page__inner {
    grid-column: 4 / 8;
}

.page__title {
    margin-bottom: 16px;
}

.page__content,
.page__content p,
.page__content li,
.page__list li {
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.page__content p,
.page__content ul,
.page__content ol {
    margin-bottom: 16px;
}

.page__content h2,
.page__content h3,
.page__content h4 {
    margin: 36px 0 16px;
}

.page__content ul,
.page__content ol,
.page__list {
    list-style: none;
}

.page__content a {
    color: var(--color-text-primary);
}

/* Visually hidden, still read by screen readers / indexed (WordPress convention). */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   RESPONSIVE — PROVISIONAL BREAKPOINT: 768px
   ============================================================
   This breakpoint is provisional.
   Will be confirmed from Figma during layout implementation.
   ============================================================ */

/* Desktop insets — tighter frame closer to viewport edges */
@media (min-width: 769px) {
    :root {
        --page-inset-x:        20px;
        --header-inset-top:    16px;
        --footer-inset-bottom: 16px;
    }

    /* Narrow desktop (below ~1180px) the columns get narrower than the labels:
       ABOUT (right edge on grid line 10) would run into CONTACT (line 11) —
       they overlapped at 769–1000px. ABOUT text keeps at least 48px from the
       CONTACT text (52px wide); zero offset (pure grid position) wherever the
       column is wide enough. */
    .site-header__about {
        margin-right: max(0px, calc(
            52px + 48px + var(--grid-gutter) * (var(--grid-cols) - 1) / var(--grid-cols)
            - 100vw / var(--grid-cols) - var(--grid-gutter)
        ));
    }
}

@media (max-width: 768px) {

    /* Mobile header:  LOGO (GIF)  ·····  ABOUT  CONTACT
       ABOUT + CONTACT form one right-aligned group. They live in two layers
       (ABOUT under the About backdrop, CONTACT above it — the desktop stacking
       model), so the group is shared geometry, not one wrapper: CONTACT is
       the slot at the right inset (fixed width = its "CONTACT" text width,
       text right-aligned, so the slot never depends on font rendering) and
       ABOUT ends one gap before it. Gap = visible text gap of the mockup
       (28px between the former pills + 2 × 16px pill padding). */
    :root {
        --header-actions-gap: 60px;
        --header-contact-w:   52px;
        --header-about-right: calc(var(--page-inset-x) + var(--header-contact-w) + var(--header-actions-gap));
    }

    .site-header__sandbox {
        display: none;
    }

    /* grid-column reset: an absolute grid item would otherwise be positioned
       inside its grid column instead of against the full-width layer. */
    .site-header__contact {
        grid-column: auto;
        position: absolute;
        top: var(--header-inset-top);
        right: var(--page-inset-x);
        width: var(--header-contact-w);
        justify-content: flex-end;
    }

    .site-header__about {
        grid-column: auto;
        position: absolute;
        top: var(--header-inset-top);
        right: var(--header-about-right);
    }

    /* About close × (header, above the backdrop) takes ABOUT's place, right
       edges aligned — ABOUT stays under the backdrop, as on desktop. */
    .site-header__about-close {
        grid-column: auto;
        grid-row: auto;
        position: absolute;
        top: var(--header-inset-top);
        right: var(--header-about-right);
    }

    .page {
        display: block;
        padding: calc(var(--header-inset-top) + var(--pill-height) + 52px) var(--page-inset-x) 60px;
    }

    .page__inner {
        max-width: 400px;
    }

    .page__content,
    .page__content p,
    .page__content li,
    .page__list li {
        line-height: 1.2;
    }

    /* No footer on mobile: © 2026 is dropped and Legal Notice lives in the
       About overlay. display:none — no residual height. */
    .site-footer {
        display: none;
    }

    /* Touch: invisible hit area around the small header items
       (visual size unchanged — 24px row, ~44px targets). */
    .site-header__about::after,
    .site-header__contact::after,
    .site-header__about-close::after {
        content: '';
        position: absolute;
        inset: -10px;
    }

}
