/* Teacup Hill Studios: one stylesheet, no JavaScript, no external requests. */

@layer reset, tokens, base, layout, components;

@font-face {
  font-family: "Fraunces";
  src: url("/assets/fonts/Fraunces-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@layer tokens {
  :root {
    /* Tier 1: studio palette */
    --sky: #cfe6f2;
    --hill: #6ba368;
    --hill-dark: #4e8a4c;
    --deep-green: #2f5d3a;
    --roof-red: #c8553d;
    --window-yellow: #f4c95d;
    --cream: #fff8e7;
    --ground: #f6faf4;

    /* Tier 2: semantic tokens (light) */
    --bg: var(--ground);
    --surface: #ffffff;
    --surface-soft: #e6f2e1;
    --border: #bcd4b8;
    --text: #22392a;
    --text-muted: #45604d;
    --heading: var(--deep-green);
    --link: var(--deep-green);
    --link-hover: #1b3d26;
    --accent: #a8402b; /* darkened roof red, text-safe */
    --focus: var(--deep-green);
    --hero-sky: var(--sky);
    --hero-hill: var(--hill);
    --pill-bg: var(--cream);
    --pill-text: #5b4300;
    --pill-border: #d9a935;
    --btn-bg: var(--deep-green);
    --btn-text: var(--cream);
    --btn-hover-bg: #1f4429;
    --shadow: 0 0.5rem 1.5rem rgb(47 93 58 / 0.18);

    /* Fonts */
    --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body:
      system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
      sans-serif;

    color-scheme: light dark;
  }

  /* The hill at night. Plain media query: works everywhere. */
  @media (prefers-color-scheme: dark) {
    :root {
      --bg: #0e1b22;
      --surface: #16282f;
      --surface-soft: #1a3328;
      --border: #345059;
      --text: #fff8e7;
      --text-muted: #c3d2cb;
      --heading: #fff8e7;
      --link: var(--window-yellow);
      --link-hover: #ffe19a;
      --accent: #f4a38f;
      --focus: var(--window-yellow);
      --hero-sky: #1b3a4d;
      --hero-hill: #2c5a3f;
      --pill-bg: #2a2a1c;
      --pill-text: #f4c95d;
      --pill-border: #8a7230;
      --btn-bg: var(--window-yellow);
      --btn-text: #1b2a14;
      --btn-hover-bg: #ffe19a;
      --shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.5);
    }
  }
}

@layer reset {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  body,
  h1,
  h2,
  h3,
  p,
  ul,
  ol,
  figure,
  dl,
  dd {
    margin: 0;
  }
  ul,
  ol {
    padding: 0;
  }
  img {
    display: block;
    max-inline-size: 100%;
    block-size: auto;
  }
}

@layer base {
  html {
    background: var(--bg);
    accent-color: var(--hill-dark);
    scroll-padding-block-start: 1rem;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.6;
    min-block-size: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-wrap: break-word;
  }

  main {
    flex: 1 0 auto;
  }

  h1,
  h2,
  h3 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size-adjust: from-font;
    color: var(--heading);
    line-height: 1.2;
    text-wrap: balance;
  }

  h1 {
    font-size: clamp(2rem, 1.3rem + 3.2vw, 3.25rem);
  }

  h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.0625rem);
    margin-block: 2.5rem 0.75rem;
  }

  h3 {
    font-size: 1.25rem;
    margin-block: 1.5rem 0.5rem;
  }

  p {
    text-wrap: pretty;
  }

  p + p,
  p + ul,
  ul + p {
    margin-block-start: 1rem;
  }

  a {
    color: var(--link);
    text-decoration-thickness: 0.08em;
    text-underline-offset: 0.2em;
  }

  a:hover {
    color: var(--link-hover);
    text-decoration-thickness: 0.14em;
  }

  :where(a, summary, [tabindex="0"]):focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 0.25rem;
  }

  ::selection {
    background: var(--window-yellow);
    color: #1b2a14;
  }
}

