/* Tanooki Studios — one stylesheet, both themes.
 *
 * The palette is pulled off the logo: the tan and the dark bands of the tail,
 * and the cream the wordmark was set in. Nothing here is invented.
 *
 * Theme: the page follows the operating system by default and a toggle in the
 * header can override it, stored in localStorage. That means three states, and
 * the reason every colour below is defined on bare :root first is that the
 * default "follow the system" state stamps no attribute at all — a colour whose
 * only definition lives inside a media query has no value in light mode.
 *
 * Contrast: every text/ground pair here clears WCAG AA (4.5:1) in both themes;
 * the worst is 4.78:1. The brand tan (#C68A4E) manages 6.3:1 on the dark ground
 * but only 2.8:1 on the cream one, so light mode reads with a darkened version
 * of the same hue and --tan is used for exactly one thing: a 3px card border.
 */

:root {
    /* ground */
    --bg:          #faf7f2;
    --bg-2:        #f2ece2;
    --surface:     #ffffff;
    --raised:      #f6f1e9;
    --border:      #e2d9cb;
    --border-firm: #cfc2ad;

    /* ink */
    --text:        #1e1a15;
    --text-2:      #59503f;   /* 7.4:1 */
    --text-3:      #6f6653;   /* 5.2:1 — small print is still meant to be read */

    /* brand */
    --tan:         #c68a4e;   /* fills, borders, the mark — never small text here */
    --accent:      #8a5522;   /* 6.6:1 on --bg  */
    --accent-hi:   #6f4319;   /* hover / pressed */
    --on-accent:   #fffaf3;   /* 6.9:1 on --accent */
    --band:        #3b2c1f;   /* the dark bands of the tail */

    /* state */
    --ok:          #1f6b45;   /* 5.4:1 */
    --ok-bg:       #e6f3ec;
    --bad:         #a32633;   /* 6.1:1 */
    --bad-bg:      #fbe9ea;

    --shadow: 0 1px 2px rgb(30 26 21 / .05), 0 8px 24px -12px rgb(30 26 21 / .18);

    --measure: 66ch;
    --page: 1080px;
    --radius: 14px;
    --radius-sm: 9px;

    --display: "Poppins", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --body: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
            "Helvetica Neue", Arial, sans-serif;
    --hand: "Caveat", "Segoe Script", cursive;
}

/* Dark, in both the ways a reader can arrive at it. Redefining the same tokens
 * twice is deliberate: the media query serves the default "system" state, the
 * attribute serves an explicit choice, and the toggle has to beat the system. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:          #17140f;
        --bg-2:        #1c1813;
        --surface:     #221d17;
        --raised:      #2a241c;
        --border:      #362e24;
        --border-firm: #4a4033;

        --text:        #f2ece0;
        --text-2:      #b5a892;   /* 8.2:1 */
        --text-3:      #9b8e79;   /* 5.9:1 */

        --tan:         #c68a4e;
        --accent:      #d99b5c;   /* 8.0:1 on --bg — light mode's brown would be 2.4:1 here */
        --accent-hi:   #eaad72;
        --on-accent:   #1b1610;   /* dark text on the tan button, not white */
        --band:        #2b2018;

        --ok:          #5fca97;
        --ok-bg:       #16281f;
        --bad:         #f08a92;
        --bad-bg:      #2c1719;

        --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -14px rgb(0 0 0 / .7);
    }
}

:root[data-theme="dark"] {
    --bg:          #17140f;
    --bg-2:        #1c1813;
    --surface:     #221d17;
    --raised:      #2a241c;
    --border:      #362e24;
    --border-firm: #4a4033;

    --text:        #f2ece0;
    --text-2:      #b5a892;
    --text-3:      #9b8e79;

    --tan:         #c68a4e;
    --accent:      #d99b5c;
    --accent-hi:   #eaad72;
    --on-accent:   #1b1610;
    --band:        #2b2018;

    --ok:          #5fca97;
    --ok-bg:       #16281f;
    --bad:         #f08a92;
    --bad-bg:      #2c1719;

    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 10px 28px -14px rgb(0 0 0 / .7);
}

