/* Theme tokens read from the Mosaic final PSB files (1080 px artboards). Swap values here to retheme. */
@font-face { font-family: "Filson Pro"; font-style: normal; font-weight: 400 600; font-display: swap; src: url("fonts/filson-pro-medium.woff2") format("woff2"); }
@font-face { font-family: "Filson Pro"; font-style: normal; font-weight: 700 900; font-display: swap; src: url("fonts/filson-pro-heavy.woff2") format("woff2"); }

:root {
    --font-sans: "Filson Pro", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --color-bg: #f2ebdb;
    --color-surface: #faf6ec;
    --color-text: #462916;
    --color-muted: #7b6250;
    --color-border: #dccfb6;
    --color-line: #462916;
    --color-primary: #462916;
    --color-primary-text: #ffffff;
    --color-accent: #f56e66;
    --color-accent-text: #ffffff;
    --color-soft: #e8dfc9;
    --color-focus: #d8483f;
    --color-error: #b3261e;
    --color-success: #2f6b3a;
    --radius: 14px;
    --radius-sm: 10px;
    --radius-field: 1.125rem;
    --tap: 3.25rem;
    --maxw: 40rem;
}
.brand-timothys { --color-accent: #29348f; }
.page-welcome, .page-intro { --maxw: 26rem; }
.page-home { --maxw: 72rem; }
@media (min-width: 768px) {
    :root { --maxw: 44rem; }
    .page-welcome, .page-intro { --maxw: 30rem; }
}

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

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

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
}

a { color: inherit; }
img { max-width: 100%; }

:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }

.muted { color: var(--color-muted); }

/* Header / footer */
.site-header { padding-top: env(safe-area-inset-top); }
.site-header__inner {
    position: relative;
    max-width: var(--maxw);
    margin: 0 auto;
    padding-block: 1.25rem .5rem;
    padding-inline: max(1rem, env(safe-area-inset-left));
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.5rem;
}
.site-logo { display: block; height: 2.125rem; width: auto; }
.brand-timothys .site-logo { height: 2.625rem; }
.lang-switch {
    position: absolute;
    right: max(1rem, env(safe-area-inset-right));
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: .125rem .75rem;
    border: 1.5px solid var(--color-line);
    border-radius: 999px;
    font-size: .8125rem;
    font-weight: 700;
    text-decoration: none;
}
.lang-switch:hover { background: var(--color-primary); color: var(--color-primary-text); }

.site-main {
    flex: 1;
    width: 100%;
    min-width: 0;
    max-width: var(--maxw);
    margin: 0 auto;
    padding-block: .5rem 1.5rem;
    padding-inline: max(1rem, env(safe-area-inset-left));
}
.site-footer { padding: 1rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); text-align: center; }
.roundel { display: inline-block; width: 2.75rem; height: 2.75rem; }

@media (min-width: 768px) {
    body { font-size: 1.125rem; }
    .site-header__inner { padding-block: 2rem .75rem; }
    .site-logo { height: 2.5rem; }
    .brand-timothys .site-logo { height: 3rem; }
    .site-main { padding-block: .75rem 2rem; padding-inline: 1.5rem; }
}

/* Masthead: survey title + brand band */
.masthead { margin: 0 0 1.25rem; text-align: center; }
.masthead__title { margin: 0 0 .625rem; font-size: 1.25rem; line-height: 1.25; font-weight: 800; }
.band {
    margin: 0;
    padding: .5rem 1rem;
    background: var(--color-accent);
    color: var(--color-accent-text);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.35;
    text-align: center;
}
@media (min-width: 768px) {
    .masthead__title { font-size: 1.5rem; }
    .band { font-size: .8125rem; }
    .question__label { font-size: 1.75rem; }
    .input, .option, .btn { min-height: 3.5rem; }
}

/* Typography */
.page-title { font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; margin: 0 0 .5rem; font-weight: 800; }
.lead { color: var(--color-muted); margin: 0; }
.section-title { font-size: 1.125rem; margin: 2rem 0 .75rem; font-weight: 800; }
.intro { text-align: center; }
.eyebrow {
    display: block;
    margin: 0 0 .5rem;
    font-size: .8125rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--color-muted);
}
.tag {
    display: inline-block;
    padding: .0625rem .5rem;
    border-radius: 999px;
    background: var(--color-soft);
    color: var(--color-muted);
    font-size: .75rem;
    font-weight: 700;
    vertical-align: middle;
}

