/* TomeLodge website. Colours come ONLY from tokens.css (generated from design/tokens.json,
   the app's Colophon tokens): never write a hex value here. The doctrine is the app's own
   (docs/design/2026-09-01-visual-identity.md in the app repo): ink-and-paper chrome, the
   accent only where the hand goes (links, focus, pressed choices), serif titles over the
   platform sans, small caps over hairline rules, 8 px cards, page-like motion only. */

:root {
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Segoe UI Variable Text', 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system,
    BlinkMacSystemFont, 'Helvetica Neue', Roboto, Arial, sans-serif;

  /* Fluid type: phone to ultrawide, every step capped. */
  --step--1: clamp(0.85rem, 0.82rem + 0.12vw, 0.95rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.13rem);
  --step-1: clamp(1.13rem, 1.05rem + 0.4vw, 1.38rem);
  --step-2: clamp(1.6rem, 1.3rem + 1.4vw, 2.6rem);
  --step-3: clamp(2.2rem, 1.5rem + 3.4vw, 4.6rem);

  --gutter: clamp(1rem, 4vw, 3rem);
  --max: clamp(64rem, 75vw, 90rem);
  --measure: 40rem;
  --space-section: clamp(3.5rem, 2rem + 6vw, 8rem);
  --radius: 8px;
  --radius-control: 4px;
  --fade: 180ms ease-out;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--tl-bg-base);
  color: var(--tl-text-primary);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

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

img {
  height: auto;
}

h1,
h2,
h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a {
  color: var(--tl-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--fade);
}

a:hover {
  color: var(--tl-accent-hover);
}

/* The app's dual focus ring: the outer ring in focus_ring, an inner stroke in the ground. */
:focus-visible {
  outline: 2px solid var(--tl-focus-ring);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--tl-bg-base);
  border-radius: var(--radius-control);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--tl-bg-elevated);
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius-control);
}

.skip:focus {
  top: 0.75rem;
}

.wrap {
  width: min(100% - 2 * var(--gutter), var(--max));
  margin-inline: auto;
}

.wrap.narrow {
  width: min(100% - 2 * var(--gutter), 48rem);
}

/* ---- Header ---------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--tl-bg-base);
  border-bottom: 1px solid var(--tl-border-subtle);
}

.bar {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 2rem);
  min-height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--tl-text-primary);
  text-decoration: none;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: var(--step-1);
  letter-spacing: -0.01em;
}

.brand:hover {
  color: var(--tl-text-primary);
}

.brand.small {
  font-size: var(--step-0);
}

.site-nav {
  display: none;
  gap: clamp(1rem, 2vw, 2rem);
  margin-left: auto;
  font-size: var(--step--1);
}

.site-nav a {
  color: var(--tl-text-secondary);
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--tl-text-primary);
}

@media (min-width: 52rem) {
  .site-nav {
    display: flex;
  }
}

.theme-switch {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius-control);
  background: var(--tl-bg-surface);
  padding: 2px;
  gap: 2px;
}

.theme-switch[hidden] {
  display: none;
}

.site-nav + .theme-switch {
  margin-left: 0;
}

@media (max-width: 51.99rem) {
  .site-nav + .theme-switch {
    margin-left: auto;
  }
}

.theme-switch button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.25rem;
  min-width: 2.25rem;
  justify-content: center;
  padding: 0 0.55rem;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--tl-text-secondary);
  font: inherit;
  font-size: var(--step--1);
  cursor: pointer;
  transition: background-color var(--fade), color var(--fade);
}

.theme-switch button:hover {
  color: var(--tl-text-primary);
}

/* The current choice is a selection, so it takes the accent (accent rationing). */
.theme-switch button[aria-pressed='true'] {
  background: var(--tl-accent);
  color: var(--tl-on-accent);
}

.theme-switch svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-switch .label {
  display: none;
}

@media (min-width: 72rem) {
  .theme-switch .label {
    display: inline;
  }
}

/* ---- Shared section parts --------------------------------------------------------------- */

.section {
  padding-block: var(--space-section);
  border-top: 1px solid var(--tl-border-subtle);
}

.section.alt {
  background: var(--tl-bg-surface);
}

