/* ==========================================================================
   YOUBEI / TOUCHLINE — base.css
   Layer 1 of 4: reset + design tokens + typography + atoms
   Design system: 边线战术板 (pitch markings, chalk hairlines, ticket stubs)
   ========================================================================== */

@layer reset, tokens, base, util;

/* --------------------------------------------------------------------------
   tokens
   -------------------------------------------------------------------------- */
@layer tokens {
  :root {
    --turf-950: #06211a;
    --turf-900: #0a2f22;
    --turf-800: #0f4231;
    --turf-700: #155a41;
    --turf-600: #1d7353;
    --turf-500: #2c8f68;

    --chalk: #eef3e4;
    --chalk-2: #c2d2c1;
    --chalk-3: #8da593;

    --paper: #f3efe2;
    --paper-2: #e8e1cd;
    --paper-3: #dcd3ba;

    --ink: #101a10;
    --ink-2: #3b4a38;

    --flag: #e14b2d;
    --flag-soft: #f6d9cf;
    --ref: #ffd451;
    --ref-soft: #f7ecc4;
    --mint: #8ef0c8;

    --hair: rgba(16, 26, 16, 0.16);
    --hair-strong: rgba(16, 26, 16, 0.42);
    --hair-chalk: rgba(238, 243, 228, 0.28);

    --font-sans: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
    --font-mono: "Consolas", "SFMono-Regular", "Cascadia Mono", "Courier New", monospace;

    --wrap: 1200px;
    --gutter: 22px;
    --head-h: 78px;

    --step-0: 0.94rem;
    --step-1: 1.06rem;
    --step-2: 1.28rem;
    --step-3: 1.72rem;
    --step-4: clamp(2.1rem, 4vw, 3.1rem);
    --step-5: clamp(2.6rem, 6vw, 4.6rem);
  }
}

/* --------------------------------------------------------------------------
   reset
   -------------------------------------------------------------------------- */
@layer reset {
  *,
  *::before,
  *::after { box-sizing: border-box; }

  html { -webkit-text-size-adjust: 100%; }

  body,
  h1, h2, h3, h4, h5,
  p, figure, blockquote, dl, dd, ul, ol { margin: 0; }

  ul, ol { padding: 0; list-style: none; }

  a { color: inherit; text-decoration: none; }

  button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

  img, svg { display: block; max-width: 100%; }

  table { border-collapse: collapse; width: 100%; }

  details > summary { list-style: none; cursor: pointer; }
  details > summary::-webkit-details-marker { display: none; }
}

/* --------------------------------------------------------------------------
   base
   -------------------------------------------------------------------------- */
@layer base {
  html { scroll-behavior: smooth; }

  body {
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: var(--step-0);
    line-height: 1.78;
    letter-spacing: 0.01em;
    overflow-x: hidden;
  }

  ::selection { background: var(--ref); color: var(--ink); }

  h1, h2, h3, h4 {
    font-weight: 800;
    line-height: 1.24;
    letter-spacing: -0.015em;
  }

  h1 { font-size: var(--step-5); }
  h2 { font-size: var(--step-4); }
  h3 { font-size: var(--step-2); }
  h4 { font-size: var(--step-1); }

  p { color: var(--ink-2); }

  strong { font-weight: 800; color: var(--ink); }

  em { font-style: normal; }

  small { font-size: 0.78em; }

  a:focus-visible,
  button:focus-visible,
  summary:focus-visible {
    outline: 3px solid var(--flag);
    outline-offset: 3px;
  }
}

/* --------------------------------------------------------------------------
   util / atoms
   -------------------------------------------------------------------------- */
@layer util {
  .yb-wrap {
    width: min(var(--wrap), calc(100% - var(--gutter) * 2));
    margin-inline: auto;
  }

  .yb-skip {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 90;
    padding: 10px 16px;
    background: var(--ink);
    color: var(--chalk);
    font-weight: 700;
    transition: top 0.2s ease;
  }
  .yb-skip:focus { top: 12px; }

  .yb-mono {
    font-family: var(--font-mono);
    font-feature-settings: "tnum" 1;
    letter-spacing: 0.06em;
  }

  .yb-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--turf-700);
  }
  .yb-eyebrow::before {
    content: "";
    width: 26px;
    height: 2px;
    background: var(--flag);
  }

  .yb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 46px;
    padding: 11px 24px;
    border: 2px solid var(--ink);
    background: transparent;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    transition: transform 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
  }
  .yb-btn::after {
    content: "→";
    font-family: var(--font-mono);
    font-size: 0.95em;
    line-height: 1;
  }
  .yb-btn:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--ref);
  }
  .yb-btn--solid {
    background: var(--turf-900);
    border-color: var(--turf-900);
    color: var(--chalk);
  }
  .yb-btn--solid:hover { box-shadow: 4px 4px 0 var(--flag); }
  .yb-btn--flag {
    background: var(--flag);
    border-color: var(--flag);
    color: #fff8f2;
  }
  .yb-btn--ghost {
    border-color: var(--chalk);
    color: var(--chalk);
  }
  .yb-btn--ghost:hover { background: var(--chalk); color: var(--ink); box-shadow: 4px 4px 0 var(--ref); }
  .yb-btn--sm { min-height: 38px; padding: 7px 16px; font-size: 0.82rem; }
  .yb-btn--plain::after { display: none; }

  .yb-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--hair-strong);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-2);
    white-space: nowrap;
  }
  .yb-chip--live { border-color: var(--flag); color: var(--flag); }
  .yb-chip--live::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--flag);
    animation: yb-blink 1.6s steps(2, end) infinite;
  }
  .yb-chip--ref { background: var(--ref); border-color: var(--ref); color: var(--ink); }
  .yb-chip--flag { background: var(--flag); border-color: var(--flag); color: #fff8f2; }
  .yb-chip--quiet { background: rgba(16, 26, 16, 0.06); border-color: transparent; color: var(--ink-2); }

  .yb-rule {
    height: 2px;
    border: 0;
    background: var(--ink);
    opacity: 0.9;
  }

  .yb-hl {
    background: linear-gradient(transparent 62%, var(--ref) 62%, var(--ref) 94%, transparent 94%);
    padding-inline: 2px;
  }

  .yb-note {
    border-left: 3px solid var(--flag);
    background: rgba(225, 75, 45, 0.07);
    padding: 14px 18px;
    font-size: 0.88rem;
    color: var(--ink-2);
  }
  .yb-note strong { color: var(--flag); }

  .yb-list {
    display: grid;
    gap: 9px;
    font-size: 0.9rem;
    color: var(--ink-2);
  }
  .yb-list li {
    position: relative;
    padding-left: 20px;
  }
  .yb-list li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.66em;
    width: 8px;
    height: 8px;
    border: 2px solid var(--turf-700);
    border-radius: 50%;
  }
  .yb-list--chalk { color: var(--chalk-2); }
  .yb-list--chalk li::before { border-color: var(--ref); }

  .yb-form__status {
    display: none;
    padding: 12px 14px;
    border: 1px dashed var(--hair-strong);
    background: var(--ref-soft);
    font-size: 0.82rem;
    color: var(--ink);
  }
  .yb-form__status.is-on { display: block; }

  [data-yb-reveal] {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.5s ease, transform 0.5s ease;
  }
  [data-yb-reveal].is-in {
    opacity: 1;
    transform: none;
  }

  @keyframes yb-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *,
    *::before,
    *::after {
      animation-duration: 0.001ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.001ms !important;
    }
  }
}