/* Welcome (language choice) */
.welcome { text-align: center; }
.welcome__hero { display: block; width: 100%; height: auto; aspect-ratio: 1080 / 1216; object-fit: cover; object-position: top; border-radius: var(--radius); }
.welcome__title { margin: 1.5rem 0 1rem; font-size: 1.375rem; font-weight: 800; }
.welcome__langs { display: flex; gap: .75rem; justify-content: center; }
.welcome__langs .btn { flex: 1 1 0; max-width: 12rem; }

/* Survey landing page (one per survey) */
.intro__media {
    position: relative;
    width: 100%;
    min-width: 0;
    aspect-ratio: 1080 / 1216;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--color-soft);
}
.intro__media img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: top; opacity: 0; transition: opacity .8s ease; }
.intro__media img.is-active { opacity: 1; }
.intro__title { margin: 1.25rem 0 .75rem; font-size: 1.5rem; line-height: 1.2; font-weight: 800; }
.intro .band { font-size: .8125rem; }
.intro__actions { margin: 1.5rem 0 0; }
.intro__actions .btn { width: 100%; max-width: 20rem; }

/* Landing and welcome pages: the hero bleeds to the screen edges and carries the logo itself */
.page-intro .site-header, .page-welcome .site-header { position: absolute; inset: 0 0 auto 0; z-index: 2; pointer-events: none; }
.page-intro .site-header__inner, .page-welcome .site-header__inner { min-height: 3.5rem; padding-block: .75rem 0; }
.page-intro .site-logo { display: none; }
.page-intro .lang-switch { pointer-events: auto; background: var(--color-bg); border-color: var(--color-bg); }
.page-intro .site-main, .page-welcome .site-main { padding-top: 0; }
.page-intro .intro__media, .page-welcome .welcome__hero { width: auto; margin-inline: calc(-1 * max(1rem, env(safe-area-inset-left))); border-radius: 0; }
.page-welcome .welcome__hero { width: calc(100% + 2 * max(1rem, env(safe-area-inset-left))); max-width: none; }
.page-intro .band { margin-inline: calc(-1 * max(1rem, env(safe-area-inset-left))); }
@media (min-width: 768px) {
    .page-intro .site-main, .page-welcome .site-main { padding-top: 2rem; }
    .page-intro .intro__media, .page-welcome .welcome__hero { width: 100%; margin-inline: 0; border-radius: var(--radius) var(--radius) 0 0; }
    .page-welcome .welcome__hero { max-width: 100%; }
    .page-intro .band { margin-inline: 0; }
    .page-intro .lang-switch { top: 3.5rem; right: 2.25rem; transform: none; }
}

/* Home: survey cards */
.survey-list { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.survey-list > li { min-width: 0; }
@media (min-width: 768px) { .survey-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .survey-list { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.survey-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    height: 100%;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 1px 0 rgba(71, 42, 23, .08);
}
.survey-card:hover .survey-card__title { text-decoration: underline; }
.survey-card__media { position: relative; width: 100%; min-width: 0; aspect-ratio: 1080 / 1216; overflow: hidden; background: var(--color-soft); }
.survey-card__media img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: top; opacity: 0; transition: opacity .8s ease; }
.survey-card__media img.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .survey-card__media img, .intro__media img { transition: none; } }
.survey-card__title { display: flex; flex: 1; align-items: center; justify-content: center; padding: 1rem 1rem .75rem; font-size: 1.125rem; font-weight: 800; line-height: 1.25; text-align: center; }
.survey-card .band { font-size: .6875rem; }
.survey-card__status { padding: .875rem 1rem 1.125rem; font-size: .875rem; font-weight: 700; text-align: center; }
.survey-card__status::after { content: " →"; }
.survey-card.is-done .survey-card__status { color: var(--color-success); }
.survey-card.is-done .survey-card__status::after { content: " ✓"; }

.thanks-back { margin-top: 2rem; text-align: center; }

/* Question screen */
.progress { height: 4px; margin: 0 0 1.5rem; background: var(--color-soft); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--color-accent); border-radius: 999px; transition: width .3s ease; }
.notice { margin: 0 0 1rem; padding: .75rem 1rem; background: var(--color-soft); border-radius: var(--radius-sm); }

.question fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
.question legend { display: block; width: 100%; padding: 0; }
.question__label { margin: 0 0 .875rem; font-size: clamp(1.25rem, 4.5vw, 1.625rem); line-height: 1.3; font-weight: 500; }
.question__label label { cursor: default; }
.help { margin: -.375rem 0 1rem; color: var(--color-muted); }

