/* ============================================================
   Korimako landing page, direction five: "Clear Draft"
   The Working Draft's content (v3), re-set in Clear Air's
   design system (v4) — white, centered, rounded, calm.
   ============================================================ */

:root {
    --white: #ffffff;
    --black: #101013;
    --charcoal: #1c1c21;
    --gray-900: #27272a;
    --gray-600: #52525b;
    --gray-500: #71717a;
    --gray-300: #d4d4d8;
    --gray-200: #e4e4e7;
    --gray-100: #f4f4f5;
    --green-deep: #5d7047;
    --green-soft: #9aa88a;

    --sans: "Schibsted Grotesk", "Helvetica Neue", Arial, sans-serif;
    --mono: "Fragment Mono", "SFMono-Regular", Menlo, monospace;

    --radius-card: 28px;
    --radius-inner: 20px;
    --shell: 76rem;
    --gutter: clamp(1rem, 3vw, 2.5rem);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--white);
    color: var(--black);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

::selection {
    background: var(--black);
    color: var(--white);
}

a {
    color: inherit;
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
}

:focus-visible {
    outline: 2px solid var(--black);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- pills ---------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.62rem 1.15rem;
    border-radius: 999px;
    font-size: 0.9375rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: var(--sans);
    transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease;
    white-space: nowrap;
}

.pill span {
    transition: transform 160ms ease;
}

.pill:hover span {
    transform: translateX(3px);
}

.pill-dark {
    background: var(--black);
    color: var(--white);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 2px rgba(16, 16, 19, 0.3);
}

.pill-dark:hover {
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 6px 16px rgba(16, 16, 19, 0.22);
}

.pill-ghost {
    background: var(--gray-100);
    color: var(--black);
}

.pill-ghost:hover {
    background: var(--gray-200);
}

/* ---------- header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: calc(var(--shell) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 1rem var(--gutter);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.brand svg {
    width: 1.5rem;
    height: 1.5rem;
    fill: var(--black);
}

.main-nav {
    display: flex;
    gap: clamp(1rem, 2.5vw, 2rem);
    font-size: 0.9375rem;
    font-weight: 500;
}

.main-nav a {
    text-decoration: none;
    color: var(--black);
    opacity: 0.85;
    transition: opacity 140ms ease;
}

.main-nav a:hover {
    opacity: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ---------- hero ---------- */

.hero {
    max-width: 62rem;
    margin: 0 auto;
    padding: clamp(3rem, 8vh, 5.5rem) var(--gutter) 0;
    text-align: center;
}

h1 {
    font-size: clamp(2.375rem, 1.2rem + 4.6vw, 3.75rem);
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.12;
}

h1 em {
    font-style: normal;
    color: var(--green-deep);
}

.hero-sub {
    max-width: 42rem;
    margin: 1.5rem auto 0;
    font-size: 1.125rem;
    color: var(--gray-500);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 2rem;
}

.command-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    background: var(--gray-100);
    border-radius: 999px;
    padding: 0.62rem 1.15rem;
    font-family: var(--mono);
    font-size: 0.8125rem;
}

.command-pill button,
.command-row button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    transition: color 140ms ease;
}

.command-pill button:hover,
.command-row button:hover {
    color: var(--black);
}

/* ---------- scene ---------- */

.scene-card {
    position: relative;
    max-width: calc(var(--shell) + 2 * var(--gutter));
    margin: clamp(2.5rem, 6vh, 4rem) auto 0;
    padding: 0 var(--gutter);
}

/* Definitions only — takes no layout space. */
.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

.scene {
    display: block;
    width: 100%;
    height: clamp(220px, 32vw, 400px);
    border-radius: var(--radius-card);
}

.scene-mark {
    position: absolute;
    left: 50%;
    bottom: clamp(1.5rem, 4vw, 3rem);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 4px 18px rgba(16, 16, 19, 0.12);
}

.scene-mark svg {
    width: 1.6rem;
    height: 1.6rem;
    fill: var(--green-deep);
}

