/* Tokens and fonts copied from munkai-website (app/globals.css, next/font build output)
   so the canvas reads as part of munkai.ai. Self-hosted: no visitor IP goes to Google (GDPR). */
@font-face {
    font-family: 'Inter';
    src: url('/fonts/inter-latin.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('/fonts/playfair-latin.woff2') format('woff2');
    font-weight: 400 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Playfair Display';
    src: url('/fonts/playfair-latin-italic.woff2') format('woff2');
    font-weight: 400 900;
    font-style: italic;
    font-display: swap;
}
/* Playfair's "&" is ornate; the website swaps in Inter's plain one via unicode-range. */
@font-face {
    font-family: 'Inter Ampersand';
    src: url('/fonts/inter-ampersand.woff2') format('woff2');
    unicode-range: U+0026;
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Inter Ampersand';
    src: url('/fonts/inter-ampersand-italic.woff2') format('woff2');
    unicode-range: U+0026;
    font-weight: 100 900;
    font-style: italic;
    font-display: swap;
}

:root {
    --background: #EEF0F3;
    --background-alt: #E4E7EC;
    --surface: #fbfbfc;
    --text: #1a2332;
    --text-secondary: #5a6a7a;
    --accent: #3563d4;
    --accent-hover: #2854b3;
    --border: rgba(26, 35, 50, 0.08);
    --border-field: rgba(26, 35, 50, 0.16);
    --border-strong: rgba(26, 35, 50, 0.28);
    --error: #b91c1c;
    --serif: 'Inter Ampersand', 'Playfair Display', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --radius-option: 10px;
    --radius-control: 6px;
    --shadow-focus: 0 0 0 3px rgba(53, 99, 212, 0.16);
    --ease: cubic-bezier(0.25, 0, 0.15, 1);
    color-scheme: light;
}

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

html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; }
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: var(--sans);
    line-height: 1.6;
    background: var(--background);
    color: var(--text);
}
body > main { flex: 1 0 auto; }

a { color: inherit; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: text-decoration-color 0.2s var(--ease); }
a:hover { text-decoration-color: currentColor; }

.container { width: min(100% - 32px, 1040px); margin-inline: auto; }

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 10;
    padding: 8px 14px;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
    background: var(--text);
    border-radius: var(--radius-control);
    text-decoration: none;
    transition: top 0.2s var(--ease);
}
.skip-link:focus { top: 12px; }
#case-form:focus { outline: none; }

/* --- Top bar --- */
.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.logo { display: block; flex: none; }
.logo img { display: block; height: 22px; width: auto; }
.event {
    min-width: 0;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    border: 1px solid var(--border-field);
    border-radius: var(--radius-control);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- Hero --- */
.hero { max-width: 760px; padding: clamp(48px, 9vw, 112px) 0 clamp(40px, 6vw, 72px); }

.section-label {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent);
}

h1, h2 { margin: 0; font-weight: 400; }
h1 {
    font-family: var(--serif);
    font-size: clamp(2.5rem, 5.5vw, 4.5rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
em { font-family: var(--serif); font-style: italic; color: var(--accent); }

.lede {
    margin: 1.5rem 0 0;
    max-width: 58ch;
    font-size: clamp(1.05rem, 1.4vw, 1.2rem);
    line-height: 1.75;
    color: var(--text-secondary);
    text-wrap: pretty;
}

/* --- Sections: heading left, fields right on wide screens --- */
.section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 40px 0 44px;
    border-top: 1px solid var(--border-strong);
}
.section-head { display: grid; gap: 6px; align-content: start; }
.section-num {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.section-head h2 {
    font-family: var(--serif);
    font-size: clamp(1.6rem, 2.6vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}
.help { margin: 4px 0 0; max-width: 34ch; font-size: 0.9rem; color: var(--text-secondary); text-wrap: pretty; }

.section-body { display: grid; gap: 22px; min-width: 0; }

@media (min-width: 860px) {
    .section { grid-template-columns: 280px minmax(0, 1fr); gap: 64px; padding: 56px 0 64px; }
    .section-head { position: sticky; top: 32px; }
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px 16px; }
.span-2 { grid-column: 1 / -1; }

/* --- Fields --- */
.field { min-width: 0; }

label, .label { display: block; margin-bottom: 8px; font-size: 0.875rem; font-weight: 500; }
.req { color: var(--accent); }

input[type="text"], input[type="email"], input[type="tel"], textarea {
    display: block;
    width: 100%;
    padding: 0.9rem 1rem;
    font: inherit;
    font-size: 1rem; /* ≥16px stops iOS from zooming on focus */
    line-height: 1.5;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-field);
    border-radius: var(--radius-control);
    transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
input:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, textarea:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: var(--shadow-focus); }
/* Height follows the content (app.js autosize); no manual resize handle. */
textarea { min-height: 120px; resize: none; overflow: hidden; }
input::placeholder, textarea::placeholder { color: var(--text-secondary); opacity: 0.75; }

input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--error); }
input[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.14); }
.field-error { margin: 6px 0 0; font-size: 0.82rem; font-weight: 500; color: var(--error); }

