/* TVTimez: colours and type sizes come from theme.json presets. */
:root {
  --bg: var(--wp--preset--color--ground);
  --surface: var(--wp--preset--color--surface);
  --ink: var(--wp--preset--color--ink);
  --muted: var(--wp--preset--color--muted);
  --accent: var(--wp--preset--color--accent);
  --accent-ink: var(--wp--preset--color--accent-ink);
  --small: var(--wp--preset--font-size--small);
  --body: var(--wp--preset--font-size--body);
  --lead: var(--wp--preset--font-size--lead);
  --head: var(--wp--preset--font-size--head);
  --display: var(--wp--preset--font-size--display);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --edge: clamp(1.25rem, 3vw, 2.5rem);
  --section: clamp(6rem, 11vw, 10rem);
  --bar-top: var(--wp-admin--admin-bar--height, 0px);
  scrollbar-color: var(--muted) var(--bg);
}

html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
body { margin: 0; overflow-x: clip; word-spacing: 0.06em; }
body > .wp-site-blocks > *, .tv-main > * { margin-block: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img { display: block; max-width: 100%; height: auto; }
a { text-underline-offset: 0.18em; text-decoration-thickness: 1px; transition: color 160ms ease; }
figure { margin: 0; }
h1, h2, h3, p, ul, ol { margin-block: 0; }
h1, h2 { font-size: var(--head); text-wrap: balance; word-spacing: 0; }
.tv-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tv-note { color: var(--muted); font-size: 1rem; max-width: 62ch; }
.tv-note a { color: var(--ink); }

/* Buttons */
.wp-block-buttons { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.wp-block-button__link, .tv-bar__go, .tv-check__go, .tv-table__go, .single_add_to_cart_button {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease;
}
.wp-block-button__link:active, .tv-bar__go:active, .tv-check__go:active, .tv-table__go:active, .single_add_to_cart_button:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .wp-block-button__link:hover, .tv-bar__go:hover, .tv-check__go:hover, .tv-table__go:hover, .single_add_to_cart_button:hover { background: var(--ink); color: var(--accent-ink); }
  a:hover { color: var(--accent); }
}

/* Header */
.tv-bar {
  position: sticky;
  top: var(--bar-top);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.75rem var(--edge);
  background: var(--bg);
}
.tv-bar a:not(.tv-bar__go) { color: var(--ink); text-decoration: none; }
.tv-bar__name { font-size: var(--lead); font-weight: 500; letter-spacing: -0.03em; }
.tv-bar__nav { display: flex; gap: 1.75rem; margin-left: auto; font-size: 1rem; }
@media (hover: hover) and (pointer: fine) { .tv-bar__nav a:hover { color: var(--accent); } }
.tv-bar__go { padding: 0.55rem 1.1rem; font-size: 1rem; }

/* Hero: the headline beside a working check */
.tv-hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(2rem, 5vw, 5rem);
  align-items: end;
  padding: clamp(3rem, 7vw, 6rem) var(--edge) clamp(3rem, 5vw, 4.5rem);
}
.tv-hero__text { display: grid; gap: 1.75rem; justify-items: start; }
.tv-hero h1 { font-size: var(--display); line-height: 0.98; max-width: 10ch; }
.tv-lead { font-size: var(--lead); line-height: 1.3; max-width: 34ch; }

/* The check is a piece of working interface */
.tv-check { display: grid; gap: 1.1rem; padding: clamp(1.25rem, 2.5vw, 2rem); background: var(--surface); font-size: 1rem; }
.tv-check__title { font-size: var(--lead); font-weight: 500; line-height: 1.15; letter-spacing: -0.02em; }
.tv-check__field { display: grid; gap: 0.15rem; }
.tv-check label { display: flex; justify-content: space-between; gap: 1rem; }
.tv-check output { font-weight: 500; font-variant-numeric: tabular-nums; }
.tv-check input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 40px; margin: 0; background: transparent; cursor: pointer; }
.tv-check input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: var(--muted); }
.tv-check input[type="range"]::-moz-range-track { height: 4px; background: var(--muted); }
.tv-check input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 24px; margin-top: -10px; border: 0; border-radius: 2px; background: var(--ink); }
.tv-check input[type="range"]::-moz-range-thumb { width: 12px; height: 24px; border: 0; border-radius: 2px; background: var(--ink); }
.tv-meter { height: 10px; background: var(--bg); overflow: hidden; }
.tv-meter i { display: block; height: 100%; background: var(--accent); transform: scaleX(0.5); transform-origin: left; transition: transform 200ms var(--ease-out); }
.tv-check__result { min-height: 4.4em; line-height: 1.45; }
.tv-check__go { justify-self: stretch; }
.tv-check__note { color: var(--muted); font-size: var(--small); line-height: 1.4; }

/* Full-width picture */
.tv-band img { width: 100%; aspect-ratio: 21 / 8; object-fit: cover; object-position: 50% 62%; }