.scene-mark-static {
    position: static;
    transform: none;
    margin: 0 auto 1.4rem;
}

/* ---------- sections ---------- */

.section {
    max-width: calc(var(--shell) + 2 * var(--gutter));
    margin: 0 auto;
    padding: clamp(4rem, 10vh, 7rem) var(--gutter) 0;
    text-align: center;
}

.sec-badge {
    display: inline-flex;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    background: var(--gray-100);
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--green-deep);
    margin-bottom: 1.1rem;
}

.sec-badge-dark {
    background: var(--charcoal);
    color: var(--green-soft);
}

h2 {
    font-size: clamp(1.75rem, 1rem + 2.6vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.section-sub {
    max-width: 38rem;
    margin: 1rem auto 0;
    font-size: 1.0625rem;
    color: var(--gray-500);
}

.section-sub code {
    color: var(--gray-900);
    background: var(--gray-100);
    padding: 0.1em 0.4em;
    border-radius: 6px;
}

.section-footnote {
    max-width: 36rem;
    margin: 2.2rem auto 0;
    font-size: 0.9375rem;
    color: var(--gray-500);
}

.section-footnote a {
    color: var(--gray-600);
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid var(--gray-300);
    transition: color 140ms ease, border-color 140ms ease;
}

.section-footnote a:hover {
    color: var(--black);
    border-color: var(--gray-500);
}

/* ---------- folio (fig. 1) ---------- */

.folio {
    max-width: 44rem;
    margin: 0 auto;
    background: var(--gray-100);
    border-radius: var(--radius-inner);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    text-align: left;
}

.tree {
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 2.1;
}

.tree-row {
    display: flex;
    align-items: baseline;
    padding-left: calc(var(--depth) * 1.4rem);
    white-space: nowrap;
}

.tree .entry {
    color: var(--black);
}

.tree .entry.dir {
    color: var(--green-deep);
    font-weight: 500;
}

.tree .leader {
    flex: 1;
    min-width: 1.5rem;
    margin: 0 0.7rem;
    border-bottom: 1px dotted var(--gray-300);
    transform: translateY(-0.32em);
}

.tree .note {
    color: var(--gray-500);
    font-family: var(--sans);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.folio figcaption {
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--gray-200);
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--gray-500);
    line-height: 1.7;
}

.folio figcaption code {
    color: var(--green-deep);
}

/* ---------- §1 clauses ---------- */

.clauses {
    max-width: 44rem;
    margin: 2.2rem auto 0;
    list-style: none;
    background: var(--gray-100);
    border-radius: var(--radius-inner);
    padding: 0.6rem clamp(1.3rem, 3vw, 2rem);
    text-align: left;
}

.clauses li {
    display: flex;
    gap: 1.1rem;
    padding: 1.15rem 0;
    border-bottom: 1px solid var(--gray-200);
}

.clauses li:last-child {
    border-bottom: none;
}

.clause-num {
    flex: none;
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--green-deep);
    padding-top: 0.2rem;
}

.clauses strong {
    font-weight: 600;
}

.clauses li span {
    color: var(--gray-600);
}

.clauses code {
    background: var(--white);
    padding: 0.1em 0.4em;
    border-radius: 6px;
    color: var(--gray-900);
}

/* Clauses that introduce a later section link down to it, so the principles
   read as the page's contents rather than a preamble beside it. */
.clause-ref {
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--green-deep);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid transparent;
    transition: border-color 140ms ease;
}

.clause-ref:hover,
.clause-ref:focus-visible {
    border-bottom-color: var(--green-deep);
}

/* ---------- §2 panels ---------- */

.panel-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.2rem;
    max-width: 54rem;
    margin: 2.2rem auto 0;
    text-align: left;
}

.panel {
    min-width: 0;
    background: var(--gray-100);
    border-radius: var(--radius-inner);
    padding: 1.4rem 1.5rem 1.5rem;
}