/* --- fonts --------------------------------------------------------------- */
/* Self-hosted rather than linked from Google: one less third party watching
 * who reads the page, and it removes a render-blocking cross-origin request.
 * swap, so the text is readable before the font lands. */

@font-face {
    font-family: "Poppins"; font-style: normal; font-weight: 500; font-display: swap;
    src: url("fonts/poppins-500.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins"; font-style: normal; font-weight: 600; font-display: swap;
    src: url("fonts/poppins-600.woff2") format("woff2");
}
@font-face {
    font-family: "Poppins"; font-style: normal; font-weight: 700; font-display: swap;
    src: url("fonts/poppins-700.woff2") format("woff2");
}
@font-face {
    font-family: "Caveat"; font-style: normal; font-weight: 600; font-display: swap;
    src: url("fonts/caveat-600.woff2") format("woff2");
}

/* --- base ---------------------------------------------------------------- */

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--body);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

img { max-width: 100%; height: auto; }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; line-height: 1.18; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: clamp(2rem, 1.3rem + 2.6vw, 3.1rem); font-weight: 700; letter-spacing: -.028em; }
h2 { font-size: clamp(1.4rem, 1.15rem + .95vw, 1.85rem); }
h3 { font-size: 1.12rem; }

p { margin: 0 0 1.1em; }
p, li { color: var(--text-2); }
.prose { max-width: var(--measure); }
.prose p, .prose li { font-size: 1.02rem; }
.prose > p:first-of-type { font-size: 1.12rem; color: var(--text); }

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

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

.wrap { max-width: var(--page); margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 720px; }

.skip {
    position: absolute; left: -9999px; top: 0;
    background: var(--surface); color: var(--text);
    padding: 12px 18px; border-radius: 0 0 var(--radius-sm) 0; z-index: 100;
}
.skip:focus { left: 0; }

.eyebrow {
    font-family: var(--display);
    font-size: .74rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .13em;
    color: var(--accent); margin: 0 0 .9em;
}

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

.site-head {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .site-head { background: var(--bg); } }

.site-head .wrap {
    display: flex; align-items: center; gap: 18px;
    min-height: 68px;
}

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; margin-right: auto; }
.brand img { width: 46px; height: auto; display: block; }
.brand .name {
    font-family: var(--display); font-weight: 700;
    font-size: .96rem; letter-spacing: .17em; line-height: 1;
    color: var(--text);
}
.brand .sub {
    display: block;
    font-family: var(--display); font-weight: 500;
    font-size: .58rem; letter-spacing: .3em; line-height: 1;
    color: var(--accent); margin-top: 5px;
}
.brand:hover .name { color: var(--accent); }

.site-nav { display: flex; align-items: center; gap: 4px; }
.site-nav a {
    font-family: var(--display); font-weight: 500; font-size: .87rem;
    color: var(--text-2); text-decoration: none;
    padding: 8px 12px; border-radius: var(--radius-sm);
}
.site-nav a:hover { color: var(--text); background: var(--raised); }
.site-nav a[aria-current="page"] { color: var(--accent); background: var(--raised); }

.theme-toggle {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; margin-left: 6px;
    background: transparent; color: var(--text-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    cursor: pointer;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-firm); background: var(--raised); }