/* Statement with pictures in the sentence */
.tv-what { padding: var(--section) var(--edge); }
.tv-statement { font-size: clamp(1.5rem, 1rem + 1.8vw, 2.25rem); line-height: 1.22; letter-spacing: -0.02em; word-spacing: 0; max-width: 34ch; }
.tv-word { display: inline-block; width: 1.9em; height: 1em; object-fit: cover; vertical-align: -0.12em; }

/* How it starts: three pictures down a diagonal */
.tv-how {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 1.5rem;
  row-gap: 0;
  padding: 0 var(--edge) var(--section);
}
.tv-how__head { grid-column: 1 / -1; margin-bottom: 3rem; }
.tv-how > div { display: grid; column-gap: 1.5rem; row-gap: 1rem; align-content: start; }
.tv-how img { width: 100%; object-fit: cover; }
.tv-how p { max-width: 36ch; }
.tv-stage-a { grid-column: 1 / span 6; }
.tv-stage-a img { aspect-ratio: 3 / 4; max-width: 72%; }
.tv-stage-b { grid-column: 7 / span 6; margin-top: 11rem; }
.tv-stage-b img { aspect-ratio: 1; max-width: 60%; }
.tv-stage-c { grid-column: 5 / -1; margin-top: 4rem; }
.tv-stage-c img { aspect-ratio: 16 / 10; }

/* Plans */
.tv-plans { padding: 0 var(--edge) var(--section); display: grid; gap: 2rem; }
.tv-plans > * { margin-block: 0; }
.tv-table { width: 100%; border-collapse: collapse; font-size: var(--lead); font-variant-numeric: tabular-nums; }
.tv-table thead th { text-align: left; font-size: 1rem; font-weight: 400; color: var(--muted); padding: 0 1.25rem 0.75rem; }
.tv-table tbody th, .tv-table tbody td { text-align: left; padding: 1.15rem 1.25rem; font-weight: 400; vertical-align: middle; }
.tv-table tbody tr:nth-child(odd) { background: var(--surface); }
.tv-table tbody th a { color: var(--ink); font-weight: 500; }
.tv-table td:last-child { text-align: right; width: 1%; white-space: nowrap; }
.tv-table__go { padding: 0.55rem 1.1rem; font-size: 1rem; }

/* Questions */
.tv-faq { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 1.5rem; padding: 0 var(--edge) var(--section); align-items: start; }
.tv-faq > * { margin-block: 0; }
.tv-faq h2 { position: sticky; top: 6rem; }
.tv-faq__list { display: grid; gap: 0.5rem; }
.tv-faq__list > * { margin-block: 0; }
.wp-block-details { background: var(--surface); transition: background-color 200ms ease; }
.wp-block-details summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 72px;
  padding: 0.75rem 1.5rem;
  box-sizing: border-box;
  font-weight: 500;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-right: 2px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 200ms var(--ease-out);
}
.wp-block-details[open] { background: var(--accent); color: var(--accent-ink); }
.wp-block-details[open] summary::after { transform: rotate(225deg) translate(-2px, -2px); }
.wp-block-details p { padding: 0 1.5rem 1.5rem; max-width: 56ch; }

/* The close */
.tv-close {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 1.5rem;
  padding: 0 var(--edge) var(--section);
}
.tv-close > * { margin-block: 0; }
.tv-close__pic img { width: 100%; height: 100%; object-fit: cover; }
.tv-close__tile { display: grid; gap: 1rem; justify-items: start; align-content: center; min-height: 360px; padding: 2.5rem; background: var(--accent); color: var(--accent-ink); }
.tv-close__tile > * { margin-block: 0; }
.tv-close__tile .wp-block-button__link { background: var(--accent-ink); color: var(--ink); }
.tv-close__tile .wp-block-buttons { margin-top: 0.5rem; }

/* Footer */
.tv-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.5rem 1.5rem;
  padding: 1.75rem var(--edge);
  font-size: var(--small);
  color: var(--muted);
}
.tv-foot a { color: var(--ink); }
.tv-foot__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.5rem; justify-content: center; }
.tv-foot__end { text-align: right; }

/* Plan pages */
.tv-plan { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(2rem, 5vw, 5rem); padding: clamp(2rem, 5vw, 4rem) var(--edge) 0; align-items: stretch; }
.tv-plan > * { margin-block: 0; }
.tv-plan__body { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1.5rem; }
.tv-plan__body > * { margin-block: 0; }
.tv-plan h1 { font-size: var(--display); line-height: 0.98; max-width: 9ch; }
.tv-plan__body .wp-block-post-excerpt__excerpt { margin: 0; font-size: var(--lead); line-height: 1.3; }
.tv-plan__price { font-size: var(--head); font-weight: 500; letter-spacing: -0.03em; line-height: 1; margin: 0; }
.tv-plan__pic img { width: 100%; height: 100%; max-height: 70svh; object-fit: cover; }
.tv-plan form.cart { display: grid; gap: 1.25rem; margin: 0; }
.tv-plan .quantity { display: none; }
.tv-included { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 1.5rem; padding: var(--section) var(--edge); align-items: start; }
.tv-included > * { margin-block: 0; }
.tv-included ul { display: grid; gap: 0.5rem; padding: 0; margin: 0; list-style: none; }
.tv-included li { padding: 1rem 1.25rem; background: var(--surface); margin: 0; }
.tv-included .tv-note { grid-column: 2; }
.woocommerce-error, .woocommerce-message { background: var(--surface); color: var(--ink); }

