/* IN SYNCH — a Hack Club YSWS about AutomergeKISS.
   Arcade house style, placard mode. Three hues, each one a legend entry:
   red = your edits, blue = their edits, yellow = what Hack Club ships back.
   No shadows, no radii, no gradients (dither and hatch instead), no webfonts.
   FORM AMK-01. */

:root {
    --paper:      #ffffff;
    --ink:        #111111;
    --ink-muted:  #666666;
    --rule-color: #d8d8d8;

    --peer-a:     #ff2d00;   /* your edits */
    --peer-b:     #0037ff;   /* their edits */
    --ship:       #eaff00;   /* what Hack Club ships back */

    --font-body:  -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                  "Helvetica Neue", Arial, sans-serif;
    --font-mono:  ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --size-base:    16px;
    --size-small:   14px;
    --size-display: clamp(2.75rem, 11vw, 7.5rem);
    --size-title:   clamp(1.5rem, 4vw, 2.25rem);

    --leading:       1.5;
    --leading-tight: 1.2;

    --measure-page:  1000px;
    --measure-prose: 62ch;

    --rule:       1px;
    --rule-heavy: 3px;
    --radius:     0;

    --pad:      20px;
    --pad-tight: 10px;
    --gap-section: 44px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper:      #101010;
        --ink:        #ededed;
        --ink-muted:  #999999;
        --rule-color: #333333;
    }
}

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

body {
    margin: 0 auto;
    padding: 0 var(--pad) var(--gap-section);
    max-width: var(--measure-page);
    background: var(--paper);
    color: var(--ink);
    font: var(--size-base)/var(--leading) var(--font-body);
}

p, li, dd { max-width: var(--measure-prose); }

/* label bars are chrome, not prose — they run the full width of their frame */
.peer-label, .merge-label, .listing-name, .edit-log li, .edition { max-width: none; }

h1, h2, h3, h4 { line-height: var(--leading-tight); margin: 0 0 0.1em; }

a { color: inherit; text-decoration: underline; }
a:hover { background: var(--ink); color: var(--paper); }   /* no transition */

code { font: var(--size-small)/var(--leading) var(--font-mono); }
kbd {
    font: var(--size-small)/1 var(--font-mono);
    border: var(--rule) solid var(--ink);
    padding: 1px 4px;
}

rt {
    color: var(--ink-muted);
    font-style: italic;
    font-size: var(--size-small);
}

/* ------------------------------------------------ program banner */

.program-banner {
    background: var(--ink);
    color: var(--paper);
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: var(--pad-tight) 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--pad-tight);
    margin: 0 calc(-1 * var(--pad));
    padding-left: var(--pad);
    padding-right: var(--pad);
}
.program-banner a { color: var(--paper); }
.program-banner a:hover { background: var(--paper); color: var(--ink); }

/* ------------------------------------------------ masthead: nested keylines */

.masthead {
    border: var(--rule-heavy) solid var(--ink);
    border-top: 0;
    margin-bottom: var(--gap-section);
}

.masthead-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--pad-tight);
    border-bottom: var(--rule) solid var(--ink);
    padding: var(--pad-tight) var(--pad);
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.wordmark {
    padding: var(--pad) var(--pad) 0;
    font-size: var(--size-display);
    font-weight: 700;
    line-height: 1;               /* single-line display lockup */
    letter-spacing: -0.03em;
    text-transform: uppercase;
}
/* the rule lives inside the type block, not around it */
.wordmark::after {
    content: "";
    display: block;
    border-top: var(--rule-heavy) solid var(--ink);
    margin-top: 0.08em;
}

.callout {
    padding: var(--pad-tight) var(--pad) var(--pad);
    font-size: var(--size-title);
    font-weight: 700;
    line-height: var(--leading-tight);
    max-width: none;
}
.callout b { color: var(--peer-a); }

.masthead-terms {
    margin: 0;
    border-top: var(--rule) solid var(--ink);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}
