/*
  Tilecast: streaming TV app (Screenery template)
  A flat tile world on a dark ground: five solid tile colours, huge light lowercase type that bleeds off the edge, no gradients, no shadows.

  Contents
   1. Tokens
   2. Base and browser surfaces
   3. Shared pieces: pills, round buttons, focus ring, icons
   4. The app frame, bar and panorama title
   5. Hubs and the tile grid, live tiles (flip), continue bars, categories
   6. Search: on-screen keyboard and results
   7. Layers: detail and player
   8. About, plans, questions, footer
   9. Motion
  10. Narrow screens: the panorama becomes vertical sections
*/

/* 1. Tokens ------------------------------------------------------------- */
:root {
  --ground: #0e0f11;
  --ground-2: #17191c;
  --ground-3: #23262b;
  --ink: #f4f4f2;
  --ink-2: #b8bcc3;
  --ink-3: #8d939c;
  --line: #2c3036;

  /* the five tile colours, all pass 4.5:1 with white text */
  --c1: #1d5fbf; /* cobalt */
  --c2: #a3166c; /* magenta */
  --c3: #2d7a24; /* leaf */
  --c4: #b4430e; /* rust */
  --c5: #5a32a8; /* violet */
  --focus: #ffffff;
  --bad: #ff8a8a;
  --good: #8fe08a;

  --font: "Noto Sans Display", system-ui, sans-serif;

  --u: clamp(92px, 18.5vh, 176px);  /* one tile unit */
  --gap: 8px;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px; --s6: 64px; --s7: 112px;
  --edge: clamp(16px, 4vw, 64px);
  --radius: 0;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

/* 2. Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--ground); color-scheme: dark; scrollbar-color: var(--ground-3) var(--ground); }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 300 1.0625rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased; overflow-x: clip;
}
::selection { background: var(--c2); color: #fff; }
input { caret-color: var(--c1); }
:root { accent-color: var(--c1); }
a { color: var(--ink); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { color: #fff; text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; font-weight: 200; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
.defs { position: absolute; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--s3); top: -60px; z-index: 50; background: var(--c1); color: #fff; padding: var(--s2) var(--s3); }
.skip:focus { top: var(--s3); }
::-webkit-scrollbar { height: 8px; width: 10px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--ground-3); }

/* 3. Shared pieces ------------------------------------------------------- */
.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: square; stroke-linejoin: miter; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.pill {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s4) 0 var(--s3);
  background: transparent; border: 2px solid var(--ink); color: var(--ink);
  font-size: 1.125rem; font-weight: 400; cursor: pointer; text-transform: lowercase;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.pill:hover { background: var(--ink); color: var(--ground); }
.pill--solid { background: var(--ink); color: var(--ground); }
.pill--solid:hover { background: #fff; }
.pill--ghost { border-color: transparent; padding-left: 0; }
.pill--ghost:hover { background: transparent; color: #fff; }
.pill--ghost .i { width: 28px; height: 28px; }
.pill[aria-pressed="true"] { background: var(--c3); border-color: var(--c3); color: #fff; }
.pill[disabled] { opacity: .55; cursor: progress; }
.round {
  width: 52px; height: 52px; display: grid; place-items: center; flex: none;
  border: 2px solid var(--ink); background: transparent; color: var(--ink); border-radius: 50%; cursor: pointer;
}
.round:hover { background: var(--ink); color: var(--ground); }
.round[aria-pressed="false"] { opacity: .6; }

/* 4. App frame ----------------------------------------------------------- */
.app {
  position: relative; height: 100svh; min-height: 620px; overflow: hidden;
  background: var(--ground); isolation: isolate;
}
.app-bar {
  position: absolute; inset: 0 0 auto 0; z-index: 3;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4) var(--edge) 0;
  font-size: 1rem; color: var(--ink-2);
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; letter-spacing: .01em; font-size: 1.125rem; }
.wm-tile { width: 18px; height: 18px; background: var(--c1); box-shadow: none; display: inline-block; }
.remote-hint { margin-right: auto; color: var(--ink-3); }
.app-links { display: flex; gap: var(--s4); }
.app-links a { color: var(--ink-2); text-decoration: none; }
.app-links a:hover { color: var(--ink); text-decoration: underline; }
.clock { font-variant-numeric: tabular-nums; color: var(--ink); font-size: 1.25rem; font-weight: 300; }

.pano {
  position: absolute; inset: 0; overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; scroll-behavior: smooth;
  padding-top: calc(var(--s5) + 1vh + clamp(5rem, 15vh, 10rem) + 12px);
}
.pano::-webkit-scrollbar { display: none; }
/* The panorama title: type is the composition, so it runs past 6rem and off the right edge */
.pano-title {
  position: absolute; top: calc(var(--s5) + 1vh); left: calc(var(--edge) - .06em);
  font-size: clamp(5rem, 15vh, 10rem); line-height: 1; font-weight: 200; letter-spacing: -0.035em;
  white-space: nowrap; color: var(--ink); pointer-events: none;
  will-change: transform;
}
.hubs { display: flex; gap: var(--s7); padding: 0 var(--s7) 0 var(--edge); width: max-content; }

/* 5. Hubs and tiles ------------------------------------------------------ */
.hub { flex: none; }
.hub-head { font-size: clamp(2rem, 5.4vh, 3.25rem); font-weight: 300; line-height: 1.1; margin-bottom: var(--s3); letter-spacing: -0.02em; }
.grid {
  display: grid; gap: var(--gap);
  grid-template-rows: repeat(3, var(--u)); grid-auto-columns: var(--u); grid-auto-flow: column dense;
}
.tile {
  position: relative; display: block; padding: 0; border: 0; margin: 0; cursor: pointer;
  background: var(--ground-3); color: #fff; text-align: left; perspective: 900px;
  transition: transform .25s var(--ease);
}
.tile--wide { grid-column: span 2; }
.tile--large { grid-column: span 2; grid-row: span 2; }
.tile:focus-visible, .tile.is-focus { outline: 4px solid var(--focus); outline-offset: 4px; transform: scale(1.035); z-index: 2; }
.tile:hover { transform: scale(1.02); }
.flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .9s var(--ease); }
.tile.flipped .flip { transform: rotateX(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px 12px; }
.face svg.art { position: absolute; inset: 0; width: 100%; height: 100%; }
.face.back { transform: rotateX(180deg); justify-content: space-between; }
.t-name { position: relative; font-size: 1rem; font-weight: 400; line-height: 1.15; text-transform: lowercase; }
.tile--large .t-name { font-size: 2rem; font-weight: 300; letter-spacing: -0.01em; }
.tile--wide .t-name { font-size: 1.25rem; }
.t-small { font-size: .875rem; color: #fff; font-weight: 400; }
.b-big { font-size: 2.5rem; font-weight: 200; line-height: 1; }
.tile--large .b-big { font-size: 4.5rem; }
.c1 { background: var(--c1); --tc: var(--c1); } .c2 { background: var(--c2); --tc: var(--c2); } .c3 { background: var(--c3); --tc: var(--c3); } .c4 { background: var(--c4); --tc: var(--c4); } .c5 { background: var(--c5); --tc: var(--c5); }
/* the name sits on a strip of the tile's own colour so it reads over any poster shape */
.t-label { position: relative; align-self: flex-start; padding: 2px 8px 3px; margin: 0 -12px -10px; background: var(--tc); }
.face.front { background: inherit; }
.bar { position: relative; height: 4px; background: rgba(255,255,255,.3); margin-top: 6px; }
.bar i { position: absolute; inset: 0 auto 0 0; background: #fff; }

.cat .face { justify-content: space-between; }
.cat .i { width: 34px; height: 34px; }
.cat .t-name { font-size: 1.25rem; }

.empty-note { grid-row: span 3; grid-column: span 3; align-self: start; max-width: 32ch; color: var(--ink-2); font-size: 1.25rem; line-height: 1.4; }
.empty-note b { display: block; color: var(--ink); font-weight: 300; font-size: 1.75rem; margin-bottom: var(--s2); }
.err-panel { grid-row: span 3; grid-column: span 4; display: flex; flex-direction: column; justify-content: center; gap: var(--s3); padding: var(--s4); border: 2px solid var(--bad); }
.err-panel b { font-weight: 300; font-size: 1.75rem; }
.err-panel p { color: var(--ink-2); max-width: 40ch; }
.err-panel .pill { align-self: flex-start; }
.loading-tile { background: var(--ground-3); }
.grid > noscript { grid-row: 1 / -1; grid-column: span 6; }
.nojs-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 220px); gap: var(--gap); }
.nojs-list li { padding: var(--s3); min-height: 110px; font-size: 1.25rem; display: flex; flex-direction: column; justify-content: flex-end; }
.nojs-list small { font-size: .875rem; }

/* 6. Search -------------------------------------------------------------- */
.search { display: flex; gap: var(--s5); }
.search-pad { width: calc(var(--u) * 2.6); flex: none; }
.query { display: flex; align-items: center; gap: var(--s2); height: 52px; padding: 0 var(--s3); background: var(--ground-2); border-bottom: 2px solid var(--ink); font-size: 1.25rem; margin-bottom: var(--gap); }
.query .caret { width: 2px; height: 1.2em; background: var(--c1); margin-left: -4px; }
.keys { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.key {
  height: calc(var(--u) * .34); min-height: 40px; border: 0; background: var(--ground-3); color: var(--ink);
  font-size: 1.125rem; cursor: pointer; display: grid; place-items: center;
}
.key:hover { background: var(--line); }
.key:focus-visible { background: var(--c1); outline-offset: 2px; }
.key--wide { grid-column: span 2; font-size: .9375rem; }
.results-head { color: var(--ink-2); margin-bottom: var(--s2); font-size: 1.0625rem; height: 30px; }
.grid--results { grid-template-rows: repeat(3, calc(var(--u) * .8 - 10px)); grid-auto-columns: calc(var(--u) * 1.4); }
.grid--results .empty-note { grid-column: span 2; }

/* 7. Layers -------------------------------------------------------------- */
.layer { position: absolute; inset: 0; z-index: 5; background: var(--ground); }
.layer[hidden] { display: none; }
.detail { display: grid; grid-template-columns: minmax(0, 42%) minmax(0, 1fr); }
.d-art { position: relative; overflow: hidden; }
.d-art svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.d-body { padding: var(--s4) var(--edge) var(--s5) var(--s6); overflow-y: auto; overflow-x: hidden; }
.d-title { font-size: clamp(3.5rem, 11vh, 7.5rem); line-height: 1; letter-spacing: -0.035em; margin: var(--s4) 0 var(--s3); white-space: nowrap; margin-right: calc(var(--edge) * -1 - 1em); }
.d-meta { color: var(--ink-2); font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.d-blurb { max-width: 60ch; margin: var(--s3) 0 var(--s4); font-size: 1.1875rem; }
.d-actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-bottom: var(--s5); }
.d-sub { font-size: 2.25rem; font-weight: 300; margin-bottom: var(--s3); }
.eps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 760px; }
.ep {
  width: 100%; display: grid; grid-template-columns: 3rem 1fr auto; align-items: center; gap: var(--s3);
  min-height: 60px; padding: 8px var(--s3); border: 0; background: var(--ground-2); text-align: left; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ep:hover { background: var(--ground-3); }
.ep-n { font-size: 1.5rem; font-weight: 200; }
.ep-name { font-size: 1.125rem; font-weight: 400; }
.ep-name small { display: block; font-size: .9375rem; font-weight: 300; color: var(--ink-2); }
.ep-min { color: var(--ink-2); }
.ep .bar { grid-column: 2 / -1; margin: 0; background: var(--line); }

.player { background: #000; }
.screen { position: absolute; inset: 0; overflow: hidden; }
.screen svg { position: absolute; inset: -6%; width: 112%; height: 112%; }
.screen .drift { transform-box: fill-box; transform-origin: center; }
.p-top { position: absolute; inset: 0 0 auto 0; display: flex; align-items: center; gap: var(--s4); padding: var(--s4) var(--edge); background: rgba(14,15,17,.86); }
.p-now { font-size: 1.25rem; }
.p-now b { font-weight: 400; }
.p-bar { position: absolute; inset: auto 0 0 0; display: flex; align-items: center; gap: var(--s3); padding: var(--s4) var(--edge) var(--s5); background: rgba(14,15,17,.86); }
.p-time { font-variant-numeric: tabular-nums; min-width: 9ch; text-align: right; color: var(--ink); }
.scrub { flex: 1; min-width: 0; height: 44px; -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; }
.scrub::-webkit-slider-runnable-track { height: 6px; background: linear-gradient(var(--ink), var(--ink)) 0 / var(--pct, 0%) 100% no-repeat, var(--line); }
.scrub::-moz-range-track { height: 6px; background: var(--line); }
.scrub::-moz-range-progress { height: 6px; background: var(--ink); }
.scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px; background: var(--ink); border: 0; border-radius: 0; }
.scrub::-moz-range-thumb { width: 20px; height: 20px; background: var(--ink); border: 0; border-radius: 0; }
.caption {
  position: absolute; left: 50%; bottom: 150px; transform: translateX(-50%); max-width: min(90%, 52ch);
  background: #000; color: #fff; padding: 6px 14px; font-size: clamp(1.125rem, 2.6vh, 1.75rem); font-weight: 400; text-align: center;
}
.caption:empty { display: none; }

/* 8. Below the app ------------------------------------------------------- */
.about, .plans, .faq { padding: var(--s7) var(--edge) 0; overflow: hidden; }
.big-head { font-size: clamp(3.5rem, 11vw, 9rem); line-height: .95; letter-spacing: -0.04em; white-space: nowrap; margin: 0 0 var(--s5) -.05em; }
.about-cols { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--s5) var(--s6); }
.lede { font-size: clamp(1.375rem, 2.2vw, 1.875rem); line-height: 1.35; max-width: 34ch; font-weight: 300; }
.about-text { display: grid; gap: var(--s3); max-width: 62ch; color: var(--ink-2); }

.trial { max-width: 1100px; }
.plan-set { border: 0; padding: 0; margin: 0 0 var(--s5); display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); }
.plan { position: relative; display: grid; gap: var(--s2); align-content: end; min-height: 300px; padding: var(--s4); cursor: pointer; color: #fff; transition: transform .25s var(--ease); }
.plan input { position: absolute; top: var(--s4); right: var(--s4); width: 26px; height: 26px; margin: 0; accent-color: #fff; }
.plan:has(input:checked) { outline: 4px solid var(--focus); outline-offset: 4px; }
.plan:has(input:focus-visible) { outline: 4px dashed var(--focus); outline-offset: 4px; }
.plan-name { font-size: clamp(2rem, 4vw, 3.25rem); font-weight: 200; line-height: 1; letter-spacing: -0.02em; }
.plan-price { font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.plan-price b { font-size: 1.75rem; font-weight: 400; }
.plan-list { max-width: 44ch; }
.trial-row { display: flex; gap: var(--s3); align-items: flex-start; flex-wrap: wrap; }
.field { flex: 1 1 320px; display: grid; gap: 6px; }
.field label { color: var(--ink-2); }
.field input {
  height: 54px; padding: 0 var(--s3); font: inherit; font-size: 1.125rem; color: var(--ink);
  background: var(--ground-2); border: 0; border-bottom: 2px solid var(--ink-3); border-radius: 0;
}
.field input::placeholder { color: var(--ink-3); }
.field input:focus { outline: none; border-bottom-color: var(--ink); background: var(--ground-3); }
.field input[aria-invalid="true"] { border-bottom-color: var(--bad); }
.msg { min-height: 1.5em; color: var(--bad); font-size: .9375rem; }
.pill--big { min-height: 54px; margin-top: 30px; padding: 0 var(--s5); }
.trial-note { color: var(--ink-2); max-width: 62ch; margin-top: var(--s2); }
.trial-status { margin-top: var(--s3); }
.trial-status:empty { display: none; }
.note { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s3) var(--s4); max-width: 62ch; }
.note b { display: block; font-weight: 400; font-size: 1.25rem; }
.note--ok { background: var(--c3); }
.note--bad { background: var(--ground-2); border: 2px solid var(--bad); }

.faq-list { max-width: 880px; display: grid; gap: 4px; }
.faq details { background: var(--ground-2); }
.faq summary { list-style: none; cursor: pointer; padding: var(--s3) var(--s4); min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); font-size: 1.25rem; font-weight: 400; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; width: 14px; height: 14px; flex: none; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg) translateY(-4px); transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq details[open] summary { background: var(--c1); }
.faq details p { padding: var(--s3) var(--s4) var(--s4); color: var(--ink-2); max-width: 66ch; }

.foot { margin-top: var(--s7); padding: 0 var(--edge) var(--s5); overflow: hidden; border-top: 1px solid var(--line); }
.foot-mark { font-size: clamp(5rem, 22vw, 18rem); font-weight: 200; line-height: .9; letter-spacing: -0.05em; margin: var(--s4) 0 var(--s4) -.06em; white-space: nowrap; color: var(--c1); }
.foot-cols { display: grid; grid-template-columns: repeat(4, auto); justify-content: space-between; gap: var(--s3) var(--s5); color: var(--ink-2); font-size: .9375rem; }
.foot-cols a { color: var(--ink-2); }

/* 9. Motion -------------------------------------------------------------- */
@keyframes caretBlink { 50% { opacity: 0; } }
@keyframes drift { from { transform: translate(-3%, 0) rotate(0deg); } to { transform: translate(3%, -2%) rotate(6deg); } }
@keyframes pulse { 50% { background: var(--line); } }
@keyframes layerIn { from { opacity: 0; transform: translateX(6%); } }
@media (prefers-reduced-motion: no-preference) {
  .query .caret { animation: caretBlink 1s steps(1) infinite; }
  .screen .drift { animation: drift 14s ease-in-out infinite alternate; }
  .screen.paused .drift { animation-play-state: paused; }
  .loading-tile { animation: pulse 1s ease-in-out infinite; }
  .layer:not([hidden]) { animation: layerIn .45s var(--ease); }
}
@media (prefers-reduced-motion: reduce) {
  .pano { scroll-behavior: auto; }
  .flip, .tile, .plan { transition: none; }
}

/* 10. Narrow screens ----------------------------------------------------- */
@media (max-width: 900px) {
  .remote-hint { display: none; }
  .wordmark { margin-right: auto; }
  .detail { grid-template-columns: 1fr; grid-template-rows: 34vh auto; overflow-y: auto; }
  .d-body { padding: var(--s3) var(--edge) var(--s6); overflow: visible; }
  .about-cols { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --u: calc((100vw - 2 * var(--edge) - var(--gap)) / 2); }
  .app { height: auto; min-height: 0; overflow: visible; overflow-x: clip; }
  .app-bar { position: relative; padding: var(--s3) var(--edge); gap: var(--s3); }
  .app-links { display: none; }
  .pano { position: relative; overflow: visible; padding-top: 0; }
  .pano-title { position: relative; top: 0; left: auto; padding: 0 var(--edge); margin-left: -.05em; font-size: 4.25rem; white-space: normal; line-height: .95; margin-bottom: var(--s5); transform: none !important; }
  .hubs { display: grid; width: auto; gap: var(--s6); padding: 0 var(--edge) var(--s5); }
  .hub-head { font-size: 2.5rem; }
  .grid { grid-template-rows: none; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: calc(var(--u) * .72); grid-auto-flow: row dense; }
  .tile--large { grid-row: span 2; }
  .empty-note, .err-panel { grid-column: 1 / -1; grid-row: auto; }
  .search { display: grid; gap: var(--s4); }
  .search-pad { width: auto; }
  .key { height: 48px; }
  .grid--results { grid-template-rows: none; grid-auto-columns: auto; grid-auto-rows: calc(var(--u) * .62); }
  .nojs-list { grid-template-columns: 1fr; }
  .layer { position: fixed; z-index: 40; overflow-y: auto; }
  .detail { grid-template-rows: 30vh auto; }
  .d-title { font-size: 3.25rem; white-space: normal; margin-right: 0; }
  .p-top { padding: var(--s3) var(--edge); }
  .p-now { font-size: 1rem; }
  .p-bar { flex-wrap: wrap; padding: var(--s3) var(--edge) var(--s4); gap: var(--s2) var(--s3); }
  .scrub { order: -1; flex: 1 1 100%; }
  .p-time { margin-right: auto; text-align: left; }
  .caption { bottom: 150px; }
  .plan-set { grid-template-columns: 1fr; }
  .plan { min-height: 220px; }
  .big-head { white-space: normal; font-size: 3.5rem; }
  .pill--big { margin-top: 0; width: 100%; justify-content: center; }
  .foot-cols { grid-template-columns: 1fr; }
}