.input {
    display: block;
    width: 100%;
    min-height: var(--tap);
    padding: .75rem 1.25rem;
    font: inherit;
    font-size: max(16px, 1rem);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1.5px solid var(--color-line);
    border-radius: var(--radius-field);
    appearance: none;
}
textarea.input { min-height: 9rem; resize: vertical; }
.input:focus { outline: 3px solid color-mix(in srgb, var(--color-focus) 35%, transparent); border-color: var(--color-focus); }
.input[aria-invalid="true"] { border-color: var(--color-error); }

.fields { display: grid; gap: 1rem; }
.field { display: grid; gap: .375rem; }
.field__label { font-weight: 500; font-size: .9375rem; padding-left: .25rem; }

.options { display: grid; gap: .625rem; }
.option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    min-height: var(--tap);
    padding: .625rem 1rem;
    background: var(--color-surface);
    border: 1.5px solid var(--color-line);
    border-radius: var(--radius-field);
    text-align: center;
    cursor: pointer;
    user-select: none;
}
.option:hover { background: var(--color-soft); }
.option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.option:has(input:checked) { background: var(--color-primary); color: var(--color-primary-text); }
.option:has(input:focus-visible) { outline: 3px solid var(--color-focus); outline-offset: 2px; }
.option__label { font-weight: 500; }
.options--multi .option:has(input:checked) .option__label::before { content: "✓ "; }

.options--yesno { grid-template-columns: 1fr 1fr; }
.options--rating { grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.options--rating .option { padding: .625rem 0; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.options--choice, .options--multi { grid-template-columns: 1fr 1fr; }
.options--choice .option:last-child:nth-child(odd), .options--multi .option:last-child:nth-child(odd) { grid-column: 1 / -1; }

.error { margin: .625rem 0 0; color: var(--color-error); font-weight: 700; }

.privacy-note { margin: 1.5rem 0 0; font-size: .8125rem; color: var(--color-muted); text-align: center; }

.actions { display: flex; flex-direction: row-reverse; justify-content: space-between; gap: .75rem; margin-top: 1.75rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
    padding: .75rem 1.5rem;
    font: inherit;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    border: 1.5px solid transparent;
    border-radius: var(--radius-field);
    cursor: pointer;
}
.btn--primary { flex: 0 1 14rem; background: var(--color-primary); color: var(--color-primary-text); border-color: var(--color-primary); }
.btn--primary:hover { opacity: .9; }
.btn--ghost { background: transparent; color: var(--color-text); border-color: var(--color-line); }
.btn--ghost:hover { background: var(--color-soft); }
.btn--sm { min-height: 2.25rem; padding: .375rem .875rem; font-size: .875rem; flex: none; }
.btn--danger { background: transparent; color: var(--color-error); border-color: currentColor; }
.btn[disabled], .is-submitting .btn { opacity: .6; cursor: progress; pointer-events: none; }

/* Phones held sideways: keep the question above the fold */
@media (max-height: 520px) and (orientation: landscape) {
    .site-header__inner { min-height: 0; padding-block: .5rem .25rem; }
    .site-logo, .brand-timothys .site-logo { height: 1.5rem; }
    .page-survey .masthead { margin-bottom: .75rem; }
    .page-survey .masthead__title { margin-bottom: .25rem; font-size: 1rem; }
    .page-survey .band { display: none; }
    .progress { margin-bottom: .75rem; }
    .question__label { font-size: 1.125rem; }
    .actions { margin-top: 1rem; }
    .site-footer { padding-block: .5rem; }
    .roundel { width: 2rem; height: 2rem; }
    .page-intro, .page-welcome { --maxw: 44rem; }
    .intro, .welcome { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: center; }
    .page-intro .site-main, .page-welcome .site-main { padding-top: .75rem; }
    .page-intro .intro__media, .page-welcome .welcome__hero { width: auto; height: 76vh; max-width: 100%; margin-inline: 0; border-radius: var(--radius); justify-self: center; grid-row: span 3; }
    .page-intro .band { margin-inline: 0; }
    .page-intro .lang-switch { top: .5rem; right: 1rem; transform: none; border-color: var(--color-line); }
    .page-intro .intro { padding-top: 2.5rem; }
    .intro__title, .welcome__title { margin-top: 0; font-size: 1.25rem; }
    .intro__actions { margin-top: 1rem; }
}