.theme-toggle svg { width: 17px; height: 17px; }
/* One button, two glyphs — show whichever theme the click will move you to. */
.theme-toggle .to-dark { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .to-dark { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .to-light { display: none; }
}
:root[data-theme="dark"] .theme-toggle .to-dark { display: block; }
:root[data-theme="dark"] .theme-toggle .to-light { display: none; }
:root[data-theme="light"] .theme-toggle .to-dark { display: none; }
:root[data-theme="light"] .theme-toggle .to-light { display: block; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
    .brand .name { font-size: .85rem; letter-spacing: .14em; }
    .brand img { width: 38px; }
    .nav-toggle {
        display: inline-grid; place-items: center;
        width: 38px; height: 38px; margin-left: auto;
        background: transparent; color: var(--text);
        border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
    }
    .brand { margin-right: 0; }
    .site-nav {
        display: none;
        position: absolute; top: 100%; left: 0; right: 0;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 10px 16px 16px;
        box-shadow: var(--shadow);
    }
    .site-nav.open { display: flex; }
    .site-nav a { padding: 12px 14px; font-size: 1rem; }
    .theme-toggle { margin: 8px 0 0; width: 100%; height: 42px; }
}

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

.hero { padding: clamp(48px, 7vw, 96px) 0 clamp(40px, 5vw, 72px); text-align: center; }
.hero img.mark { width: clamp(200px, 34vw, 330px); margin: 0 auto 26px; display: block; }
.hero h1 { margin-bottom: .35em; }
.hero .lede {
    max-width: 44ch; margin: 0 auto 32px;
    font-size: clamp(1.05rem, .98rem + .4vw, 1.24rem);
    color: var(--text-2);
}

.page-head { padding: clamp(44px, 6vw, 80px) 0 clamp(24px, 3vw, 40px); }
.page-head h1 { margin-bottom: .3em; }
.page-head .lede { max-width: 56ch; font-size: 1.12rem; color: var(--text-2); margin: 0; }

/* --- buttons ------------------------------------------------------------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: var(--display); font-weight: 600; font-size: .95rem;
    padding: 13px 26px; border-radius: var(--radius-sm);
    border: 1px solid transparent; cursor: pointer;
    text-decoration: none; line-height: 1.2;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hi); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border-firm); }
.btn-ghost:hover { background: var(--raised); color: var(--text); border-color: var(--accent); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* --- sections & cards ---------------------------------------------------- */

section.band { padding: clamp(44px, 6vw, 80px) 0; border-top: 1px solid var(--border); }
section.band.tint { background: var(--bg-2); }

.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 22px 20px;
}
.card h3 { margin-bottom: .3em; color: var(--text); }
.card p { margin-bottom: 0; font-size: .96rem; }
.card p + p { margin-top: .7em; }

/* --- app entries --------------------------------------------------------- */

.apps { display: grid; gap: 16px; }
.app {
    display: grid; gap: 4px 16px;
    grid-template-columns: 1fr auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--tan);
    border-radius: var(--radius);
    padding: 20px 22px;
}
.app h3 { grid-column: 1; margin: 0; color: var(--text); }
.app .status { grid-column: 2; grid-row: 1; align-self: start; }
.app p { grid-column: 1 / -1; margin: .3em 0 .7em; font-size: .97rem; }
.app .tags { grid-column: 1 / -1; margin: 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 7px; }
.app .tags li {
    font-family: var(--display); font-size: .7rem; font-weight: 500;
    letter-spacing: .04em; color: var(--text-3);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 3px 10px;
}
.app .working {
    grid-column: 1 / -1;
    font-size: .84rem; color: var(--text-3); margin: 10px 0 0; font-style: italic;
}

.status {
    display: inline-block;
    font-family: var(--display); font-size: .68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .09em;
    padding: 4px 11px; border-radius: 999px; white-space: nowrap;
    background: var(--raised); color: var(--text-2); border: 1px solid var(--border);
}
.status.beta   { background: var(--ok-bg);  color: var(--ok);  border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.status.live   { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.status.early  { background: var(--raised); color: var(--text-3); }

.empty-shelf {
    background: var(--raised);
    border: 1px dashed var(--border-firm);
    border-radius: var(--radius);
    padding: 26px 24px;
}
.empty-shelf p { margin: 0; max-width: 58ch; }

/* --- forms --------------------------------------------------------------- */

.form { max-width: 620px; }
.field { margin-bottom: 20px; }
.field > label {
    display: block; margin-bottom: 7px;
    font-family: var(--display); font-weight: 500; font-size: .89rem;
    color: var(--text);
}
.field .hint { display: block; font-family: var(--body); font-weight: 400; font-size: .82rem; color: var(--text-3); margin-top: 3px; }

input[type="text"], input[type="email"], select, textarea {
    width: 100%;
    font: inherit; font-size: 1rem;
    color: var(--text); background: var(--surface);
    border: 1px solid var(--border-firm); border-radius: var(--radius-sm);
    padding: 11px 13px;
}
textarea { min-height: 160px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--bad); }

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                      linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 19px) center, calc(100% - 13px) center;
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 38px;
}

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 20px; }
legend { font-family: var(--display); font-weight: 500; font-size: .89rem; color: var(--text); padding: 0 6px; }