.masthead-terms > div {
    padding: var(--pad-tight) var(--pad);
    border-left: var(--rule) solid var(--ink);
}
.masthead-terms > div:first-child { border-left: 0; }
.masthead-terms dt {
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}
.masthead-terms dd { margin: 0; font-weight: 700; }

/* the last keyline row of the masthead: the reward field, above the fold */
.masthead-action {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    justify-content: space-between;
    border-top: var(--rule-heavy) solid var(--ink);
}
.masthead-action p {
    margin: 0;
    padding: var(--pad-tight) var(--pad);
    align-self: center;
    max-width: none;
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.masthead-action .submit-link {
    display: flex;
    align-items: center;
    background: var(--ship);
    color: #111111;                /* the yellow field is never inverted */
    border-left: var(--rule-heavy) solid #111111;
    padding: var(--pad-tight) var(--pad);
    font-size: var(--size-title);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    text-underline-offset: 4px;
}
.masthead-action .submit-link:hover { background: #111111; color: var(--ship); }

/* organizer fills these in. dotted keyline, no hue — an empty field, not a category */
.fill-slot {
    font-family: var(--font-mono);
    font-size: var(--size-small);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 2px dotted var(--ink);
    padding-bottom: 1px;
}

/* ------------------------------------------------ legend */

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--pad);
    padding-left: 0;
    border-top: var(--rule) solid var(--ink);
    border-bottom: var(--rule) solid var(--ink);
    padding: var(--pad-tight) 0;
    margin-bottom: var(--gap-section);
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.legend > li { list-style: none; display: flex; align-items: center; gap: 8px; max-width: none; }
.legend span {
    width: 22px;
    height: 12px;
    border: var(--rule) solid var(--ink);
}
.legend [data-hue="a"]    { background: var(--peer-a); }
.legend [data-hue="b"]    { background: var(--peer-b); }
.legend [data-hue="ship"] { background: var(--ship); }

/* ------------------------------------------------ section headings */

section { margin-bottom: var(--gap-section); }

.section-title {
    font-size: var(--size-title);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
    border-bottom: var(--rule-heavy) solid var(--ink);
    padding-bottom: 4px;
    margin-bottom: var(--pad);
}
.section-title small {
    display: block;
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    font-weight: normal;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
}

.standfirst { font-size: var(--size-base); margin-top: 0; }

/* ------------------------------------------------ convergence plate
   the visible layout rule for this page: two peer columns that merge into one. */

.convergence { margin: 0; border: var(--rule) solid var(--ink); }

.peer-pair { display: grid; grid-template-columns: 1fr 1fr; }
.peer { border-bottom: var(--rule) solid var(--ink); }
.peer + .peer { border-left: var(--rule) solid var(--ink); }

.peer-label {
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 6px var(--pad-tight);
    border-bottom: var(--rule) solid var(--ink);
    color: #ffffff;                /* a printed field: same in light and dark */
}
/* 50% dither, not a tint and not a gradient */
.peer[data-peer="a"] .peer-label {
    background: var(--peer-a)
        repeating-conic-gradient(#111111 0 25%, transparent 0 50%) 0 0 / 6px 6px;
}
.peer[data-peer="b"] .peer-label {
    background: var(--peer-b)
        repeating-conic-gradient(#111111 0 25%, transparent 0 50%) 0 0 / 6px 6px;
}

.edit-log {
    margin: 0;
    padding: var(--pad-tight);
    list-style: none;
    font-family: var(--font-mono);
    font-size: var(--size-small);
}
.edit-log li { max-width: none; }
.edit-log li::before { content: "+ "; }
.peer[data-peer="a"] .edit-log li { color: var(--peer-a); }
.peer[data-peer="b"] .edit-log li { color: var(--peer-b); }

.merge { padding: var(--pad-tight); }
.merge-label {
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--ink);
    color: var(--paper);
    padding: 6px var(--pad-tight);
    margin: 0;
}
.merge ol {
    margin: 0;
    padding: var(--pad-tight) var(--pad-tight) var(--pad-tight) 32px;
    font-family: var(--font-mono);
    font-size: var(--size-small);
}
.merge ol li { max-width: none; }
.merge ol [data-origin="a"] { color: var(--peer-a); }
.merge ol [data-origin="b"] { color: var(--peer-b); }

.convergence figcaption {
    border-top: var(--rule) solid var(--ink);
    padding: var(--pad-tight);
    font-size: var(--size-small);
    color: var(--ink-muted);
}
.convergence figcaption p { max-width: var(--measure-prose); margin: 0; }

/* ------------------------------------------------ brief */

.requirement-list { margin: 0; padding: 0; list-style: none; }
.requirement-list > li {
    border-top: var(--rule) solid var(--rule-color);
    padding: var(--pad-tight) 0 var(--pad-tight) 34px;
    max-width: none;
    position: relative;
}
.requirement-list > li:last-child { border-bottom: var(--rule) solid var(--rule-color); }

/* a real checkbox, drawn as a keyline square that fills solid when met */
.requirement-list input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    left: 0;
    top: 14px;
    width: 16px;
    height: 16px;
    margin: 0;
    display: grid;
    place-content: center;
    border: var(--rule) solid var(--ink);
    background: var(--paper);
    cursor: pointer;
}
.requirement-list input[type="checkbox"]:checked { background: var(--ink); }
/* the mark is drawn, not a glyph, so it never depends on a font having it */
.requirement-list input[type="checkbox"]:checked::after {
    content: "";
    width: 9px;
    height: 5px;
    margin-top: -3px;
    border-left: 2px solid var(--paper);
    border-bottom: 2px solid var(--paper);
    transform: rotate(-45deg);
}
.requirement-list input[type="checkbox"]:focus-visible {
    outline: var(--rule-heavy) solid var(--ink);
    outline-offset: 2px;
}

.requirement-list label { display: block; font-weight: 700; cursor: pointer; }
.requirement-list > li:has(:checked) label {
    color: var(--ink-muted);
    text-decoration: line-through;
    text-decoration-thickness: 2px;
}
.requirement-list p { margin: 0; color: var(--ink-muted); font-size: var(--size-small); }

.tally {
    margin: var(--pad-tight) 0 0;
    max-width: none;
    font: var(--size-small)/var(--leading) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink-muted);
}
.tally button {
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    text-decoration: underline;
    cursor: pointer;
}
.tally button:hover { background: var(--ink); color: var(--paper); }

