/* Tiffin TV website. Brand colours: branding/README.md. Baloo 2 (SIL Open Font License) is
   self-hosted as a Latin subset; body text uses the system font so pages render at once. */
@font-face {
  font-family: "Baloo 2";
  src: url("/fonts/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  --night: #141A30;
  --ink: #0B0E14;
  --saffron: #FFB13B;
  --coral: #FF6B4A;
  --rose: #E8436F;
  --steel: #E6EAF2;
  --brand-grad: linear-gradient(120deg, var(--saffron), var(--coral) 55%, var(--rose));

  --bg: #FBF8F3;
  --surface: #FFFFFF;
  --surface-2: #F3EEE6;
  --text: #141A30;
  --muted: #4E566E;
  --border: #E7E0D4;
  --accent: #FFB13B;
  --accent-text: #0B0E14;
  --link: #A8400C;
  --ok: #157A46;
  --ok-bg: #E6F5EC;
  --warn: #8A5A00;
  --warn-bg: #FFF4DC;
  --error: #B42318;
  --error-bg: #FDECEA;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgb(20 26 48 / 6%), 0 8px 28px rgb(20 26 48 / 8%);
  --head: "Baloo 2", system-ui, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1180px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0B0E14; --surface: #141A30; --surface-2: #1C2340; --text: #F3F5FA; --muted: #A9B1C6;
    --border: #262E4D; --link: #FFB13B; --ok: #5FD39A; --ok-bg: #12261C; --warn: #F5C46B; --warn-bg: #2A2210;
    --error: #FF8A80; --error-bg: #2C1513; --shadow: 0 1px 0 rgb(255 255 255 / 4%) inset; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0B0E14; --surface: #141A30; --surface-2: #1C2340; --text: #F3F5FA; --muted: #A9B1C6;
  --border: #262E4D; --link: #FFB13B; --ok: #5FD39A; --ok-bg: #12261C; --warn: #F5C46B; --warn-bg: #2A2210;
  --error: #FF8A80; --error-bg: #2C1513; --shadow: 0 1px 0 rgb(255 255 255 / 4%) inset; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 80px; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--body); overflow-x: clip; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--head); line-height: 1.12; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 1.9rem; margin: 0 0 0.6rem; font-weight: 800; }
h2 { font-size: 1.35rem; margin: 0 0 0.75rem; font-weight: 700; }
h3 { font-size: 1.15rem; margin: 0 0 0.4rem; font-weight: 700; }
p { margin: 0 0 0.9rem; text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-text); padding: 10px 14px; border-radius: 10px; font-weight: 700; }
.skip:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: none; margin: 0; padding: 12px max(16px, calc((100vw - var(--wrap)) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.brand { font-family: var(--head); font-weight: 800; font-size: 1.3rem; color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 9px; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; display: block; }
.site-header nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.site-header nav a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 10px 10px; border-radius: 10px; transition: color .2s, background-color .2s; }
.site-header nav a:hover, .site-header nav a[aria-current] { color: var(--text); background: var(--surface-2); }
.site-header nav a.nav-cta { background: var(--accent); color: var(--accent-text); padding: 10px 14px; margin-left: 4px; }
.site-header nav a.nav-cta:hover { filter: brightness(1.05); }
.site-header nav .wide-only { display: none; }
@media (min-width: 760px) { .site-header nav .wide-only { display: inline-block; } }
@media (max-width: 479px) {
  .site-header nav { flex-wrap: nowrap; }
  .site-header nav a { padding: 10px 7px; font-size: 0.92rem; }
  .site-header nav a.nav-cta { padding: 10px 12px; }
  .brand > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

main { max-width: var(--wrap); margin: 0 auto; padding: 8px 16px 56px; }
.page-narrow { max-width: 560px; }

/* Footer */
footer { max-width: var(--wrap); margin: 0 auto; padding: 28px 16px 44px; color: var(--muted); font-size: 0.9rem; display: flex; gap: 8px 20px; flex-wrap: wrap; align-items: center; border-top: 1px solid var(--border); }
footer a { color: var(--muted); padding: 6px 0; }
footer a:hover { color: var(--text); }
footer .foot-brand { display: flex; align-items: center; gap: 8px; margin-right: auto; color: var(--text); font-family: var(--head); font-weight: 700; }
footer .foot-brand img { width: 24px; height: 24px; border-radius: 6px; }
footer .foot-note { flex-basis: 100%; font-size: 0.82rem; margin: 6px 0 0; }

/* Cards, layout helpers (also used by /account, /link, /account/delete) */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card.narrow { max-width: 500px; margin-left: auto; margin-right: auto; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; }

label { font-weight: 600; font-size: 0.9rem; margin-top: 4px; }
input, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 11px 12px; min-height: 46px;
}
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }
.field-error { color: var(--error); font-size: 0.85rem; margin: -2px 0 2px; }
.hint { color: var(--muted); font-size: 0.85rem; margin: -2px 0 2px; }

.btn {
  font: inherit; font-weight: 700; border-radius: 999px; padding: 11px 20px; min-height: 46px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .2s var(--ease), filter .2s, background-color .2s;
}
.btn:hover { filter: brightness(0.97); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: var(--error-bg); border-color: transparent; color: var(--error); }
.btn.wide { width: 100%; }
.btn.small { padding: 6px 14px; min-height: 38px; font-size: 0.9rem; }
.btn.big { padding: 14px 26px; font-size: 1.05rem; min-height: 54px; }
.btn.ghost-dark { background: rgb(255 255 255 / 8%); border-color: rgb(255 255 255 / 18%); color: #fff; }
.btn.ghost-dark:hover { background: rgb(255 255 255 / 14%); }
.btn svg { width: 20px; height: 20px; flex: none; }
.link-btn { font: inherit; background: none; border: 0; padding: 6px 0; color: var(--link); cursor: pointer; font-size: 0.9rem; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.85rem; margin: 14px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--border); }

.note { border-radius: var(--radius-sm); padding: 10px 12px; margin: 12px 0 0; font-size: 0.95rem; }
.note.error { background: var(--error-bg); color: var(--error); }
.note.ok { background: var(--ok-bg); color: var(--ok); }
.note.warn { background: var(--warn-bg); color: var(--warn); }
.note.info { background: var(--surface-2); color: var(--text); }

.badge { display: inline-block; font-size: 0.8rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.off { background: var(--surface-2); color: var(--muted); }

.tv-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tv-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tv-item .tv-name { font-weight: 600; }
.tv-item .tv-meta { color: var(--muted); font-size: 0.85rem; }

.code-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.4rem; letter-spacing: 0.15em; text-transform: uppercase; text-align: center; }
.big-tv { font-size: 1.25rem; font-weight: 700; }
.todo { background: var(--warn-bg); color: var(--warn); border-radius: 8px; padding: 2px 6px; }
.url-big { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.15rem; font-weight: 700; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 14px; margin: 8px 0; overflow-wrap: anywhere; }
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.8rem; }
.prose li { margin-bottom: 0.4rem; }