.checks { display: grid; gap: 9px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: .95rem; color: var(--text-2); cursor: pointer; }
.check input { margin: 4px 0 0; accent-color: var(--accent); flex: none; }

/* The honeypot. Off-screen rather than display:none, because some autofillers
 * skip hidden fields entirely and then the trap never catches anything. */
.trap {
    position: absolute !important;
    left: -9999px; width: 1px; height: 1px; overflow: hidden;
}

.form-note { font-size: .87rem; color: var(--text-3); margin-top: 14px; }

.form-status { margin-top: 16px; padding: 13px 16px; border-radius: var(--radius-sm); font-size: .94rem; }
.form-status[hidden] { display: none; }
.form-status.ok  { background: var(--ok-bg);  color: var(--ok);  border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.form-status.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }

/* --- about --------------------------------------------------------------- */

/* Written as .prose p.signature rather than .signature because these sit inside
 * .prose, and ".prose p" would otherwise out-specify a lone class and drag the
 * signature back down to body size. */
.prose p.signature, .signature {
    font-family: var(--hand);
    font-size: 3rem; line-height: 1;
    color: var(--text);
    margin: 38px 0 4px;
}
.prose p.signature-role, .signature-role {
    font-size: .87rem; color: var(--text-3); margin: 0;
}

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

.site-foot {
    border-top: 1px solid var(--border);
    background: var(--bg-2);
    padding: 44px 0 52px;
    margin-top: clamp(48px, 7vw, 96px);
}
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 24px 40px; align-items: flex-start; }
.site-foot .col-brand { margin-right: auto; max-width: 30ch; }
.site-foot .col-brand p { font-size: .87rem; color: var(--text-3); margin: 10px 0 0; }
.site-foot nav { display: grid; gap: 7px; }
.site-foot nav strong {
    font-family: var(--display); font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .11em; color: var(--text-3);
}
.site-foot nav a { font-size: .9rem; color: var(--text-2); text-decoration: none; }
.site-foot nav a:hover { color: var(--accent); text-decoration: underline; }
.site-foot .legal {
    flex-basis: 100%; border-top: 1px solid var(--border); padding-top: 20px;
    font-size: .82rem; color: var(--text-3); margin: 6px 0 0;
}

/* --- utilities ----------------------------------------------------------- */
/* These exist because the Content-Security-Policy forbids inline style
 * attributes. A style="" on an element is silently dropped by the browser, so
 * every one-off tweak has to be a class or it simply doesn't happen. */

.centred { text-align: center; }
.measure-narrow { max-width: 56ch; }
.measure-sub { max-width: 58ch; margin-top: -.2em; }
.stack-sm { margin-top: 20px; }
.stack { margin-top: 26px; }
.stack-lg { margin-top: 34px; }
.push { margin-bottom: 26px; }
.btn-row.left { justify-content: flex-start; }
.aside { font-size: .92rem; color: var(--text-3); }
textarea.short { min-height: 110px; }

/* --- policy pages -------------------------------------------------------- */

.policy h2 { font-size: 1.18rem; margin: 2em 0 .5em; }
.policy h2:first-of-type { margin-top: 1em; }
.policy ul { padding-left: 1.15em; }
.policy li { margin-bottom: .4em; }
.policy .updated { font-size: .87rem; color: var(--text-3); }