/* ------------------------------------------------ tutorial */

.tutorial-index {
    margin: 0 0 var(--pad);
    padding: 0;
    list-style: none;
    columns: 2;
    column-gap: var(--pad);
    font: var(--size-small)/var(--leading) var(--font-mono);
}
.tutorial-index li { max-width: none; }

.step {
    border-top: var(--rule-heavy) solid var(--ink);
    padding-top: var(--pad-tight);
    margin-bottom: var(--gap-section);
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);   /* minmax(0,·) so wide code scrolls, not the page */
    gap: 0 var(--pad);
}
.step-index {
    margin: 0;
    font: 700 1.75rem/1 var(--font-mono);
    background: var(--ink);
    color: var(--paper);
    text-align: center;
    padding: 6px 0;
    align-self: start;
}
.step-title {
    font-size: 1.25rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
}
.step-body { grid-column: 2; min-width: 0; }
.step-body > :first-child { margin-top: 0.4em; }
.step-body > :last-child { margin-bottom: 0; }

.listing {
    border: var(--rule) solid var(--ink);
    margin: var(--pad) 0;
    background: var(--paper);
}
.listing-name {
    font: var(--size-small)/var(--leading-tight) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--ink);
    color: var(--paper);
    padding: 6px var(--pad-tight);
    display: flex;
    justify-content: space-between;
    gap: var(--pad-tight);
}
.listing pre {
    margin: 0;
    padding: var(--pad-tight);
    overflow-x: auto;
    font: var(--size-small)/var(--leading) var(--font-mono);
}
.listing pre b { color: var(--peer-a); font-weight: normal; }

