/* =============================================================================
   Ashcroft-Pemberton — studio.css
   Shared styles for the studio site.

   :root tokens are defaults; pages may override them. Case studies override the
   palette to take on their own accent. Each page may also add page-unique
   components in its own inline <style>.

   Conventions:
   - body class is `studio-page` for the homepage + studio pages, `case-study`
     for the five case studies. A few rules disambiguate by that class.
   ============================================================================= */


/* === Palette tokens (overridable per page) ============================== */
:root {
    --paper:   #f5f3ed;
    --paper-2: #ebe9e1;
    --ink:     #15130f;
    --ink-2:   #443f37;
    --ink-3:   #888178;
    --rule:    #d4ccba;
    --accent:  #6b5747;
    --accent-2:#4a382e;

    /* Selected-works accents — used by mini-artifacts on the homepage and the
       work index. Not overridden per page. */
    --threshold: #c8492c;
    --caesura:   #36505e;
    --latent:    #5a6f86;
    --whilst:    #6e7d57;
    --initial:   #5b3a52;
}


/* === Reset & body baseline ============================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    font-weight: 400;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;

    background-image:
        radial-gradient(circle at 25% 30%, rgba(0,0,0,0.012) 1px, transparent 1px),
        radial-gradient(circle at 75% 70%, rgba(0,0,0,0.018) 1px, transparent 1px);
    background-size: 9px 9px, 13px 13px;
}


/* === Sticky nav (handles studio-links AND case-study-breadcrumb variants) === */
.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--paper) 85%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--rule);
    padding: 18px 56px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-2);
}
.nav .brand {
    font-weight: 500;
    color: var(--ink);
    text-decoration: none;
    transition: color 0.18s ease;
}
.nav .brand:hover { color: var(--accent); }

/* Studio-links variant (homepage + studio pages) */
.nav .links { display: flex; gap: 28px; }
.nav .links a {
    text-decoration: none;
    color: var(--ink-3);
    transition: color 0.18s ease;
}
.nav .links a:hover { color: var(--ink); }
.nav .links a.engage { color: var(--ink); font-weight: 500; }
.nav .links a.current {
    color: var(--ink);
    border-bottom: 1px solid var(--ink);
    padding-bottom: 2px;
}

/* Breadcrumb variant (case studies) */
.nav .breadcrumb { color: var(--ink-2); }
.nav .breadcrumb span { color: var(--ink-3); }
.nav .breadcrumb a {
    color: inherit;
    text-decoration: none;
    transition: color 0.18s ease;
}
.nav .breadcrumb a:hover { color: var(--ink); }


/* === Layout containers ================================================== */
main { padding: 0 32px; }
.container          { max-width: 880px; margin: 0 auto; }
.container--narrow  { max-width: 760px; margin: 0 auto; }
.container--narrowest { max-width: 660px; margin: 0 auto; }

/* Case-study main is its own container (narrower; vertical padding baked in) */
.case-study main {
    max-width: 720px;
    margin: 0 auto;
    padding: 96px 32px 160px;
}


/* === Page head pattern (label + h1 + deck) ============================== */
.head { padding: 96px 0 48px; }
.head .label,
.label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    margin: 0 0 24px;
}
.head h1 {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: clamp(56px, 9vw, 96px);
    line-height: 0.92;
    letter-spacing: -0.035em;
    margin: 0 0 28px;
    color: var(--ink);
}
.head .deck {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 22px;
    line-height: 1.4;
    color: var(--ink-2);
    max-width: 600px;
    margin: 0 0 32px;
}
.head p {
    font-size: 16px;
    line-height: 1.7;
    color: var(--ink-2);
    margin: 0 0 18px;
    max-width: 600px;
}
.head p em { font-style: italic; color: var(--ink); }


/* === Section structure ================================================== */
section { margin: 0 0 64px; }

/* Studio-page sections separated by a top rule */
section.bordered {
    padding-top: 32px;
    border-top: 1px solid var(--rule);
}
section.bordered:first-of-type { border-top: 1px solid var(--ink); }

.section-num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    margin-bottom: 24px;
    display: block;
}

h2 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 28px;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0 0 20px;
    color: var(--ink);
}
.case-study section h2 { font-size: 36px; margin-bottom: 8px; }

h3 {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 20px;
    margin: 40px 0 12px;
    letter-spacing: -0.01em;
}

p {
    font-size: 17px;
    line-height: 1.7;
    color: var(--ink-2);
    margin: 0 0 18px;
}
.case-study p {
    font-size: 17px;
    line-height: 1.65;
    margin-bottom: 20px;
}
p em       { font-style: italic; color: var(--ink); }
p strong   { font-weight: 500; color: var(--ink); }