.section-head {
  max-width: var(--measure);
  margin-bottom: clamp(2rem, 4vw, 3.5rem);
}

/* Small caps over a hairline rule, as the app's section headers are. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--tl-border-subtle);
  color: var(--tl-text-secondary);
  font-size: var(--step--1);
  font-variant: all-small-caps;
  letter-spacing: 0.09em;
  font-weight: 600;
}

h2 {
  font-size: var(--step-2);
  margin-bottom: 1rem;
}

.lede {
  color: var(--tl-text-secondary);
  font-size: var(--step-1);
  line-height: 1.55;
  max-width: var(--measure);
}

/* A screenshot: a hairline frame on the elevated layer. */
.frame {
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tl-bg-elevated);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.06), 0 12px 32px -12px rgb(0 0 0 / 0.22);
}

.frame img {
  width: 100%;
  aspect-ratio: 16 / 10;
}

/* Each theme-paired screenshot shows only in its own theme. */
.shot-dark {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .shot-dark {
    display: block;
  }
  :root:not([data-theme='light']) .shot-light {
    display: none;
  }
}

:root[data-theme='dark'] .shot-dark {
  display: block;
}

:root[data-theme='dark'] .shot-light {
  display: none;
}

/* ---- Hero ---------------------------------------------------------------------------- */

.hero {
  padding-block: clamp(2.5rem, 1rem + 6vw, 7rem) var(--space-section);
  text-align: center;
}

.hero .eyebrow {
  display: inline-flex;
  border-bottom: 0;
  padding-bottom: 0;
}

.hero h1 {
  font-size: var(--step-3);
  max-width: 18ch;
  margin: 0 auto 1.25rem;
  letter-spacing: -0.02em;
}

.hero .lede {
  margin-inline: auto;
}

/* The now-playing pulse: opacity 0.6 to 1.0 over 2.4 s, a calm breath, never an equaliser. */
.pulse {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--tl-playing-indicator);
  opacity: 0.8;
}

@media (prefers-reduced-motion: no-preference) {
  .pulse {
    animation: breathe 2.4s ease-in-out infinite alternate;
  }
}

@keyframes breathe {
  from {
    opacity: 0.6;
  }
  to {
    opacity: 1;
  }
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  margin: clamp(1.75rem, 3vw, 2.5rem) 0 clamp(2.5rem, 5vw, 4.5rem);
}

/* Not a link and not a button: there is nothing to get yet. */
.store-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1.25rem 0.65rem 1rem;
  border-radius: var(--radius);
  background: var(--tl-text-primary);
  color: var(--tl-bg-base);
  text-align: left;
  line-height: 1.2;
  cursor: default;
}

.store-badge svg {
  width: 1.6rem;
  height: 1.6rem;
  fill: currentColor;
  flex: none;
}

.store-badge small {
  display: block;
  font-size: 0.75rem;
  opacity: 0.85;
}

.store-badge strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 600;
}

.cta-note {
  color: var(--tl-text-secondary);
  font-size: var(--step--1);
}

/* ---- Library ------------------------------------------------------------------------------ */

.formats {
  margin-bottom: clamp(2rem, 4vw, 3rem);
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius);
  background: var(--tl-bg-surface);
}

.formats h3 {
  font-size: var(--step-1);
  margin-bottom: 1rem;
}

.formats p {
  color: var(--tl-text-secondary);
  max-width: 52rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}

.chips li {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius-control);
  background: var(--tl-bg-base);
  font-variant-numeric: tabular-nums;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Card grids: as many columns as fit at 16rem or more, but never more than --cols, so a
   grid of six reads 3 + 3 and a grid of eight 4 + 4 on wide screens, never 5 + 1. */
.cards,
.themes {
  --cols: 3;
  --gap: clamp(0.75rem, 1.5vw, 1.25rem);
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(100%, max(16rem, (100% - (var(--cols) - 1) * var(--gap)) / var(--cols))), 1fr)
  );
  gap: var(--gap);
}

.cards.span {
  --cols: 4;
}

.card {
  padding: clamp(1.1rem, 2vw, 1.5rem);
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius);
  background: var(--tl-bg-surface);
}

.section.alt .card {
  background: var(--tl-bg-base);
}