@layer layout {
  .wrap {
    inline-size: min(100% - 2rem, 70rem);
    margin-inline: auto;
  }

  .prose {
    max-inline-size: 65ch;
  }

  .prose ul {
    padding-inline-start: 1.25rem;
  }

  .prose li + li {
    margin-block-start: 0.4rem;
  }

  .page {
    padding-block: 2.5rem 4rem;
  }

  .page > h1 {
    margin-block-end: 0.5rem;
  }

  /* Skip link */
  .skip-link {
    position: absolute;
    inset-block-start: 0.5rem;
    inset-inline-start: 0.5rem;
    z-index: 10;
    padding: 0.6rem 1rem;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    transform: translateY(-300%);
  }

  .skip-link:focus {
    transform: none;
    color: var(--btn-text);
  }

  /* Header */
  .site-header {
    padding-block: 0.75rem;
  }

  .site-header .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1rem;
  }

  .wordmark {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--heading);
    text-decoration: none;
    padding-block: 0.25rem;
  }

  .wordmark:hover {
    color: var(--heading);
  }

  .wordmark img {
    inline-size: 2.75rem;
    block-size: 2.75rem;
  }

  .wordmark-text {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
  }

  .wordmark-name {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size-adjust: from-font;
    font-size: 1.375rem;
    line-height: 1;
  }

  .wordmark-sub {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    line-height: 1;
  }

  .site-nav ul,
  .footer-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0 0.25rem;
  }

  .site-nav a {
    display: inline-block;
    padding: 0.55rem 0.7rem;
    min-block-size: 2.75rem;
    line-height: 1.6;
    text-decoration: none;
    font-weight: 500;
    border-radius: 0.75rem;
  }

  .site-nav a:hover {
    text-decoration: underline;
  }

  .site-nav a[aria-current="page"],
  .wordmark[aria-current="page"] .wordmark-name {
    font-weight: 700;
  }

  .site-nav a[aria-current="page"] {
    text-decoration: underline;
    text-decoration-thickness: 0.15em;
    text-underline-offset: 0.3em;
  }

  /* Footer */
  .site-footer {
    background: var(--surface-soft);
    border-block-start: 1px solid var(--border);
    padding-block: 2rem;
    font-size: 0.9375rem;
    color: var(--text);
  }

  .site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem 2rem;
  }

  .footer-nav ul {
    gap: 0.25rem 1.25rem;
  }

  .footer-nav a {
    display: inline-block;
    padding-block: 0.4rem;
  }
}