/* Drop cap on the first paragraph of §01 (both page types) */
section.bordered:first-of-type p:first-of-type::first-letter,
.case-study section:first-of-type p:first-of-type::first-letter {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 56px;
    float: left;
    line-height: 0.85;
    margin: 6px 10px 0 0;
    color: var(--ink);
}


/* === Case-study scaffold (eyebrow + hero + deck + credits) ============== */
.case-study .eyebrow {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    margin-bottom: 32px;
}

.case-study h1.hero {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: clamp(56px, 9vw, 112px);
    line-height: 0.92;
    letter-spacing: -0.035em;
    margin: 0 0 40px;
    color: var(--ink);
}
.case-study h1.hero em { font-style: italic; font-weight: 400; }

.case-study .deck {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: 24px;
    line-height: 1.4;
    color: var(--ink-2);
    margin: 0 0 64px;
    max-width: 600px;
}

.credits {
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 8px 32px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--ink-3);
    margin-bottom: 96px;
    padding: 24px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.credits dt { text-transform: uppercase; letter-spacing: 0.12em; }
.credits dd { margin: 0; color: var(--ink-2); }

.case-study section { margin-bottom: 88px; }


/* === Common typographic blocks ========================================= */
blockquote {
    margin: 40px 0;
    padding: 0 0 0 24px;
    border-left: 2px solid var(--accent);
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 22px;
    line-height: 1.4;
    color: var(--ink);
}
blockquote cite {
    display: block;
    margin-top: 16px;
    font-family: 'JetBrains Mono', monospace;
    font-style: normal;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-3);
}

code {
    background: var(--paper-2);
    padding: 1px 4px;
    border-radius: 2px;
    font-size: 0.85em;
    font-family: 'JetBrains Mono', monospace;
}


/* === Figures (case studies) ============================================ */
.figure {
    margin: 48px 0;
    padding: 32px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
}
.figure-cap {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-3);
    margin-top: 16px;
}


/* === Timeline (case studies) =========================================== */
.timeline { list-style: none; padding: 0; margin: 32px 0; }
.timeline li {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 24px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
    font-size: 15px;
}
.timeline .when {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding-top: 2px;
}


/* === Reveal stage (case studies) =====================================
   Per-piece label/config supplied via --fig-num and --fig-config strings. === */
.reveal-stage {
    margin: 96px 0 64px;
    padding: 120px 32px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    text-align: center;
    position: relative;
}
.reveal-stage::before {
    content: var(--fig-num, '');
    position: absolute;
    top: 16px; left: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-3);
}
.reveal-stage::after {
    content: var(--fig-config, '');
    position: absolute;
    top: 16px; right: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-3);
}
.reveal-caption {
    margin-top: 40px;
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 18px;
    color: var(--ink-2);
}


/* === Pull quote (case studies) ========================================= */
.pull {
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: 32px;
    line-height: 1.2;
    color: var(--ink);
    margin: 64px 0;
    padding: 32px 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    text-align: center;
    letter-spacing: -0.02em;
}
.pull em { font-style: italic; color: var(--accent); }


/* === Like bar (case studies) =========================================== */
.like-bar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--paper);
    padding: 10px 18px;
    border-radius: 999px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: flex;
    gap: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    z-index: 20;
}
.like-bar span { color: var(--paper-2); }
.like-bar strong { color: white; font-weight: 500; }


/* === Body links (case-study cross-references and similar prose links) === */
p a, blockquote a, .case-study .deck a, dd a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid currentColor;
    transition: color 0.18s ease;
}
p a:hover, blockquote a:hover, .case-study .deck a:hover, dd a:hover {
    color: var(--ink);
    border-bottom-color: var(--ink);
}


/* === Forms ============================================================
   Two variants: line-style (default, used on engage) and boxed (used on
   apprenticeship/press/correspondence — wrapped in <form class="boxed">). === */

fieldset { border: none; padding: 0; margin: 0 0 36px; }
legend {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    margin-bottom: 24px;
    padding: 0;
}

.field { margin-bottom: 28px; }
.field.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 540px) {
    .field.row-2 { grid-template-columns: 1fr; gap: 16px; }
}

label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--ink-2);
    margin-bottom: 10px;
}
label .opt {
    color: var(--ink-3);
    text-transform: none;
    letter-spacing: 0.04em;
    font-style: italic;
    margin-left: 6px;
}

