/* ============================================================
   Rubik — self-hosted. Loading it from Google's CDN sends every
   visitor's IP to Google, which needs consent under GDPR; serving
   it ourselves removes the third party entirely.
   Variable weight 300–900. Italic is not shipped (nothing uses it).
   ============================================================ */

@font-face {
    font-family: "Rubik";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("assets/fonts/rubik-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
        U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191,
        U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Rubik";
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url("assets/fonts/rubik-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
        U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
        U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ============================================================
   East Street Labs — design tokens
   Same system as the Inputto design language ("full mint",
   white text pills, chunky 3D buttons). Every color below is
   sampled directly from the shiawase artwork (assets/logo.png):
   khaki sky, mountain blue, blossom salmon, sun red, snow white.
   Only the colors differ from the system.
   ============================================================ */

:root {
    /* Canvas & text */
    --background: #EAE198;            /* khaki sky — app canvas, not white */
    --foreground: #26221A;            /* warm near-black, like the ink outlines */

    /* Surfaces */
    --card: #6DD1E1;                  /* mountain blue — the surface step up from canvas */
    --popover: #FFFFFF;               /* dropdown panels stay white */

    /* Primary (chunky 3D buttons) */
    --primary: #E33B28;               /* sun red */
    --primary-foreground: #FFFFFF;
    --primary-shadow: #A82517;        /* darkened sun red — depth edge */

    /* Secondary (white button, tinted depth edge) */
    --secondary: #FFFFFF;
    --secondary-foreground: #26221A;
    --secondary-shadow: #D4CB7E;      /* olive brushstroke */

    /* Accent — the blossom side of the artwork */
    --accent: #F4A48C;                /* blossom salmon */
    --accent-foreground: #7C351F;     /* deep rust — dark end of the blossom family */

    /* Low emphasis */
    --muted: #F4EFC6;                 /* lightened khaki */
    --muted-foreground: #6B6650;

    /* Destructive */
    --destructive: #C22315;           /* deeper red, distinct from the sun primary */
    --destructive-foreground: #FFFFFF;
    --destructive-shadow: #8C1408;

    /* Lines & focus */
    --border: #D4CB7E;                /* olive brushstroke — subtle on khaki */
    --input: #6DD1E1;                 /* mountain blue — slightly more visible */
    --ring: #4FB5C9;                  /* deeper mountain blue */

    /* Shape & type */
    --radius: 1.25rem;
    --font-sans: "Rubik", "Hiragino Sans", "Yu Gothic", "Apple SD Gothic Neo",
        "Malgun Gothic", "PingFang SC", "Microsoft YaHei", "Segoe UI",
        -apple-system, BlinkMacSystemFont, sans-serif;

    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.10), 0 2px 4px -2px rgb(0 0 0 / 0.10);
}

/* ============================================================
   Base
   ============================================================ */

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

/* The UA rule for [hidden] is display:none, but ANY author rule that sets
   display beats it (e.g. .chip further down). Restore it here so the hidden
   attribute keeps working everywhere. */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    /* Column flex + a growing <main> keeps the footer at the bottom of the
       viewport on short pages, and below the content on long ones. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--background);
    color: var(--foreground);
    font-family: var(--font-sans);
    line-height: 1.6;
}

main {
    flex: 1 0 auto;
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 1.5rem 1.5rem 4rem;
}

/* Text sits in white pills — the core legibility mechanism.
   Headings and paragraphs never lie directly on a pink surface. */
h1, h2, h3, h4, h5, h6, p {
    background: #FFFFFF;
    padding: 0.75rem;
    border-radius: var(--radius);
    width: fit-content;

    margin-inline: auto;
    /* No lone word left on the last line */
    text-wrap: pretty;
}

p {

    width: fit-content;
    /* fit-content can only hug text that fits on one line — past that it
       expands to the full container. Capping the measure keeps the pill
       narrow and the line breaks even. */
    max-width: 46ch;
}

.flex-column {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: center;
    gap: 1rem;
}

/* Headings are short enough that evening out the lines helps them.
   Paragraphs must NOT balance: balance shortens every line on purpose, while
   the pill keeps its full width, so the leftover shows up as empty white to
   the right of ranged-left text. Greedy wrapping fills each line instead, so
   the longest line ends up flush with the edge of the pill. */
h1, h2, h3, h4, h5, h6 {
    text-wrap: balance;
}

h1 { font-size: 2.25rem; line-height: 1.2; font-weight: 800; }
h2 { font-size: 1.75rem; line-height: 1.25; font-weight: 700; }
h3 { font-size: 1.25rem; line-height: 1.3; font-weight: 700; }

/* ============================================================
   Buttons — the signature chunky 3D press mechanic.
   A raw <button> gets the full primary look by default.
   ============================================================ */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    height: 3.25rem;
    padding: 0 1.75rem;
    background: var(--primary);
    color: var(--primary-foreground);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    border: 0;
    border-bottom: 4px solid var(--primary-shadow);
    border-radius: var(--radius);
    cursor: pointer;
    user-select: none;
    transition: transform 60ms ease, border-bottom-width 60ms ease;
    margin-inline: auto;
}

button:active,
.btn:active,
.btn.active {
    transform: translateY(4px);
    border-bottom-width: 0;
}

button:focus-visible,
.btn:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--ring);
    outline-offset: 2px;
}

