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

/* ==========================================================================
   DECKHAND · Triton 传奇黑金设计令牌 (Single Source of Truth)
   Demo (index.html) 与组件规范枚举中心 (specs.html) 共同引用本文件
   ========================================================================== */

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

    /* Tier 1: Core Palette */
    --dh-bg-canvas: #080a0e;
    --dh-bg-radial: #101522;
    --dh-surface-lowest: #090c12;
    --dh-surface-dock: rgba(11, 14, 20, 0.98);
    --dh-surface-dock-muted: rgba(11, 14, 20, 0.82);
    --dh-surface-trough: #090d14;
    --dh-surface-card: #0e121a;
    --dh-surface-elevated: #141923;
    --dh-surface-high: #1b2230;

    /* Triton Felt & Rail */
    --dh-felt-center: #112239;
    --dh-felt-mid: #0a1423;
    --dh-felt-edge: #050911;
    --dh-rail-outer: #07090e;
    --dh-rail-bevel: #1b212c;

    /* Brand & Semantic Accents */
    --dh-gold: #d4af37;
    --dh-gold-bright: #f3cf7a;
    --dh-gold-soft: #e9c349;
    --dh-gold-pale: #ffe088;
    --dh-gold-dim: #997825;
    --dh-emerald: #1ded7c;
    --dh-emerald-bright: #62ff96;
    --dh-crimson: #e11d48;
    --dh-crimson-bright: #f43f5e;
    --dh-crimson-soft: #fda4af;
    --dh-crimson-pale: #ffe4e6;
    --dh-sky: #60a5fa;

    /* Text & Borders */
    --dh-text-primary: #e2e2e8;
    --dh-text-strong: #ffffff;
    --dh-text-secondary: #dbe5f3;
    --dh-text-muted: #98a5b8;
    --dh-text-subtle: #71849e;
    --dh-text-dim: #52647c;
    --dh-text-on-gold: #0a0d14;

    --dh-border-subtle: #1b2333;
    --dh-border-trough: #1f2d42;
    --dh-border-fold: #1f2735;
    --dh-border-call: #202e47;
    --dh-border-strong: #2d3545;
    --dh-border-gold: rgba(212, 175, 55, 0.4);
    --dh-border-gold-strong: rgba(212, 175, 55, 0.65);

    /* Typography */
    --dh-font-headline: "Space Grotesk", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", sans-serif;
    --dh-font-sans: "Hanken Grotesk", "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
    --dh-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    /* Geometry & Motion */
    --dh-radius-sm: 6px;
    --dh-radius-md: 8px;
    --dh-radius-key: 12px;
    --dh-radius-dock: 16px;
    --dh-radius-pill: 9999px;

    --dh-key-height: 48px;
    --dh-preset-height: 54px;
    --dh-touch-min: 44px;
    --dh-touch-primary: 48px;
    --dh-touch-gap: 8px;
    --dh-seat-touch-pad: 8px;
    --dh-safe-bottom-lift: calc(24px + env(safe-area-inset-bottom, 0px));
    --dh-dock-base-width: 680px;
    --dh-dock-expanded-width: 980px;
    --dh-seat-width: 158px;
    --dh-seat-hero-width: 172px;

    --dh-ease: cubic-bezier(0.4, 0, 0.2, 1);
    --dh-dur-fast: 150ms;
    --dh-dur-mid: 220ms;

    /* Elevation & Metallic Keycap Shadows */
    --dh-shadow-dock:
      0 20px 56px rgba(0, 0, 0, 0.92),
      0 0 28px rgba(212, 175, 55, 0.14),
      inset 0 1px 0 rgba(255, 255, 255, 0.05);
    --dh-shadow-trough: inset 0 2px 6px rgba(0, 0, 0, 0.75);
    --dh-shadow-mech:
      inset 0 1px 0 rgba(255, 255, 255, 0.09),
      inset 0 -1px 0 rgba(0, 0, 0, 0.65),
      0 3px 8px rgba(0, 0, 0, 0.5);
    --dh-shadow-mech-hover:
      inset 0 1px 0 rgba(255, 255, 255, 0.14),
      inset 0 -1px 0 rgba(0, 0, 0, 0.65),
      0 5px 12px rgba(0, 0, 0, 0.58);
    --dh-shadow-mech-active: inset 0 2px 4px rgba(0, 0, 0, 0.78);
  }
}

@layer reset {
  html {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

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

  button, input {
    box-sizing: border-box;
    font: inherit;
    color: inherit;
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

@layer base {
  html {
    scroll-padding-top: calc(68px + env(safe-area-inset-top, 0px));
    scroll-padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px));
  }

  html, body {
    min-height: 100vh;
    background-color: var(--dh-bg-canvas);
    color: var(--dh-text-primary);
    font-family: var(--dh-font-sans);
    overscroll-behavior: none;
  }

  body {
    background-image: radial-gradient(circle at 50% 34%, var(--dh-bg-radial) 0%, var(--dh-bg-canvas) 82%);
  }

  h1, h2, h3 {
    text-wrap: balance;
  }

  p, li {
    text-wrap: pretty;
  }

  :where(button, a, input, summary, [role="tab"], [role="button"]) {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  [tabindex="0"]:focus-visible {
    outline: 2px solid var(--dh-gold-bright);
    outline-offset: 2px;
  }

  code {
    font-family: var(--dh-font-mono);
  }
}
