/* Sentinel.
 *
 * Mobile-first and single-column by default; the two-column layouts are the
 * exception, added at a min-width and never assumed. Written that way round
 * because the reverse -- a desktop grid squeezed down with overrides -- is
 * how a 320px right-hand rail ends up hanging off the side of a phone.
 *
 * Tap targets are 44px minimum. tests/mobile_layout.mjs fails the build when
 * one is under 40, and it has failed for real.
 */

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: var(--step-0)/1.65 var(--sans);
    /* The single most common cause of a sideways-scrolling page: a long
     * unbroken token -- a hostname, a fingerprint, a stack frame -- that no
     * amount of flexbox can shrink. This product is full of them. */
    overflow-wrap: break-word;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 var(--sp-2); font-weight: 650;
             letter-spacing: -0.01em; }
h1 { font-size: var(--step-3); }
h2 { font-size: var(--step-2); margin-top: var(--sp-5); }
h3 { font-size: var(--step-1); margin-top: var(--sp-4); }
p  { margin: 0 0 var(--sp-3); }

code, kbd, pre { font-family: var(--mono); font-size: 0.92em; }
code { background: var(--surface-2); border: 1px solid var(--line-soft);
       border-radius: var(--radius-sm); padding: 0.1em 0.35em; }
pre  { background: var(--surface); border: 1px solid var(--line);
       border-radius: var(--radius); padding: var(--sp-3);
       overflow-x: auto; margin: 0 0 var(--sp-3); }
pre code { background: none; border: 0; padding: 0; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: var(--sp-3); top: var(--sp-3); z-index: 20;
              background: var(--accent); color: var(--accent-ink);
              padding: var(--sp-2) var(--sp-3); border-radius: var(--radius); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px;
                 border-radius: var(--radius-sm); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto;
        padding-inline: var(--sp-3); }
.prose { max-width: var(--prose); }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: var(--step--1); }
.mono  { font-family: var(--mono); }
.nowrap-scroll { overflow-x: auto; }

/* ------------------------------------------------------------- header --- */
.site-head { border-bottom: 1px solid var(--line);
             background: color-mix(in srgb, var(--bg) 85%, transparent);
             position: sticky; top: 0; z-index: 10;
             backdrop-filter: blur(8px); }
.head-row { display: flex; align-items: center; gap: var(--sp-3);
            min-height: 56px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem;
         font-weight: 680; color: var(--ink); text-decoration: none;
         letter-spacing: -0.02em; }
.brand-mark { flex: none; color: var(--accent); }
.head-nav { margin-left: auto; display: flex; align-items: center;
            gap: var(--sp-1); flex-wrap: wrap; }
.head-nav a { color: var(--muted); text-decoration: none;
              padding: 0.6rem 0.6rem; border-radius: var(--radius-sm);
              font-size: var(--step--1); min-height: 44px;
              display: inline-flex; align-items: center; }
.head-nav a:hover { color: var(--ink); background: var(--surface); }

/* ------------------------------------------------------------ buttons --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 0.45rem;
    min-height: 44px; padding: 0.6rem 1.05rem;
    border-radius: var(--radius); border: 1px solid var(--line);
    background: var(--surface-2); color: var(--ink);
    font: inherit; font-weight: 560; text-decoration: none;
    cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-ink);
               border-color: var(--accent); font-weight: 640; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: none; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--ink); background: var(--surface); }
.btn-sm { min-height: 44px; padding: 0.45rem 0.8rem;
          font-size: var(--step--1); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* -------------------------------------------------------------- forms --- */
label { display: block; font-weight: 560; margin-bottom: var(--sp-1);
        font-size: var(--step--1); }
input[type=text], input[type=email], input[type=password], textarea, select {
    width: 100%; min-height: 44px;
    padding: 0.6rem 0.75rem;
    background: var(--bg); color: var(--ink);
    border: 1px solid var(--line); border-radius: var(--radius);
    font: inherit;
    /* 16px minimum, or iOS Safari zooms the page on focus and the person is
     * left scrolled sideways on a form they were trying to fill in. */
    font-size: max(1rem, var(--step-0));
}
textarea { min-height: 8rem; resize: vertical; line-height: 1.5; }
input:focus, textarea:focus { border-color: var(--accent); }
.field { margin-bottom: var(--sp-3); }
.hint { color: var(--muted); font-size: var(--step--1); margin-top: var(--sp-1); }

.notice { border-radius: var(--radius); padding: var(--sp-2) var(--sp-3);
          margin-bottom: var(--sp-3); border: 1px solid var(--line);
          background: var(--surface); font-size: var(--step--1); }