/* Secondary — white fill, pink depth edge */
.btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-bottom-color: var(--secondary-shadow);
}

/* Outline — flat, bordered, no press effect */
.btn-outline {
    background: transparent;
    color: var(--foreground);
    border: 2px solid var(--border);
    font-weight: 500;
}

.btn-outline:active {
    transform: none;
}

/* Destructive — same mechanic, red */
.btn-destructive {
    background: var(--destructive);
    color: var(--destructive-foreground);
    border-bottom-color: var(--destructive-shadow);
}

.btn-full {
    width: 100%;
}

/* ============================================================
   Navigation — floating pink pill, centered, primary buttons
   ============================================================ */

.main-menu {
    position: sticky;
    top: 1rem;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    width: fit-content;
    margin: 1rem auto 1.5rem;
    padding: 0.75rem;
    background: var(--card);
    border-radius: 1rem;
    box-shadow: var(--shadow-md);
}

/* Brand — round logo badge + wordmark in a white pill */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    background: #FFFFFF;
    color: var(--foreground);
    text-decoration: none;
    font-weight: 800;
    font-size: 1.0625rem;
    white-space: nowrap;
    border-radius: var(--radius);
    padding: 0.375rem 1.125rem 0.375rem 0.375rem;
    margin-right: 0.25rem;
}

.brand .logo-wrap > img {
    display: block;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    object-fit: cover;
    object-position: 52% 50%;
}

/* Hover popup — full artwork in a white popover panel */
.logo-wrap {
    position: relative;
    display: inline-block;
}

.logo-popup {
    position: absolute;
    top: calc(100% + 0.875rem);
    left: -0.375rem;
    display: block;
    width: min(24rem, 80vw);
    padding: 0.5rem;
    background: var(--popover);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 12px 28px -6px rgb(0 0 0 / 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px) scale(0.97);
    transform-origin: top left;
    transition: opacity 150ms ease, transform 150ms ease, visibility 150ms;
    pointer-events: none;
    z-index: 20;
}

.logo-popup img {
    display: block;
    width: 100%;
    border-radius: calc(var(--radius) - 0.5rem);
}

.logo-wrap:hover .logo-popup,
.brand:focus-visible .logo-popup {
    opacity: 1;
    visibility: visible;
    transform: none;
}

/* ============================================================
   Cards — darker pink surface, big radius, shadow, no border
   ============================================================ */

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.2rem;
    margin-bottom: 1.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card-grid .card {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Paragraphs stretch to fill the card, so text blocks line up across a row */
/* The pill fills the card rather than shrink-wrapping the text. A shrink-wrapped
   box lands on some arbitrary width between the longest and shortest line, which
   is what made the ragged edge obvious. At full width it reads as a deliberate
   panel and the ragged edge reads as ordinary text. */
.card-grid .card p {
    align-self: stretch;
    width: auto;
    max-width: none;
    margin-inline: 0;
    padding: 0.9rem 1rem;
}

.card-grid .card .btn {
    margin-top: auto;
}

/* Icon chips — icons sit in small round accent circles */
.icon-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    background: var(--accent);
    color: var(--accent-foreground);
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 0 1rem;
}

/* The hero pill is centred on the page, but its text is ranged left like
   every other paragraph — .hero's text-align would otherwise centre it. */
.hero p {
    text-align: left;
}

.hero h1,
.hero p {
    margin-left: auto;
    margin-right: auto;
}

