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

/* ==========================================================================
   Fonts
   ========================================================================== */

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("fonts/open-sans-v44-latin-500.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("fonts/open-sans-v44-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("fonts/open-sans-v44-latin-800.woff2") format("woff2");
}

/* ==========================================================================
   Reset
   ========================================================================== */

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

  body, h1, h2, h3, p, ul { margin: 0; }

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

  img, svg { display: block; max-inline-size: 100%; }
  img { block-size: auto; }

  button { font: inherit; }

  a { -webkit-touch-callout: none; }
}

/* ==========================================================================
   Tokens
   ========================================================================== */

@layer tokens {
  :root {
    color-scheme: light dark;

    /* Typography */
    --font: "Open Sans", system-ui, sans-serif;
    --text-body: clamp(1rem, 0.9rem + 0.5vw, 1.25rem);
    --text-h1: clamp(1.953rem, 1.2rem + 3.6vw, 3.052rem);
    --text-h2: 1.563rem;
    --text-small: 0.8125rem;

    /* Spacing */
    --space-xs: 0.5rem;
    --space-s: 1rem;
    --space-m: 1.5rem;
    --space-l: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;
    --radius: 0.5rem;

    /* Colors */
    --bg: light-dark(#f2f2f2, #121212);
    --text: light-dark(#212121, #f1f1f1);
    --link: light-dark(#2457f5, #4899f7);
    --link-hover: light-dark(#1a3fb8, #7ab8ff);
    --accent: #6230ea;
  }

  /* Manual theme overrides */
  :root.theme-light { color-scheme: light; }
  :root.theme-dark  { color-scheme: dark; }
}

/* ==========================================================================
   Base
   ========================================================================== */

@layer base {
  body {
    min-block-size: 100dvh;
    background: var(--bg);
    color: var(--text);
    font: 500 var(--text-body) / 1.6 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  h1 {
    font-size: var(--text-h1);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    text-wrap: balance;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  h2, h3 {
    font-size: var(--text-h2);
    font-weight: 700;
    text-wrap: balance;
  }
  h3 { margin-block: var(--space-l) var(--space-s); }

  p { text-wrap: pretty; }

  a {
    color: var(--link);
    text-decoration: none;
    &:hover { color: var(--link-hover); }
  }

  :focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
  }
}

/* ==========================================================================
   Components
   ========================================================================== */

@layer components {

  /* ---- Layout ---- */

  .container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xl);
    max-inline-size: 37.5rem;
    margin-inline: auto;
    padding: var(--space-m) var(--space-m) 0;
    text-align: center;
  }

  .hero,
  .options,
  .feature {
    display: grid;
    justify-items: center;
    gap: var(--space-m);
  }

  .hero {
    align-content: start;
    min-block-size: calc(100vh - var(--space-m)); /* fallback */
    min-block-size: calc(100svh - var(--space-m));
  }

  .options {
    inline-size: 100%;
    gap: var(--space-l);
  }
  .hero .options { margin-block-start: var(--space-m); }

  /* ---- Avatar ---- */

  .avatar {
    inline-size: 305px;
    max-inline-size: 100%;
    block-size: auto;
  }
  @media (min-width: 768px)  { .avatar { inline-size: 350px; } }
  @media (min-width: 1200px) { .avatar { inline-size: 400px; } }

  /* ---- Buttons ---- */

  .button-stack {
    inline-size: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-s);
    margin-block-start: var(--space-xs);
  }

  .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    inline-size: min(100%, 19.75rem);
    min-block-size: 3.3rem;
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
    font-weight: 700;
    line-height: 1.7;
    color: #fff;
    background: var(--accent);
    border: 1px solid #fff;
    border-radius: var(--radius);
    cursor: pointer;
    &:hover { color: #fff; filter: brightness(1.1); }
  }

  .icon {
    inline-size: 1.5rem;
    block-size: 1.5rem;
    flex-shrink: 0;
  }

  /* ---- Inline notes (icon + text) ---- */

  .age-note,
  .energy-note,
  .cam-note {
    display: inline-flex;
    align-items: center;
  }

  .age-note,
  .energy-note { gap: var(--space-xs); }

  .age-note svg {
    inline-size: 2.2rem;
    block-size: 2.2rem;
    color: var(--text);
  }

  .energy-note svg {
    inline-size: 1.5rem;
    block-size: 1.5rem;
    flex-shrink: 0;
  }

.cam-note {
  vertical-align: middle;
  margin-inline-start: var(--space-xs);

  & svg {
    inline-size: 1.6rem;
    block-size: 1.6rem;
    flex-shrink: 0;
    color: var(--text);
  }
}

  /* ---- Features ---- */

  .features {
    display: grid;
    gap: var(--space-xl);
    margin-block-start: var(--space-xl);
  }

  .feature-icon {
    inline-size: 65px;
    block-size: 65px;
    object-fit: contain;
  }

  /* ---- Rating ---- */

  .rating {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 10px;
    block-size: 42px;
    margin-block-start: 30px;

    & img { inline-size: 35px; block-size: 35px; }
    & .trophy {
      inline-size: 60px;
      block-size: 60px;
      translate: 0 -3px;
    }
  }

  /* ---- Social proof ---- */

  .social-stack {
    display: flex;
    justify-content: center;

    & li + li { margin-inline-start: -14px; }

    & a {
      position: relative;
      display: block;
      inline-size: 52px;
      block-size: 52px;
      overflow: hidden;
      border: 3px solid var(--bg);
      border-radius: 50%;
      box-shadow: 0 2px 6px rgb(0 0 0 / 0.15);
    }

    & img {
      inline-size: 100%;
      block-size: 100%;
      object-fit: cover;
    }
  }

  /* ---- About ---- */

  .about {
    display: grid;
    gap: 1.3em;
    font-size: var(--text-small);
    line-height: 1.4;
  }

  .mission-icon {
    inline-size: 3.5rem;
    block-size: 3.5rem;
    margin-inline: auto;
  }

  .site-title,
  .sub-title {
    display: block;
    font-size: 0.86rem;
    font-weight: 700;
  }

  /* ---- Play link ---- */

  .play-link {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-block-end: 3rem;
    font-size: var(--text-h2);
    font-weight: 700;
    text-decoration: underline;
    text-decoration-thickness: 2.5px;
    text-underline-offset: 3px;

    & img { inline-size: 1.65em; block-size: 1.65em; }
  }

  /* ---- Footer ---- */

  footer {
    margin-block-end: var(--space-2xl);
    font-size: var(--text-small);
    line-height: 1.3;

    & ul {
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: var(--space-xs) var(--space-m);
    }
  }

  /* ---- SVG sprite (visually hidden) ---- */

  .sprite {
    position: absolute;
    inline-size: 0;
    block-size: 0;
    overflow: hidden;
  }
}

/* ==========================================================================
   Motion
   ========================================================================== */

@layer motion {
  @media (prefers-reduced-motion: no-preference) {
    .button,
    .social-stack a {
      transition: translate 0.15s ease, filter 0.15s ease;
    }
    .button:hover { translate: 0 -1px; }
    .button:active { translate: 0; }
    .social-stack a:hover { translate: 0 -6px; z-index: 5; }
  }
}