@layer components {
  /* Hero with CSS-only hill */
  .hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: linear-gradient(var(--hero-sky), var(--bg));
    padding-block: 2.5rem 7rem;
  }

  .hero::before,
  .hero::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset-inline: -25%;
    border-radius: 50% 50% 0 0;
  }

  .hero::before {
    inset-block-end: -3.5rem;
    block-size: 8rem;
    background: var(--hero-hill);
    translate: 8% 0;
  }

  .hero::after {
    inset-block-end: -5rem;
    block-size: 8rem;
    background: var(--bg);
    translate: -6% 0;
  }

  .hero-grid {
    display: grid;
    gap: 2rem;
    align-items: center;
  }

  .hero h1 {
    margin-block-end: 0.75rem;
  }

  .tagline {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size-adjust: from-font;
    font-size: clamp(1.25rem, 1.1rem + 0.8vw, 1.625rem);
    color: var(--accent);
    margin-block-end: 1rem;
  }

  .lead {
    font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
    max-inline-size: 42ch;
  }

  .hero-mark {
    inline-size: clamp(6rem, 25vw, 9rem);
    block-size: auto;
    margin-block-end: 1.25rem;
  }

  .app-icon {
    inline-size: clamp(6rem, 22vw, 8rem);
    block-size: auto;
    aspect-ratio: 1;
    border-radius: 22%;
    box-shadow: var(--shadow);
    margin-block-end: 1.25rem;
  }

  .pill {
    display: inline-block;
    margin-block-start: 1.25rem;
    padding: 0.4rem 1rem;
    background: var(--pill-bg);
    color: var(--pill-text);
    border: 2px solid var(--pill-border);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9375rem;
  }

  .shot {
    border-radius: 1rem;
    box-shadow: var(--shadow);
    background: var(--surface-soft);
    aspect-ratio: 1280 / 589;
    inline-size: 100%;
    block-size: auto;
  }

  /* Sections */
  .section {
    padding-block: 1rem;
  }

  .section > h2:first-child {
    margin-block-start: 1.5rem;
  }

  /* Cards */
  .card-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
    gap: 1.25rem;
  }

  .card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
  }

  .card .app-icon {
    inline-size: 5rem;
    margin-block-end: 0.5rem;
  }

  .card h3 {
    margin: 0;
  }

  .card .card-sub {
    color: var(--accent);
    font-weight: 600;
  }

  .card .card-link {
    margin-block-start: auto;
    padding-block-start: 0.5rem;
  }

  .quiet {
    margin-block-start: 1.25rem;
    color: var(--text-muted);
  }

  /* Buttons (links) */
  .button {
    display: inline-block;
    padding: 0.7rem 1.25rem;
    background: var(--btn-bg);
    color: var(--btn-text);
    border-radius: 999px;
    font-weight: 600;
    text-decoration: none;
  }

  .button:hover {
    background: var(--btn-hover-bg);
    color: var(--btn-text);
  }

  /* Screenshot strip */
  .strip {
    list-style: none;
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    padding: 0.5rem 0.25rem 1rem;
    scrollbar-color: var(--hill-dark) var(--surface-soft);
    scrollbar-width: thin;
  }

  .strip li {
    flex: 0 0 min(82%, 22rem);
    scroll-snap-align: start;
  }

  .strip figcaption {
    margin-block-start: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-muted);
  }

  /* Game groups */
  .group-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
    gap: 1rem;
  }

  .group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1.25rem;
    padding: 1.1rem 1.25rem;
  }

  .group h3 {
    margin: 0 0 0.35rem;
    font-size: 1.125rem;
  }

  .group ul {
    list-style: none;
  }

  /* Reassurance panel */
  .safe {
    background: var(--surface-soft);
    border: 2px solid var(--hill-dark);
    border-radius: 1.75rem;
    padding: clamp(1.25rem, 4vw, 2.25rem);
    margin-block: 2.5rem 1rem;
  }

  .safe > h2 {
    margin-block-start: 0;
  }

  .safe ul {
    list-style: none;
    display: grid;
    gap: 0.5rem;
    margin-block: 1rem;
  }

  .safe li {
    padding-inline-start: 1.75rem;
    position: relative;
    font-weight: 600;
  }

  .safe li::before {
    content: "";
    position: absolute;
    inset-inline-start: 0.2rem;
    inset-block-start: 0.35em;
    inline-size: 0.5rem;
    block-size: 0.9rem;
    border: solid var(--hill-dark);
    border-width: 0 3px 3px 0;
    rotate: 40deg;
  }

  /* Boxes */
  .box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-inline-start: 6px solid var(--hill-dark);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    margin-block: 1.25rem;
  }

  .toc {
    background: var(--surface-soft);
    border-radius: 1rem;
    padding: 1rem 1.25rem;
    margin-block: 1.5rem;
  }

  .toc-label {
    font-weight: 700;
  }

  .toc ol {
    padding-inline-start: 1.25rem;
    margin-block-start: 0.4rem;
  }

  .meta {
    color: var(--text-muted);
  }

  /* FAQ */
  .faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 0 1.25rem;
  }

  .faq details + details {
    margin-block-start: 0.75rem;
  }

  .faq summary {
    cursor: pointer;
    font-weight: 700;
    padding-block: 0.9rem;
    color: var(--heading);
  }

  .faq details[open] summary {
    border-block-end: 1px solid var(--border);
    margin-block-end: 0.75rem;
  }

  .faq details > :not(summary) {
    padding-block-end: 1rem;
  }

  .faq details > p:last-child {
    padding-block-end: 1rem;
  }

  /* Wide screens */
  @media (min-width: 52rem) {
    .hero {
      padding-block: 4rem 9rem;
    }

    .hero-grid {
      grid-template-columns: 1fr 1.15fr;
      gap: 3rem;
    }

    .hero::before,
    .hero::after {
      block-size: 11rem;
    }

    .hero::before {
      inset-block-end: -5.5rem;
    }

    .hero::after {
      inset-block-end: -7.5rem;
    }

    .strip li {
      flex-basis: min(46%, 34rem);
    }
  }

  @media (pointer: coarse) {
    .footer-nav a {
      padding-block: 0.6rem;
    }
  }

  /* Forced colours: make sure shapes keep their edges */
  @media (forced-colors: active) {
    .card,
    .group,
    .safe,
    .box,
    .pill,
    .faq details {
      border-color: CanvasText;
    }

    .safe li::before {
      border-color: CanvasText;
    }

    .hero::before,
    .hero::after {
      display: none;
    }
  }

  @media print {
    .skip-link,
    .hero::before,
    .hero::after {
      display: none;
    }
  }
}