/* a caution notice: the hatch is a band beside the text, never behind it */
.notice {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    border: var(--rule-heavy) solid var(--ink);
    margin: var(--pad) 0;
    background: var(--paper);
}
.notice::before {
    content: "";
    border-right: var(--rule) solid var(--ink);
    background: repeating-linear-gradient(
        45deg,
        var(--ink) 0 2px,
        transparent 2px 7px
    );
}
.notice p {
    margin: 0;
    padding: var(--pad-tight);
    max-width: none;
    font-size: var(--size-small);
}
.notice b {
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.topology { margin: var(--pad) 0; }
.topology svg { width: 100%; height: auto; display: block; border: var(--rule) solid var(--ink); }
.topology figcaption { font-size: var(--size-small); color: var(--ink-muted); margin-top: 4px; }

/* ------------------------------------------------ ideas */

.idea-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--pad);
}
.idea {
    padding-left: var(--pad-tight);
    border-left: var(--rule) solid var(--ink);
    max-width: none;
}
.idea b { display: block; }
.idea span { color: var(--ink-muted); font-size: var(--size-small); }

/* ------------------------------------------------ ship field: the reward */

.ship-field {
    background: var(--ship);
    color: #111111;                /* the yellow field is never inverted */
    border: var(--rule-heavy) solid #111111;
    padding: var(--pad);
    text-align: center;
}
.ship-field h2 {
    font-size: var(--size-title);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.01em;
}
.ship-field p { max-width: none; margin: 0 auto var(--pad); }
.ship-field .fill-slot { border-bottom-color: #111111; }

.ship-field .submit-link {
    display: inline-block;
    background: #111111;
    color: var(--ship);
    font: 700 var(--size-title)/1 var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    text-underline-offset: 4px;
    padding: var(--pad-tight) var(--pad);
    border: var(--rule-heavy) solid #111111;
}
.ship-field .submit-link:hover { background: var(--ship); color: #111111; }

.ship-field .ship-note {
    font: var(--size-small)/var(--leading) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: var(--pad) 0 0;
}

/* ------------------------------------------------ faq */

.faq details {
    border-top: var(--rule) solid var(--rule-color);
    padding: var(--pad-tight) 0;
}
.faq details:last-of-type { border-bottom: var(--rule) solid var(--rule-color); }
.faq summary { font-weight: 700; cursor: pointer; }
.faq details[open] summary { margin-bottom: var(--pad-tight); }

/* ------------------------------------------------ footer + edition stamp */

footer { border-top: var(--rule-heavy) solid var(--ink); padding-top: var(--pad-tight); }
footer nav {
    font: var(--size-small)/var(--leading) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.edition {
    font: var(--size-small)/var(--leading) var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    margin-top: var(--pad-tight);
    max-width: none;
}

/* ------------------------------------------------ narrow */

@media (max-width: 820px) {
    .masthead-terms { grid-template-columns: 1fr 1fr; }
    .masthead-terms > div:nth-child(odd) { border-left: 0; }
    .masthead-terms > div:nth-child(n + 3) { border-top: var(--rule) solid var(--ink); }
}

@media (max-width: 620px) {
    /* the reward field takes the whole row rather than sitting in a wrapped gap */
    .masthead-action { display: block; }
    .masthead-action .submit-link {
        display: block;
        text-align: center;
        border-left: 0;
        border-top: var(--rule-heavy) solid #111111;
    }
    .peer-pair { grid-template-columns: 1fr; }
    .peer + .peer { border-left: 0; }
    .step { grid-template-columns: 2.5rem minmax(0, 1fr); gap: 0 var(--pad-tight); }
    .step-index { font-size: 1.25rem; }
    .tutorial-index { columns: 1; }
}
