@layer base, layout, components, motion, responsive;

@layer base {
  :root {
    --bg: #f5efe6;
    --surface: #fffdf9;
    --surface-2: #ebe3d6;
    --glass: rgba(249, 244, 236, 0.86);
    --glass-border: rgba(34, 27, 21, 0.12);
    --ink: #1a1614;
    --muted: #655b52;
    --accent: #d45e36;
    --accent-soft: rgba(212, 94, 54, 0.11);
    --accent-ink: #ffffff;
    --ok: #1f8a4c;
    --danger: #c63d3d;
    --shadow-lg: 0 24px 60px rgba(42, 31, 20, 0.1);
    --shadow-md: 0 10px 28px rgba(42, 31, 20, 0.06);
    --radius-xl: 24px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
    --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  }

  html[data-theme="darkroom"] {
    --bg: #0b0a0a;
    --surface: #151312;
    --surface-2: #1f1c1a;
    --glass: rgba(15, 13, 12, 0.78);
    --glass-border: rgba(255, 255, 255, 0.1);
    --ink: #f6f1e9;
    --muted: #a69a8e;
    --accent: #e6a94d;
    --accent-soft: rgba(230, 169, 77, 0.13);
    --accent-ink: #121010;
    --ok: #59c37a;
    --danger: #e06c6c;
    --shadow-lg: 0 28px 72px rgba(0, 0, 0, 0.56);
    --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.34);
  }

  *,
  *::before,
  *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
  }

  html {
    scroll-behavior: smooth;
    overflow-x: clip;
    max-width: 100%;
  }

  body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
    max-width: 100%;
    transition: background-color 220ms var(--ease-out), color 220ms var(--ease-out);
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

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

  button,
  input,
  select {
    font: inherit;
    color: inherit;
    touch-action: manipulation;
  }

  .btn,
  a {
    touch-action: manipulation;
  }

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

  .skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    z-index: 200;
  }

  .skip-link:focus {
    left: 16px;
  }

  .container {
    width: min(1160px, calc(100% - clamp(28px, 6vw, 48px) - env(safe-area-inset-left) - env(safe-area-inset-right)));
    margin-inline: auto;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition:
      transform 120ms var(--ease-out),
      background-color 160ms var(--ease-out),
      border-color 160ms var(--ease-out),
      opacity 160ms var(--ease-out);
  }

  .btn:active {
    transform: scale(0.97);
  }

  .btn-lg {
    min-height: 48px;
    padding: 12px 24px;
    font-size: 0.95rem;
  }

  .btn-full {
    width: 100%;
  }

  .btn-primary {
    background: var(--accent);
    color: var(--accent-ink);
  }

  .btn-secondary {
    background: var(--surface-2);
    border-color: var(--glass-border);
    color: var(--ink);
  }

  .btn-ghost {
    background: transparent;
    border-color: var(--glass-border);
    color: var(--ink);
  }

  @media (hover: hover) and (pointer: fine) {
    .btn-primary:hover { opacity: 0.92; }
    .btn-secondary:hover { border-color: var(--accent); }
    .btn-ghost:hover { background: var(--surface-2); }
  }
}