.panel-title {
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--gray-200);
}

.code {
    font-family: var(--mono);
    font-size: 0.8125rem;
    line-height: 1.9;
    overflow-x: auto;
}

.code .c,
.command-row .c {
    color: var(--gray-500);
}

.code .g,
.command-row .g {
    color: var(--green-deep);
}

.model-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.model-tabs button {
    font-family: var(--sans);
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--white);
    border: none;
    color: var(--gray-600);
    padding: 0.42rem 0.9rem;
    border-radius: 999px;
    cursor: pointer;
    transition: color 140ms ease, background 140ms ease;
}

.model-tabs button:hover {
    color: var(--black);
}

.model-tabs button[aria-selected="true"] {
    background: var(--black);
    color: var(--white);
}

.command-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    background: var(--white);
    border-radius: 14px;
    padding: 0.75rem 1rem;
    font-family: var(--mono);
    font-size: 0.8125rem;
    min-width: 0;
}

.command-row code {
    font-size: inherit;
    white-space: nowrap;
    overflow-x: auto;
    min-width: 0;
    flex: 1 1 auto;
    scrollbar-width: none;
}

.command-row code::-webkit-scrollbar {
    display: none;
}

/* ---------- §3 dark card ---------- */

.dark-card {
    background: var(--black);
    color: var(--white);
    border-radius: var(--radius-card);
    padding: clamp(2.2rem, 5vw, 3.5rem);
}

.dark-card h2 {
    color: var(--white);
}

.dark-lead {
    max-width: 34rem;
    margin: 1rem auto 0;
    font-size: 1.0625rem;
    color: rgba(255, 255, 255, 0.62);
}

.ledger-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 2.2rem;
    text-align: left;
}

.ledger-tile {
    background: var(--charcoal);
    border-radius: var(--radius-inner);
    padding: 1.4rem 1.5rem;
}

.ledger-tile-green {
    background: linear-gradient(150deg, #6e8253 0%, #4c5c3c 100%);
}

.ledger-tile .clause-num {
    display: block;
    color: var(--green-soft);
    margin-bottom: 0.5rem;
}

.ledger-tile-green .clause-num {
    color: rgba(255, 255, 255, 0.75);
}

.ledger-tile p {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.72);
}

.ledger-tile em {
    font-style: normal;
    font-weight: 600;
    color: var(--white);
}

.ledger-tile code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.1em 0.4em;
    border-radius: 6px;
    color: var(--white);
}

/* ---------- §4 room ---------- */

.room {
    max-width: 38rem;
    margin: 2.4rem auto 0;
    display: grid;
    gap: 1.1rem;
    text-align: left;
}

.scene-line {
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--gray-500);
    text-align: center;
    margin-bottom: 0.6rem;
}

.msg {
    display: flex;
    gap: 0.8rem;
    align-items: flex-start;
}

.avatar {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.1rem;
    height: 2.1rem;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 600;
}

.avatar-you {
    background: var(--black);
    color: var(--white);
}

.avatar-plato {
    background: var(--gray-100);
    color: var(--black);
}

.avatar-code {
    background: #e6ebdd;
    color: var(--green-deep);
    font-size: 0.6rem;
}

.avatar-troll {
    background: var(--gray-100);
    color: var(--gray-500);
}

.msg-col {
    min-width: 0;
    display: grid;
    gap: 0.4rem;
}

.msg-body {
    background: var(--gray-100);
    border-radius: 18px;
    padding: 0.85rem 1.1rem;
}

.msg-name {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    margin-bottom: 0.2rem;
}

