/*
 * Marula Picture House - one hand-written stylesheet (no build step).
 * Dark is the default theme; [data-theme="light"] switches the tokens.
 * The CSP is style-src 'self', so every style lives here: no inline styles.
 */

:root {
    --bg: #120c10;
    --surface: #1d1419;
    --surface-2: #2a1d24;
    --text: #f4ece6;
    --muted: #c2b0a8;
    --border: #3d2a33;
    --accent: #f2b84b;
    --accent-ink: #1b1008;
    --amber: #ffcf70;
    --danger: #ff8a80;
    --ok: #8ee0a1;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .25);
    --radius: 12px;
    --radius-sm: 8px;
    --container: 1120px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-hero: Verdana, Geneva, sans-serif;
    color-scheme: dark;
}

:root[data-theme="light"] {
    --bg: #faf6f1;
    --surface: #ffffff;
    --surface-2: #f1e8df;
    --text: #22151b;
    --muted: #5e4a52;
    --border: #e2d4c8;
    --accent: #9b2c3a;
    --accent-ink: #ffffff;
    --amber: #8a5a00;
    --danger: #b3261e;
    --ok: #1d6b34;
    --shadow: 0 1px 2px rgba(34, 21, 27, .08), 0 8px 24px rgba(34, 21, 27, .08);
    color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 var(--font);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main { flex: 1 0 auto; }
main:focus { outline: none; }

img, svg { max-width: 100%; }

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

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }

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

code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; overflow-wrap: anywhere; }

.muted { color: var(--muted); }
.small { font-size: .875rem; }
.visually-hidden {
    position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }

.skip-link {
    position: absolute; left: 16px; top: -60px; z-index: 100;
    background: var(--accent); color: var(--accent-ink); padding: 8px 16px; border-radius: var(--radius-sm);
    font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container--narrow { max-width: 560px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 20px; border-radius: 999px;
    border: 2px solid transparent; font: 600 1rem/1.2 var(--font);
    text-decoration: none; cursor: pointer; transition: transform .15s, background .15s, border-color .15s;
    background: var(--surface-2); color: var(--text);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: none; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--small { min-height: 36px; padding: 6px 14px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }

.link-button {
    background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
    cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.text-link { font-weight: 600; }

/* ---------- Navbar ---------- */
.navbar {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}
.navbar__inner {
    max-width: var(--container); margin: 0 auto; padding: 10px 16px;
    display: flex; align-items: center; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; white-space: nowrap; }
.brand__logo { display: inline-flex; width: 38px; height: 38px; }
.brand__logo svg { width: 100%; height: 100%; }
.brand__logo--small { width: 32px; height: 32px; flex: none; }
.brand__name { font-size: 1.1rem; letter-spacing: .01em; }

.site-nav { margin-left: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 4px; }
.site-nav a, .site-nav .link-button {
    display: inline-block; padding: 8px 12px; border-radius: var(--radius-sm);
    color: var(--text); text-decoration: none; font-weight: 500;
}
.site-nav a:hover, .site-nav .link-button:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.site-nav .link-button { text-decoration: none; }

.navbar__tools { display: flex; align-items: center; gap: 8px; }

/* iPhone-style theme switch: pill track, sliding round knob. On = light mode. */
.theme-switch {
    display: inline-flex; align-items: center; justify-content: center;
    background: none; border: 0; padding: 6px; cursor: pointer; border-radius: 999px;
}
.theme-switch__track {
    position: relative; width: 51px; height: 31px; border-radius: 999px;
    background: #39393d; transition: background .25s;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.theme-switch__knob {
    position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
    background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3), 0 1px 1px rgba(0, 0, 0, .16);
    transition: transform .25s cubic-bezier(.3, .7, .4, 1);
}
.theme-switch[aria-checked="true"] .theme-switch__track { background: #34c759; }
.theme-switch[aria-checked="true"] .theme-switch__knob { transform: translateX(20px); }

.nav-toggle {
    display: none; width: 44px; height: 44px; padding: 10px; border-radius: var(--radius-sm);
    background: none; border: 1px solid var(--border); cursor: pointer;
    flex-direction: column; justify-content: center; gap: 5px;
}
.nav-toggle__bar { display: block; height: 2px; width: 100%; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 900px) {
    .navbar__tools { margin-left: auto; }
    .nav-toggle { display: inline-flex; }
    .site-nav {
        display: none; position: absolute; left: 0; right: 0; top: 100%;
        background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
        padding: 8px 16px 16px;
    }
    .site-nav.is-open { display: block; }
    .site-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
    .site-nav a, .site-nav .link-button { display: block; width: 100%; text-align: left; padding: 12px; }
    .site-nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); border-radius: var(--radius-sm); }
}
@media (max-width: 360px) {
    .brand__name { font-size: 1rem; }
    .brand__logo { width: 32px; height: 32px; }
    .navbar__inner { gap: 8px; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative; isolation: isolate; overflow: hidden;
    min-height: min(78vh, 680px); display: flex; align-items: center;
    color: #fff;
}
.hero__img {
    position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%;
    object-fit: cover; object-position: 50% 60%;
}
.hero::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(100deg, rgba(18, 8, 12, .9) 0%, rgba(18, 8, 12, .78) 45%, rgba(18, 8, 12, .55) 100%);
}
.hero__inner { width: 100%; max-width: var(--container); margin: 0 auto; padding: 64px 16px; }
.hero__inner > * { max-width: 640px; }
.hero__title {
    font-family: var(--font-hero); font-weight: 700;
    font-size: clamp(1.9rem, 4.6vw, 3.1rem); line-height: 1.12; letter-spacing: -.01em;
    margin-bottom: 16px; color: #fff;
}
.hero__lead { font-size: 1.15rem; color: #f1e6de; margin-bottom: 28px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; }
.hero .btn--primary { background: #f2b84b; color: #1b1008; }
.hero .btn--ghost { color: #fff; border-color: rgba(255, 255, 255, .7); }
.hero .btn--ghost:hover { background: rgba(255, 255, 255, .12); }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .8rem; font-weight: 700; color: var(--amber); margin-bottom: 12px; }
.hero .eyebrow { color: #ffcf70; }

/* ---------- Sections ---------- */
.section { padding: 64px 0; }
.section--tight { padding: 32px 0 64px; }
.section--alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section__title { font-size: 1.6rem; margin-bottom: 24px; }
.page-head { padding: 48px 0 8px; }
.page-title { font-family: var(--font-hero); font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.14; margin-bottom: 12px; }
.lead { font-size: 1.125rem; color: var(--muted); max-width: 60ch; }

.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.split { display: grid; gap: 32px; grid-template-columns: 1.3fr 1fr; align-items: start; }
@media (max-width: 800px) { .split { grid-template-columns: 1fr; } }

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
}
.section--alt .card { background: var(--bg); }
.card > :last-child { margin-bottom: 0; }

.note {
    background: var(--surface-2); border-left: 4px solid var(--amber); border-radius: var(--radius-sm);
    padding: 20px 24px; margin-top: 24px;
}
.split .note { margin-top: 0; }
.note > :last-child { margin-bottom: 0; }
.note .btn { margin-top: 4px; }

.steps { padding-left: 1.3em; margin: 0; }
.steps li { margin-bottom: 10px; }


.empty { text-align: center; padding: 48px 16px; border: 1px dashed var(--border); border-radius: var(--radius); }
.empty > :last-child { margin-bottom: 0; }

.error-page { text-align: center; padding-top: 32px; }
.error-page .lead { margin-left: auto; margin-right: auto; }

/* ---------- Forms ---------- */
.form { margin-top: 24px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; }
input[type="text"], input[type="email"], input[type="password"], textarea {
    width: 100%; min-height: 44px; padding: 10px 14px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    font: 1rem/1.4 var(--font);
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
input[aria-invalid="true"] { border-color: var(--danger); }
.field__error { color: var(--danger); font-size: .9rem; margin: 6px 0 0; }
.alert {
    background: color-mix(in srgb, var(--danger) 14%, transparent);
    border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 16px;
}
.alert p { margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: auto; }
.site-footer__inner {
    max-width: var(--container); margin: 0 auto; padding: 40px 16px 120px;
    display: grid; gap: 24px; grid-template-columns: 2fr 1.4fr 1.6fr;
}
.site-footer__brand { display: flex; gap: 12px; align-items: flex-start; }
.site-footer__brand p { margin: 0 0 6px; }
.site-footer__name { font-weight: 700; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 8px 18px; align-content: flex-start; }
.site-footer__links a { color: var(--text); }
.site-footer__legal p { margin: 0 0 6px; }
.site-footer__legal a { color: var(--text); }
@media (max-width: 800px) { .site-footer__inner { grid-template-columns: 1fr; } }

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

/* ---------- Home: the loop ---------- */
.loop { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; grid-template-columns: 1fr; counter-reset: loop; }
/* Three steps: one column on phones, three side by side from tablets up. */
@media (min-width: 700px) { .loop { grid-template-columns: repeat(3, 1fr); } }
.loop li { counter-increment: loop; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.section--alt .loop li { background: var(--bg); }
.loop li::before {
    content: counter(loop); display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 50%; margin-bottom: 10px;
    background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.loop h3 { font-size: 1.05rem; margin-bottom: 6px; }
.loop p { margin: 0; color: var(--muted); }


/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; border: 1px solid currentColor; color: var(--amber); }

/* ---------- Home: films ---------- */
.film { display: flex; flex-direction: column; }
.film__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.film__title { font-size: 1.2rem; margin: 0 0 4px; }
.times { list-style: none; margin: auto 0 0; padding: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.time {
    display: inline-flex; flex-direction: column; padding: 6px 12px; border-radius: var(--radius-sm);
    background: var(--surface-2); border: 1px solid var(--border); line-height: 1.3;
}
.time__at { font-weight: 700; font-variant-numeric: tabular-nums; }
.time__seats { font-size: .8rem; color: var(--muted); }
.time--sold-out { opacity: .75; }
.time--sold-out .time__at { text-decoration: line-through; }
.time--sold-out .time__seats { color: var(--danger); font-weight: 600; }
:root[data-theme="light"] .time--sold-out .time__seats { color: #b3261e; }

/* ---------- Simulator ---------- */
.sim { display: grid; gap: 32px; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); align-items: start; }
@media (max-width: 860px) { .sim { grid-template-columns: 1fr; } .sim__phone-wrap { justify-self: center; width: 100%; max-width: 360px; } }
.phone {
    background: #0b0709; color: #f4ece6; border-radius: 36px; padding: 18px 16px 22px;
    border: 2px solid #3d2a33; box-shadow: 0 20px 50px rgba(0, 0, 0, .45), inset 0 0 0 4px #1d1419;
}
:root[data-theme="light"] .phone { border-color: #c9b6a8; box-shadow: 0 16px 40px rgba(34, 21, 27, .25), inset 0 0 0 4px #2a1d24; }
.phone__speaker { width: 64px; height: 6px; border-radius: 999px; background: #2a1d24; margin: 0 auto 14px; }
.phone__status { display: flex; justify-content: space-between; font-size: .75rem; color: #c2b0a8; padding: 0 6px 6px; }
.phone__screen {
    background: #dfe8d2; color: #10200f; border-radius: 12px; padding: 12px 14px;
    min-height: 220px; font: 15px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
    white-space: pre-wrap; overflow-wrap: anywhere; border: 2px solid #1d1419;
}
.phone__screen--idle { color: #3c4f39; }
.phone__screen--ended { background: #e6dccd; }
.phone__screen:focus-visible { outline-offset: 3px; }
.phone__form { margin: 12px 0 0; display: flex; gap: 8px; }
.phone__input {
    flex: 1; min-width: 0; min-height: 44px; padding: 8px 12px; border-radius: 10px;
    border: 1px solid #3d2a33; background: #1d1419; color: #f4ece6;
    font: 1.05rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.phone__input:focus { border-color: #f2b84b; outline: 2px solid #f2b84b; outline-offset: 0; }
.phone__input::placeholder { color: #a8968e; }
.phone__actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.phone__btn {
    min-height: 44px; border-radius: 999px; border: 0; cursor: pointer;
    font: 700 1rem/1 var(--font);
}
.phone__btn--send { background: #34c759; color: #06240f; }
.phone__btn--cancel { background: #ff5b4f; color: #2b0705; }
.phone__btn[disabled] { opacity: .5; cursor: not-allowed; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.key {
    min-height: 48px; border-radius: 14px; border: 1px solid #3d2a33; background: #1d1419; color: #f4ece6;
    font: 600 1.25rem/1 var(--font); cursor: pointer; transition: background .12s;
}
.key:hover { background: #2a1d24; }
.key:active { background: #3d2a33; }
.phone__hint { color: #c2b0a8; font-size: .8rem; margin: 10px 2px 0; min-height: 1.2em; }
.phone__hint--error { color: #ffb4a8; }

.sim__panel > .card + .card { margin-top: 20px; }
.field--inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.field--inline label { margin: 0; }
.field--inline input { flex: 1 1 180px; width: auto; }
input[type="tel"] {
    min-height: 44px; padding: 10px 14px; background: var(--surface); color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius-sm); font: 1rem/1.4 var(--font);
}
input[type="tel"]:focus { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 0; }
.status-line { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0; font-size: .9rem; }
/* Each label stays beside its value when the line wraps. */
.status-line > div { display: flex; gap: 8px; min-width: 0; }
.status-line dt { color: var(--muted); }
.status-line dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.log {
    list-style: none; margin: 0; padding: 0; max-height: 360px; overflow: auto;
    font: .85rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.log li { padding: 8px 0; border-bottom: 1px solid var(--border); white-space: pre-wrap; overflow-wrap: anywhere; }
.log li:last-child { border-bottom: 0; }
.log__dir { font-weight: 700; color: var(--accent); }
.log__time { color: var(--muted); }

/* ---------- API docs ---------- */
/* The column stays in line with the page title: cap the text, not the container. */
.prose > * { max-width: 820px; }
.prose h2 { margin-top: 40px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: 6px; }
pre {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 14px 16px; overflow-x: auto; font: .85rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}
pre code { background: none; padding: 0; overflow-wrap: normal; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 1em; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
/* A field name is one token: never break it (the table scrolls sideways if it must). */
td:first-child code { white-space: nowrap; }

/* Narrow phones: the brand name wraps onto two lines so the theme switch and menu button stay on screen. */
@media (max-width: 400px) {
    .navbar__inner { gap: 8px; padding-left: 12px; padding-right: 12px; }
    .brand { min-width: 0; gap: 8px; white-space: normal; }
    .brand__logo { width: 32px; height: 32px; flex: none; }
    .brand__name { font-size: 1rem; line-height: 1.15; }
    .navbar__tools { gap: 4px; flex: none; }
    .theme-switch { padding: 4px; }
}

/* Keeps a short code such as a booking reference on one line. */
.nowrap { white-space: nowrap; }