.card h3 {
  font-size: var(--step-1);
  margin-bottom: 0.45rem;
}

.card p {
  color: var(--tl-text-secondary);
}

/* ---- Split sections: text beside a screenshot on wide screens --------------------------- */

.split {
  display: grid;
  gap: clamp(2rem, 4vw, 3.5rem) clamp(2rem, 5vw, 5rem);
  align-items: center;
}

.split .section-head {
  margin-bottom: 0;
}

@media (min-width: 64rem) {
  .split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
  .split.reverse {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
  .split.reverse .frame {
    order: -1;
  }
  .split .cards.span {
    grid-column: 1 / -1;
  }
}

.ticks {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.85rem;
}

.ticks li {
  position: relative;
  padding-left: 1.6rem;
}

.ticks li::before {
  content: '';
  position: absolute;
  left: 0.15rem;
  top: 0.55em;
  width: 0.7rem;
  height: 0.38rem;
  border-left: 2px solid var(--tl-text-secondary);
  border-bottom: 2px solid var(--tl-text-secondary);
  transform: rotate(-45deg);
}

/* ---- Themes: each card wears its own theme's tokens -------------------------------------- */

.theme-card {
  padding: clamp(0.75rem, 1.5vw, 1rem) clamp(0.75rem, 1.5vw, 1rem) clamp(1.1rem, 2vw, 1.4rem);
  border: 1px solid var(--tl-border-subtle);
  border-radius: var(--radius);
  background: var(--tl-bg-base);
  color: var(--tl-text-primary);
}

.theme-card .frame {
  margin-bottom: 1rem;
  box-shadow: none;
}

.theme-card h3 {
  font-size: var(--step-1);
  margin: 0 0.25rem 0.3rem;
}

.theme-card p {
  margin: 0 0.25rem;
  color: var(--tl-text-secondary);
  font-size: var(--step--1);
}

.theme-card .shot {
  display: block;
}

.theme-card.comfort {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: transparent;
}

.theme-card.comfort p {
  font-size: var(--step-0);
}

.theme-card.comfort h3 {
  margin-bottom: 0.6rem;
}

/* ---- Platforms -------------------------------------------------------------------------- */

.platforms li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--tl-border-subtle);
}

.platforms li:first-child {
  border-top: 1px solid var(--tl-border-subtle);
}

.platforms .name {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  font-weight: 600;
}

.platforms .status {
  color: var(--tl-text-primary);
  font-size: var(--step--1);
  font-variant: all-small-caps;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.platforms .status.later {
  color: var(--tl-text-secondary);
}

/* ---- Contact and footer ----------------------------------------------------------------- */

.contact {
  text-align: center;
}

.contact .eyebrow {
  justify-content: center;
}

.contact .lede {
  margin-inline: auto;
}

.mail {
  margin-top: 1.5rem;
  font-family: var(--font-serif);
  font-size: var(--step-2);
  font-weight: 600;
}

.site-footer {
  border-top: 1px solid var(--tl-border-subtle);
  padding-block: clamp(2rem, 4vw, 3rem);
  font-size: var(--step--1);
  color: var(--tl-text-secondary);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 2rem;
}

.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
}

.foot .legal {
  flex-basis: 100%;
}

@media (min-width: 52rem) {
  .foot .legal {
    flex-basis: auto;
    margin-left: auto;
  }
}

/* ---- Plain pages: privacy, terms, support, 404 ----------------------------------------- */

.page {
  padding-block: clamp(2.5rem, 1rem + 6vw, 6rem) var(--space-section);
  min-height: 60vh;
}

.page h1 {
  font-size: var(--step-2);
  margin-bottom: 1.25rem;
}

.page p + p {
  margin-top: 1rem;
}

.page .lede {
  margin-bottom: 1.5rem;
}

.notice {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--tl-border-subtle);
  border-left: 3px solid var(--tl-warning);
  border-radius: var(--radius);
  background: var(--tl-bg-surface);
}

.notice svg {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  margin-top: 0.15rem;
  fill: none;
  stroke: var(--tl-warning);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notice strong {
  color: var(--tl-text-primary);
}

/* ---- Reduced motion: still, everywhere. --------------------------------------------------- */

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