/* --- Chips: the native input covers the label invisibly, so the label is the control --- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin: 0;
    padding: 9px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-field);
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease), transform 0.15s var(--ease);
}
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.chip::before {
    content: '';
    width: 0;
    height: 10px;
    border: solid transparent;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-2px);
    transition: width 0.2s var(--ease), margin 0.2s var(--ease);
}
.chip:hover { border-color: var(--border-strong); }
.chip:active { transform: scale(0.97); }
.chip:has(input:checked) { color: #fff; background: var(--accent); border-color: var(--accent); }
.chip:has(input:checked)::before { width: 5px; margin-right: 10px; border-color: #fff; }
.chip:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Route options --- */
.routes { grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .routes { grid-template-columns: 1fr 1fr; } }
.route {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    margin: 0;
    padding: 16px;
    font-weight: 400;
    background: var(--surface);
    border: 1px solid var(--border-field);
    border-radius: var(--radius-option);
    cursor: pointer;
    transition: border-color 0.2s var(--ease), background 0.2s var(--ease), box-shadow 0.2s var(--ease), transform 0.15s var(--ease);
}
.route:hover { border-color: var(--border-strong); }
.route:active { transform: scale(0.99); }
.route:has(input:checked) { border-color: var(--accent); background: #fff; box-shadow: inset 0 0 0 1px var(--accent); }
.route strong { display: block; font-size: 0.95rem; font-weight: 600; line-height: 1.35; }
.route small { display: block; margin-top: 4px; font-size: 0.85rem; line-height: 1.5; color: var(--text-secondary); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 2px 0 0; flex: none; }

.honeypot { display: none; }

/* --- Submit --- */
.section-submit .section-body { gap: 0; }
.consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    margin: 0;
    font-weight: 400;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-secondary);
}
.consent.is-invalid { color: var(--error); }
.consent.is-invalid input { outline: 2px solid var(--error); outline-offset: 2px; }

.btn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 1.5rem;
    padding: 1.15rem 2.6rem;
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--background);
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-control);
    cursor: pointer;
    transition: color 0.35s var(--ease), border-color 0.35s var(--ease), transform 0.15s var(--ease);
}
/* The website's left-to-right fill on hover. */
.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: var(--accent-hover);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.4s var(--ease);
}
.btn:hover::after { transform: scaleX(1); }
.btn:hover { border-color: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.btn-outline { width: auto; color: var(--text); background: transparent; border-color: var(--text); }
.btn-outline::after { background: var(--text); }
.btn-outline:hover { color: var(--background); border-color: var(--text); }
@media (min-width: 860px) { .section-submit .btn { width: auto; } }

.error { margin: 1rem 0 0; font-size: 0.92rem; font-weight: 500; color: var(--error); }
.fine { margin: 1rem 0 0; font-size: 0.85rem; color: var(--text-secondary); }

/* --- Sent state --- */
.sent { max-width: 760px; padding: clamp(48px, 9vw, 112px) 0; }
.sent:focus { outline: none; }
.sent h2 { font-family: var(--serif); font-size: clamp(2.2rem, 4.5vw, 3.6rem); line-height: 1.1; letter-spacing: -0.02em; }
.sent .btn { margin-top: 2rem; }

/* --- Footer --- */
.footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    padding: 28px 0 36px;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

@media (max-width: 600px) {
    .grid-2 { grid-template-columns: 1fr; }
    .section { padding: 32px 0 36px; }
}