.notice-error { border-color: var(--warn); background: var(--warn-bg);
                color: #ffd9cc; }
.notice-ok { border-color: var(--resolved); background: var(--resolved-bg); }

/* -------------------------------------------------------------- cards --- */
.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--radius); padding: var(--sp-3);
        margin-bottom: var(--sp-3); }
.card-tight { padding: var(--sp-2) var(--sp-3); }

.pill { display: inline-flex; align-items: center; gap: 0.35rem;
        padding: 0.15rem 0.55rem; border-radius: 999px;
        font-size: var(--step--1); font-weight: 560;
        border: 1px solid var(--line); background: var(--surface-2);
        color: var(--muted); }
.pill-open { color: var(--open); background: var(--open-bg);
             border-color: color-mix(in srgb, var(--open) 40%, transparent); }
.pill-resolved { color: var(--resolved); background: var(--resolved-bg);
                 border-color: color-mix(in srgb, var(--resolved) 40%, transparent); }

.row { display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--sp-2); align-items: baseline;
               flex-wrap: wrap; justify-content: space-between; }
.stack > * + * { margin-top: var(--sp-2); }

/* Two columns only where there is room. Never the other way round. */
.split { display: grid; gap: var(--sp-3); }
@media (min-width: 56rem) {
    .split { grid-template-columns: minmax(0, 1fr) minmax(0, 20rem); }
}
.split > * { min-width: 0; }   /* without this a grid child refuses to shrink */

.list { list-style: none; margin: 0; padding: 0; }
.list li + li { margin-top: var(--sp-2); }

.inc-link { display: block; text-decoration: none; color: inherit;
            border: 1px solid var(--line); border-radius: var(--radius);
            background: var(--surface); padding: var(--sp-3); }
.inc-link:hover { border-color: var(--accent); }
.inc-title { font-weight: 600; margin-bottom: var(--sp-1); }

.terms { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: var(--sp-2) 0 0; }
.term { font-family: var(--mono); font-size: var(--step--1);
        background: var(--surface-2); border: 1px solid var(--line-soft);
        border-radius: var(--radius-sm); padding: 0.1rem 0.4rem;
        color: var(--muted); }

/* The line that carries the honest law. It is not decoration; it appears next
 * to every suggestion and must survive a skim. */
.law { border-left: 3px solid var(--accent); padding-left: var(--sp-3);
       color: var(--muted); font-size: var(--step--1); margin: var(--sp-3) 0; }

/* -------------------------------------------------------------- table --- */
/* Wrapped in .nowrap-scroll so a wide table scrolls ITSELF rather than making
 * the whole document scroll sideways. */
table { border-collapse: collapse; width: 100%; font-size: var(--step--1); }
th, td { text-align: left; padding: 0.55rem 0.7rem;
         border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------------- hero --- */
.hero { padding: var(--sp-5) 0 var(--sp-4); }
.hero h1 { max-width: 20ch; }
.lede { font-size: var(--step-1); color: var(--muted); max-width: 46ch;
        margin-bottom: var(--sp-4); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: var(--step--1);
           letter-spacing: 0.06em; text-transform: uppercase;
           margin-bottom: var(--sp-2); }

.grid-3 { display: grid; gap: var(--sp-3); }
@media (min-width: 46rem) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid-3 > * { min-width: 0; }

.site-foot { border-top: 1px solid var(--line); margin-top: var(--sp-6);
             padding: var(--sp-4) 0; color: var(--muted);
             font-size: var(--step--1); }
.site-foot a { color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: var(--sp-3);
              margin-bottom: var(--sp-2); }

details { border: 1px solid var(--line); border-radius: var(--radius);
          background: var(--surface); padding: var(--sp-2) var(--sp-3);
          margin-bottom: var(--sp-2); }
summary { cursor: pointer; font-weight: 580; min-height: 32px;
          padding: 0.35rem 0; }
details[open] summary { margin-bottom: var(--sp-2); }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* The write-the-line queue. Each row is a card CONTAINING a form, so it does
 * not get the .inc-link treatment where the whole row is one link: a textarea
 * and two buttons inside a link is a row whose tap target depends on where the
 * thumb lands. The title alone is the link. */
.plain { list-style: none; margin: 0; padding: 0; }
.plain li + li { margin-top: var(--sp-1); }
a.inc-title { display: inline-block; max-width: 100%; color: inherit;
              text-decoration: none; overflow-wrap: anywhere;
              border-bottom: 1px solid var(--line); }
a.inc-title:hover { border-bottom-color: var(--accent); }

/* An FAQ question is a top-level section of the page, so it is an h2 -- the
 * page went h1 -> h3 and both Lighthouse and a screen reader read that as a
 * level gone missing. The smaller size is a style choice and does not belong
 * in the heading level. */
h2.q { font-size: var(--step-1); margin-top: var(--sp-4); }