.lead {
    font-size: 1.125rem;
    max-width: 36rem;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ============================================================
   Forms — inside a card, white inputs, full-width submit
   ============================================================ */

.form-card {
    max-width: 28rem;
    margin-inline: auto;
}

.field {
    margin-bottom: 1rem;
}

.field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-bottom: 0.375rem;
}

input,
textarea {
    width: 100%;
    background: #FFFFFF !important;
    color: var(--foreground);
    font-family: inherit;
    font-size: 1rem;
    border: 1px solid var(--input);
    border-radius: calc(var(--radius) - 0.5rem);
    padding: 0.75rem 1rem;
    resize: vertical;
}

/* Checkboxes must escape the full-width rule above */
input[type="checkbox"] {
    width: auto;
    flex: none;
    margin: 0.2rem 0 0;
    padding: 0;
    accent-color: var(--primary);
}

.field-consent {
    margin-bottom: 1.25rem;
}

.consent {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.875rem;
    line-height: 1.45;
    cursor: pointer;
}

.consent-link,
.footer-link {
    display: inline-block;
    font-size: 0.8125rem;
    color: var(--foreground);
}

.consent-link {
    margin: 0.5rem 0 0 1.75rem;
}

/* Legal copy is long-form: ranged left and narrower than the pills elsewhere,
   because centred text is hard to read past a couple of lines. */
.legal p {
    text-align: left;
    text-wrap: pretty;
    max-width: 60ch;
    margin-inline: 0;
}

.legal h3 {
    margin-inline: 0;
    margin-top: 1.5rem;
}

.legal h3:first-child {
    margin-top: 0;
}

/* Success feedback — small inline accent chip */
.chip {
    /* block + fit-content, not inline-block: auto margins only centre
       block-level boxes, and fit-content keeps the pill hugging the text */
    display: block;
    width: fit-content;
    background: var(--primary);
    color: white;
    font-size: 0.875rem;
    margin-inline: auto;
    font-weight: 500;
    border-radius: 0.75rem;
    padding: 0.375rem 0.75rem;
    margin-top: 1rem;
}

/* Failure feedback — same chip, red */
.chip-error {
    background: var(--destructive);
    color: var(--destructive-foreground);
}

button[disabled] {
    opacity: 0.65;
    cursor: progress;
}

button[disabled]:active {
    transform: none;
    border-bottom-width: 4px;
}

/* Off-screen but still in the DOM — for the spam honeypot */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* ============================================================
   Footer
   ============================================================ */

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1.5rem 2rem;
}

footer p {
    font-size: 0.875rem;
    margin: 0;
}

/* ============================================================
   Responsive
   Breakpoints sit where the content stops fitting, not at device
   widths. Layout only — nothing here changes what the page does.
   ============================================================ */

/* Three cards side by side become too narrow to read long before the
   container runs out of room, so drop to two. */
@media (max-width: 56rem) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 34rem) {
    main {
        padding: 1rem 1rem 3rem;
    }

    /* The menu is sticky, so every pixel it occupies is a pixel of the
       viewport permanently spent. Shrinking the buttons takes it from
       three wrapped rows down to two. */
    .main-menu {
        top: 0.5rem;
        gap: 0.4rem;
        width: auto;
        max-width: calc(100% - 1rem);
        margin: 0.5rem auto 1rem;
        padding: 0.5rem;
    }

    .main-menu .btn {
        height: 2.5rem;
        padding: 0 0.7rem;
        font-size: 0.8125rem;
    }

    .brand {
        font-size: 0.9375rem;
        padding: 0.25rem 0.75rem 0.25rem 0.25rem;
        margin-right: 0;
    }

    .brand .logo-wrap > img {
        width: 2rem;
        height: 2rem;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.375rem; }
    h3 { font-size: 1.125rem; }

    .hero {
        padding: 1.25rem 0 0.5rem;
    }

    /* One column: two cards side by side leave ~140px each, which is
       narrower than the text needs. */
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-top: 1.5rem;
    }

    .card {
        padding: 1rem;
    }

    .card-grid .card p {
        padding: 0.75rem 0.8rem;
    }

    /* Full width, so the pair stacks evenly instead of leaving one
       button stranded on a row of its own. */
    .btn-row {
        width: 100%;
    }

    .btn-row .btn {
        flex: 1 1 100%;
    }

    footer {
        padding: 0 1rem 1.5rem;
    }
}