/* WooCommerce cart and checkout. These must beat WooCommerce's own block styles. */
body .wc-block-components-text-input input,
body .wc-block-components-text-input textarea,
body .wc-block-components-textarea,
body .wc-blocks-components-select__select {
  background: var(--accent-ink) !important;
  border-color: var(--muted) !important;
  border-radius: 0 !important;
  color: var(--ink) !important;
}
body .wc-block-components-text-input label,
body .wc-blocks-components-select__label { color: var(--muted) !important; }
body .wc-block-components-text-input input::placeholder { color: var(--muted) !important; }
body .wc-blocks-components-select__container { background: var(--accent-ink) !important; border-radius: 0 !important; }
body .wc-blocks-components-select__expand { fill: var(--ink) !important; }
body .wc-block-components-notice-banner { background: var(--surface) !important; border-radius: 0 !important; color: var(--ink) !important; }
body .wc-block-components-notice-banner *:not(svg, path) { color: var(--ink) !important; }
body .wc-block-components-notice-banner > .wc-block-components-notice-banner__content a,
body .wc-block-components-notice-banner > .wc-block-components-notice-banner__content .wc-forward { background: transparent !important; color: var(--ink) !important; opacity: 1 !important; }
body .wc-block-components-order-summary-item__image { display: none !important; }
body .wc-block-components-button:not(.is-link) { border-radius: 0 !important; }
body .wc-block-components-checkout-place-order-button,
body .wc-block-cart__submit-button { background: var(--accent) !important; color: var(--accent-ink) !important; }

/* Other templates */
.tv-page { max-width: 46rem; margin-inline: auto; padding: 3rem var(--edge) 6rem; }
.tv-page > * + * { margin-top: 1.5rem; }
.tv-page .wp-block-post-content h2 { font-size: var(--lead); margin-top: 2.75rem; line-height: 1.15; }
.tv-page .wp-block-post-content > * + * { margin-top: 1rem; }

/* Entrances: only hidden once the script has confirmed it can show them again */
.js-reveal [data-rise] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
  transition-delay: calc(var(--rise, 0) * 60ms);
}
.js-reveal [data-rise].is-in { opacity: 1; transform: none; }

@media (max-width: 1000px) {
  .tv-hero, .tv-plan { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .tv-faq, .tv-included { grid-template-columns: minmax(0, 1fr); }
  .tv-faq h2 { position: static; }
  .tv-included .tv-note { grid-column: 1; }
  .tv-plan__pic img { aspect-ratio: 16 / 9; height: auto; }
  .tv-close { grid-template-columns: minmax(0, 1fr); }
  .tv-close__pic { display: none; }
  .tv-close__tile { min-height: 300px; padding: 2rem; }
  .tv-how__head { margin-bottom: 2rem; }
  .tv-how > div { grid-column: 1 / -1; margin-top: 0; margin-bottom: 3.5rem; }
  .tv-stage-a img { max-width: 100%; aspect-ratio: 4 / 3; }
  .tv-stage-b img { justify-self: end; max-width: 62%; }
  .tv-stage-b p { justify-self: end; }
  .tv-stage-c img { max-width: 78%; }
  .tv-how { padding-bottom: 3rem; }
}

@media (max-width: 700px) {
  .tv-bar { gap: 1rem; }
  .tv-bar__nav { display: none; }
  .tv-bar__go { margin-left: auto; }
  .tv-foot { grid-template-columns: minmax(0, 1fr); }
  .tv-foot__links { justify-content: flex-start; }
  .tv-foot__end { text-align: left; }
  .tv-band img { aspect-ratio: 4 / 3; }
  .tv-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .tv-table, .tv-table tbody, .tv-table tr, .tv-table tbody th, .tv-table tbody td { display: block; width: auto; }
  .tv-table tbody tr { padding: 1.25rem; margin-bottom: 0.5rem; background: var(--surface); }
  .tv-table tbody th, .tv-table tbody td { padding: 0; }
  .tv-table tbody th { font-size: var(--head); line-height: 1.05; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
  .tv-table tbody th a { text-decoration: none; }
  .tv-table tbody td[data-label] { display: flex; justify-content: space-between; gap: 1rem; padding-block: 0.25rem; font-size: 1.0625rem; }
  .tv-table tbody td[data-label]::before { content: attr(data-label); color: var(--muted); }
  .tv-table td:last-child { width: auto; text-align: left; margin-top: 1rem; }
  .tv-table__go { display: block; padding: 0.85rem 1rem; }
  .wp-block-details summary { min-height: 64px; padding-inline: 1.25rem; }
  .wp-block-details p { padding-inline: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tv-meter i { transition: none; }
  .js-reveal [data-rise] { transform: none; transition: opacity 200ms ease; transition-delay: 0ms; }
}