/* Page heads (pricing, download, legal) */
.hero { padding: 40px 0 20px; }
.hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
.hero p { font-size: 1.12rem; color: var(--muted); max-width: 660px; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--link); margin: 0 0 10px; }
.feature h2 { font-size: 1.1rem; margin-bottom: 4px; }
.price { font-family: var(--head); font-size: 2.6rem; font-weight: 800; line-height: 1.1; margin: 4px 0 10px; }
.price small { font-family: var(--body); font-size: 1rem; color: var(--muted); font-weight: 500; }

/* ---------- Home ---------- */
.section { padding: 64px 0 0; }
.section-head { max-width: 720px; margin: 0 0 28px; }
.section-head h2 { font-size: clamp(1.7rem, 4.6vw, 2.5rem); font-weight: 800; }
.section-head p { color: var(--muted); font-size: 1.08rem; }

.home-hero {
  position: relative; isolation: isolate; overflow: hidden;
  margin: 12px -16px 0; padding: 48px 16px 0; color: #F3F5FA;
  background: radial-gradient(60% 50% at 85% 10%, rgb(232 67 111 / 35%), transparent 70%),
              radial-gradient(50% 45% at 10% 0%, rgb(255 177 59 / 28%), transparent 70%),
              linear-gradient(180deg, var(--night), var(--ink));
}
@media (min-width: 700px) { .home-hero { margin: 16px 0 0; border-radius: 28px; padding: 64px 48px 0; } }
.home-hero .eyebrow { color: var(--saffron); }
.home-hero h1 { font-size: clamp(2.3rem, 7.4vw, 4.4rem); max-width: 17ch; margin-bottom: 16px; }
.home-hero h1 .grad { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.home-hero .lede { font-size: clamp(1.05rem, 2.4vw, 1.25rem); color: #C9D0E2; max-width: 600px; margin-bottom: 24px; }
.home-hero .actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 36px; }
.chips li { display: inline-flex; align-items: center; gap: 7px; font-size: 0.9rem; font-weight: 600; color: #DDE2EE; background: rgb(255 255 255 / 7%); border: 1px solid rgb(255 255 255 / 12%); border-radius: 999px; padding: 6px 12px; }
.chips svg { width: 16px; height: 16px; color: var(--saffron); }

/* A TV around a screenshot */
.tv { position: relative; background: #05070C; border-radius: 16px; padding: 8px; box-shadow: 0 0 0 1px rgb(255 255 255 / 8%), 0 30px 80px -20px rgb(0 0 0 / 60%); }
.tv img { border-radius: 9px; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: #0B0E14; }
.hero-tv { max-width: 980px; margin: 0 auto -1px; border-radius: 18px 18px 0 0; padding: 10px 10px 0; }
.hero-tv img { border-radius: 10px 10px 0 0; }
@media (min-width: 700px) { .hero-tv { padding: 12px 12px 0; } }

.works-with { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 26px; padding: 26px 0 0; margin: 0; list-style: none; color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.works-with li { display: flex; align-items: center; gap: 8px; }
.works-with svg { width: 18px; height: 18px; color: var(--coral); }

/* Feature grid */
.bento { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1020px) { .bento { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); transition: transform .25s var(--ease), border-color .25s; }
.tile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--coral) 45%, var(--border)); }
.tile p { color: var(--muted); margin: 0; }
.icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; margin-bottom: 16px; color: var(--ink); background: var(--saffron); }
.icon svg { width: 24px; height: 24px; }
.icon.coral { background: var(--coral); }
.icon.rose { background: var(--rose); color: #fff; }
.icon.night { background: var(--night); color: var(--saffron); }

/* Showcase rows */
.showcase { display: grid; gap: 28px; align-items: center; padding: 56px 0 0; }
@media (min-width: 900px) {
  .showcase { grid-template-columns: 1.35fr 1fr; gap: 56px; }
  .showcase.flip { grid-template-columns: 1fr 1.35fr; }
  .showcase.flip .showcase-media { order: 2; }
}
.showcase h2 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; }
.showcase .showcase-copy > p { color: var(--muted); font-size: 1.06rem; }
.ticks { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.ticks li { display: flex; gap: 10px; align-items: flex-start; }
.ticks svg { width: 22px; height: 22px; flex: none; color: var(--coral); margin-top: 1px; }

/* Gallery */
.gallery { display: grid; grid-auto-flow: column; grid-auto-columns: min(84%, 520px); gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 18px; margin: 0 -4px; scrollbar-width: thin; overscroll-behavior-x: contain; }
.gallery figure { margin: 0; scroll-snap-align: start; }
.gallery figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 10px; }
.gallery figcaption strong { color: var(--text); }
.gallery-nav { display: flex; gap: 8px; justify-content: flex-end; margin-top: -12px; margin-bottom: 14px; }
.round { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.round svg { width: 20px; height: 20px; }
.round:hover { background: var(--surface-2); }

/* Steps */
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; counter-reset: step; }
@media (min-width: 860px) { .steps { grid-template-columns: repeat(3, 1fr); } }
.steps > li { counter-increment: step; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.steps > li::before { content: counter(step); font-family: var(--head); font-weight: 800; font-size: 1.3rem; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-grad); color: var(--ink); margin-bottom: 14px; }
.steps p { color: var(--muted); margin: 0; }
.steps .url-big { font-size: 1rem; margin-top: 12px; }

/* Price block */
.price-band { display: grid; gap: 24px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 28px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.price-band::before { content: ""; position: absolute; inset: 0 0 auto; height: 5px; background: var(--brand-grad); }
@media (min-width: 860px) { .price-band { grid-template-columns: 1.1fr 1fr; padding: 44px; } }
.price-band h2 { font-size: clamp(1.6rem, 4.4vw, 2.3rem); font-weight: 800; }
.price-band .price { font-size: clamp(2.8rem, 8vw, 4rem); }

/* FAQ */
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 18px; }
.faq summary { cursor: pointer; list-style: none; font-weight: 700; padding: 16px 30px 16px 0; position: relative; min-height: 48px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; position: absolute; right: 4px; top: 50%; width: 10px; height: 10px; border-right: 2.5px solid var(--muted); border-bottom: 2.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); transition: transform .2s var(--ease); }
.faq details[open] summary::after { transform: translateY(-30%) rotate(225deg); }
.faq details p { color: var(--muted); margin: 0 0 16px; }

/* Closing band */
.cta-band { margin-top: 72px; border-radius: 28px; padding: 44px 24px; text-align: center; color: #F3F5FA; background: radial-gradient(70% 90% at 50% 0%, rgb(255 107 74 / 30%), transparent 70%), linear-gradient(180deg, var(--night), var(--ink)); }
.cta-band h2 { font-size: clamp(1.8rem, 5vw, 2.8rem); font-weight: 800; }
.cta-band p { color: #C9D0E2; max-width: 560px; margin: 0 auto 22px; }
.cta-band .actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* Download page */
.dl-grid { display: grid; gap: 16px; }
@media (min-width: 900px) { .dl-grid { grid-template-columns: 1fr 1fr; } }
.dl-grid ol { padding-left: 1.2rem; margin: 0; }
.dl-grid li { margin-bottom: 0.65rem; }

/* Pricing page */
.plan-included { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
@media (min-width: 700px) { .plan-included { grid-template-columns: 1fr 1fr; } }
.plan-included li { display: flex; gap: 10px; }
.plan-included svg { width: 22px; height: 22px; flex: none; color: var(--coral); }

/* Reveal on scroll (only when motion is welcome and JS ran) */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
  .js .reveal.in { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