input[type="text"], input[type="email"], textarea, select {
    width: 100%;
    font-family: 'Fraunces', serif;
    font-weight: 300;
    font-size: 18px;
    line-height: 1.5;
    color: var(--ink);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--rule);
    padding: 8px 0;
    outline: none;
    transition: border-color 0.18s ease;
    border-radius: 0;
    -webkit-appearance: none;
    appearance: none;
}
input:focus, textarea:focus, select:focus { border-bottom-color: var(--ink); }
input::placeholder, textarea::placeholder {
    color: var(--ink-3);
    font-style: italic;
    opacity: 1;
}
textarea {
    resize: vertical;
    min-height: 140px;
    font-family: 'Fraunces', serif;
}
select {
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="8" viewBox="0 0 12 8"><path d="M1 1l5 5 5-5" fill="none" stroke="%23888178" stroke-width="1.5" stroke-linecap="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 4px center;
    padding-right: 28px;
}

/* Boxed form variant */
form.boxed {
    padding: 32px 36px;
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
}
form.boxed input[type="text"],
form.boxed input[type="email"],
form.boxed textarea {
    background: var(--paper);
    border: 1px solid var(--rule);
    padding: 10px 12px;
    border-radius: 3px;
    font-size: 17px;
}
form.boxed input:focus,
form.boxed textarea:focus { border-color: var(--ink); }
form.boxed textarea { min-height: 100px; }
form.boxed .field { margin-bottom: 22px; }

.help {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    color: var(--ink-3);
    margin-top: 8px;
    font-style: italic;
}

button[type="submit"] {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-weight: 500;
    color: var(--paper);
    background: var(--ink);
    border: 1px solid var(--ink);
    padding: 16px 28px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}
button[type="submit"]:hover {
    background: var(--accent);
    border-color: var(--accent);
}
form.boxed button[type="submit"] { padding: 14px 24px; }

.submit-row {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--rule);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}
.submit-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 8px;
}
.submit-row .note,
.submit-line .note {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 13px;
    color: var(--ink-3);
    line-height: 1.4;
}
.submit-row .note { font-size: 14px; max-width: 320px; text-align: right; }


/* === Common components ================================================ */

/* Address card — used on /studio and /correspondence */
.address-card {
    background: var(--paper-2);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 32px 36px;
    margin: 24px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}
@media (max-width: 600px) {
    .address-card { grid-template-columns: 1fr; }
}
.address-card dt {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-3);
    margin-bottom: 6px;
}
.address-card dd {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink);
    margin: 0 0 14px;
}
.address-card dd a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 1px;
    transition: color 0.18s ease, border-color 0.18s ease;
}
.address-card dd a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Closing italic line — used on apprenticeship, press, correspondence */
.closing {
    margin: 64px 0 96px;
    padding: 32px 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-weight: 300;
    font-size: 22px;
    line-height: 1.5;
    color: var(--ink);
    text-align: center;
    letter-spacing: -0.01em;
}


/* === Mini-artifacts (homepage cards & work-index rows) =================
   Each shows a tiny live rendering of the corresponding case study's artifact. */
.a-button {
    padding: 8px 16px;
    background: var(--threshold);
    color: white;
    border-radius: 3px;
    font: 500 11px/1 'Inter', sans-serif;
}
.a-line {
    width: 80px;
    height: 1px;
    background: var(--caesura);
}
.a-input {
    font: 400 11px/1 'Inter', sans-serif;
    padding: 7px 10px;
    width: 110px;
    border: 1px solid var(--rule);
    border-radius: 3px;
    background: white;
    color: var(--latent);
    font-style: italic;
}
.a-dots { display: inline-flex; gap: 4px; align-items: center; }
.a-dots .d {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--whilst);
    animation: ap-breathe 1.8s ease-in-out infinite;
}
.a-dots .d:nth-child(2) { animation-delay: 200ms; }
.a-dots .d:nth-child(3) { animation-delay: 400ms; }
.a-dropcap {
    font-family: 'Fraunces', serif;
    font-weight: 600;
    font-size: 56px;
    line-height: 0.85;
    color: var(--initial);
}
@keyframes ap-breathe {
    0%, 100% { opacity: 0.22; transform: translateY(0); }
    50%      { opacity: 1;    transform: translateY(-2px); }
}


/* === Footers ==========================================================
   - Studio-page footer: container > row pattern
   - Case-study footer: flat flex of spans                                */
footer {
    border-top: 1px solid var(--rule);
    padding: 56px 0 80px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--ink-3);
}
footer a {
    color: var(--ink-3);
    text-decoration: none;
    transition: color 0.18s ease;
}
footer a:hover { color: var(--ink); }

.studio-page footer .row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}
.studio-page footer .row + .row { margin-top: 24px; }
.studio-page footer .links { display: flex; gap: 24px; flex-wrap: wrap; }

.case-study footer {
    margin-top: 120px;
    padding: 48px 0 56px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}


/* === Reduced motion ==================================================== */
@media (prefers-reduced-motion: reduce) {
    .a-dots .d  { animation: none; opacity: 0.6; }
    .dots .d    { animation: none; opacity: 0.6; }
}