.msg-body p {
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.msg-body em {
    font-style: normal;
    font-weight: 600;
    color: var(--green-deep);
}

.msg-body .direction {
    font-style: italic;
    color: var(--gray-500);
    margin-bottom: 0.2rem;
}

.msg-silent .msg-body {
    background: transparent;
    border: 1px dashed var(--gray-300);
}

.msg-routing {
    font-family: var(--mono);
    font-size: 0.75rem;
    color: var(--gray-500);
    padding-left: 1.1rem;
}

.msg-routing em {
    font-style: normal;
    color: var(--green-deep);
}

/* ---------- §5 status ---------- */

.status-card {
    max-width: 48rem;
    margin: 2.2rem auto 0;
    background: var(--gray-100);
    border-radius: var(--radius-inner);
    padding: 0.6rem clamp(1.3rem, 3vw, 2rem);
    text-align: left;
}

.status-row {
    display: grid;
    grid-template-columns: 1.6rem minmax(9rem, 15rem) minmax(0, 1fr);
    column-gap: 1rem;
    align-items: baseline;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--gray-200);
    font-size: 0.9375rem;
}

.status-row:last-child {
    border-bottom: none;
}

.mark {
    font-style: normal;
}

.mark.done { color: var(--green-deep); }
.mark.partial { color: var(--green-soft); }
.mark.planned { color: var(--gray-300); }

.status-name {
    font-weight: 600;
}

.status-note {
    color: var(--gray-500);
}

.status-legend {
    display: flex;
    justify-content: center;
    gap: 1.6rem;
    margin-top: 1.1rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.status-legend i {
    margin-right: 0.35rem;
}

/* ---------- §6 steps ---------- */

.steps {
    max-width: 44rem;
    margin: 2.2rem auto 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 1.8rem;
    text-align: left;
}

.step {
    min-width: 0;
}

.step > p {
    color: var(--gray-500);
    margin-bottom: 0.7rem;
}

.step .command-row {
    background: var(--gray-100);
}

/* ---------- colophon closer ---------- */

.closer-card {
    position: relative;
    max-width: calc(var(--shell) + 2 * var(--gutter));
    margin: clamp(4rem, 10vh, 7rem) auto 0;
    padding: 0 var(--gutter);
}

.closer-scene {
    height: clamp(360px, 42vw, 480px);
}

.closer-copy {
    position: absolute;
    inset: 0;
    padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.colophon-note {
    max-width: 30rem;
    font-size: clamp(1.25rem, 1rem + 1.2vw, 1.625rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    line-height: 1.35;
}

.colophon-note em {
    font-style: italic;
    color: var(--green-deep);
}

.colophon-meta {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--gray-600);
}

/* ---------- footer ---------- */

.site-footer {
    max-width: calc(var(--shell) + 2 * var(--gutter));
    margin: 0 auto;
    padding: clamp(3rem, 8vh, 5rem) var(--gutter) 1.5rem;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.875rem;
    padding-bottom: 2.5rem;
}

.footer-links a {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    transition: color 140ms ease;
}

.footer-links a:hover {
    color: var(--black);
}

.footer-mark {
    display: flex;
    align-items: baseline;
    justify-content: center;
    font-size: clamp(4rem, 16vw, 14rem);
    font-weight: 600;
    letter-spacing: -0.04em;
    line-height: 0.95;
    color: var(--black);
    user-select: none;
}

.footer-mark svg {
    width: 0.5em;
    height: 0.5em;
    fill: var(--green-deep);
    transform: translateY(0.06em);
    margin-left: 0.04em;
}

/* ---------- reveals ---------- */

.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 600ms cubic-bezier(0.22, 1, 0.36, 1), transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

.delay-1 { transition-delay: 90ms; }
.delay-2 { transition-delay: 180ms; }
.delay-3 { transition-delay: 270ms; }

/* ---------- responsive ---------- */

@media (max-width: 960px) {
    .ledger-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 880px) {
    .main-nav {
        display: none;
    }

    .panel-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 640px) {
    .ledger-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .status-row {
        grid-template-columns: 1.6rem minmax(0, 1fr);
        row-gap: 0.15rem;
    }

    .status-note {
        grid-column: 2;
    }
}

@media (max-width: 560px) {
    .pill-ghost {
        display: none;
    }

    .tree .note,
    .tree .leader {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
