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

@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; }
  img, picture, video, svg, object { display: block; max-width: 100%; }
  input, button, textarea, select { font: inherit; color: inherit; }
  button { background: none; border: 0; cursor: pointer; }
  a { color: inherit; }
}

@layer tokens {
  :root {
    color-scheme: light;
    --bg:        #ffffff;
    --bg-soft:   #fafaf9;
    --bg-grid:   #f4f4f5;
    --fg:        #0a0a0a;
    --fg-soft:   #404040;
    --muted:     #737373;
    --line:      #e7e5e4;
    --line-soft: #f0efed;

    --pri:       oklch(22% 0.02 280);
    --pri-fg:    #ffffff;
    --pri-hover: color-mix(in oklch, var(--pri), white 12%);
    --accent:    oklch(70% 0.18 250);
    --ring:      oklch(58% 0.18 250);

    --radius-sm: 0.375rem;
    --radius:    0.625rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 1px rgb(0 0 0 / 0.06);
    --shadow-2: 0 4px 12px rgb(0 0 0 / 0.06), 0 2px 4px rgb(0 0 0 / 0.04);
    --shadow-3: 0 24px 48px -12px rgb(0 0 0 / 0.18), 0 8px 16px -8px rgb(0 0 0 / 0.10);

    --font-sans: ui-sans-serif, -apple-system, "SF Pro Display", "Inter", "Pretendard", system-ui, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

    --container: 1100px;
  }
}

@layer base {
  html { scroll-behavior: smooth; }
  body {
    font-family: var(--font-sans);
    font-feature-settings: "cv11", "ss01", "ss03";
    background: var(--bg);
    color: var(--fg);
    line-height: 1.55;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.1; }
  h1 { font-size: clamp(2.5rem, 5.5vw, 4.5rem); font-weight: 700; }
  h2 { font-size: clamp(1.75rem, 3vw, 2.5rem); font-weight: 700; }
  h3 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; }
  p  { color: var(--fg-soft); }
  a  { color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: var(--line); }
  a:hover { text-decoration-color: var(--fg); }

  :focus { outline: none; }
  :focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
  }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  }

  ::view-transition-old(root), ::view-transition-new(root) {
    animation-duration: 0.24s;
    animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}

@layer components {
  .btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.625rem 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    transition: background 120ms, color 120ms, transform 120ms, box-shadow 120ms;
    white-space: nowrap;
    &:active { transform: translateY(1px); }
  }
  .btn-primary { background: var(--pri); color: var(--pri-fg);
    &:hover { background: var(--pri-hover); box-shadow: var(--shadow-2); }
  }
  .btn-ghost { background: transparent; color: var(--fg); border: 1px solid var(--line);
    &:hover { background: var(--bg-soft); border-color: var(--fg-soft); }
  }
  .btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; border-radius: var(--radius); }
  .btn-xl { padding: 1.125rem 2rem; font-size: 1.125rem; border-radius: var(--radius); }

  .site-nav {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--line-soft);
  }
  .brand {
    display: inline-flex; align-items: center; gap: 0.625rem;
    text-decoration: none; font-weight: 700; letter-spacing: -0.01em; font-size: 1.0625rem;
    color: var(--fg);
  }
  .brand-logo { width: 28px; height: 28px; border-radius: 7px; }
  .nav-links { margin-left: auto; display: flex; gap: 1.5rem; }
  .nav-links a { text-decoration: none; color: var(--fg-soft); font-size: 0.9375rem; font-weight: 500;
    &:hover { color: var(--fg); }
  }
  .nav-cta { padding: 0.5rem 0.875rem; font-size: 0.875rem; }
  @media (max-width: 640px) {
    .nav-links { display: none; }
    .site-nav { gap: 0.75rem; padding: 0.75rem 1rem; }
  }

  .hero {
    max-width: var(--container); margin-inline: auto;
    padding: clamp(2.5rem, 7vw, 6rem) 1.5rem 2rem;
    display: grid; gap: clamp(2rem, 4vw, 3.5rem);
    grid-template-columns: 1.05fr 1fr;
    align-items: center;
  }
  @media (max-width: 880px) {
    .hero { grid-template-columns: 1fr; }
  }
  .eyebrow {
    display: inline-block;
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted);
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--line); border-radius: 999px;
    background: var(--bg-soft);
    margin-bottom: 1.25rem;
  }
  .lede { font-size: 1.0625rem; max-width: 44ch; margin-top: 1.25rem; }
  .hero-cta { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 2rem; }
  .trust-row {
    list-style: none; padding: 0;
    display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem;
    margin-top: 1.5rem;
    font-size: 0.8125rem; color: var(--muted);
    & li::before { content: "✓"; color: var(--accent); margin-right: 0.375rem; font-weight: 700; }
  }

  .hero-visual {
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-3);
    background: var(--bg-soft);
    aspect-ratio: 1200 / 630;
    position: relative;
  }
  .hero-visual img { width: 100%; height: 100%; object-fit: cover; display: block; }

  .how { max-width: var(--container); margin-inline: auto; padding: clamp(2.5rem,6vw,5rem) 1.5rem 1rem; }
  .how h2 { text-align: center; margin-bottom: 2.5rem; }
  .how-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
  }
  .how-card {
    padding: 1.75rem 1.5rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--bg);
    transition: border-color 160ms, box-shadow 160ms, transform 160ms;
  }
  .how-card:hover { border-color: var(--fg-soft); box-shadow: var(--shadow-2); transform: translateY(-2px); }
  .how-num {
    display: inline-grid; place-items: center;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--fg); color: var(--bg);
    font-weight: 700; font-size: 0.9375rem;
    margin-bottom: 1rem;
  }
  .how-card h3 { margin-bottom: 0.5rem; }
  .how-card p { font-size: 0.9375rem; color: var(--fg-soft); }

  [popover] {
    inset: auto; margin: auto;
    border: 1px solid var(--line); border-radius: var(--radius-lg);
    padding: 1.5rem; max-width: 32rem;
    box-shadow: var(--shadow-3);
    &::backdrop { background: color-mix(in srgb, var(--fg) 30%, transparent); }
    h3 { margin-bottom: 0.75rem; }
    p + p { margin-top: 0.75rem; }
  }

  .vs-strip {
    max-width: var(--container); margin-inline: auto;
    padding: 0.5rem 1.5rem 3rem;
    display: grid; gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    & > div {
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 1.125rem 1.25rem;
      background: var(--bg);
    }
    .vs-head {
      font-size: 0.75rem; font-weight: 700;
      letter-spacing: 0.08em; text-transform: uppercase;
      color: var(--accent);
      margin-bottom: 0.375rem;
    }
    p { font-size: 0.9375rem; color: var(--fg-soft); }
  }

  .pricing {
    max-width: 560px; margin-inline: auto;
    padding: clamp(2.5rem, 6vw, 5rem) 1.5rem;
    text-align: center;
    h2 { margin-bottom: 2rem; }
  }
  .price-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    background: var(--bg);
    box-shadow: var(--shadow-2);
  }
  .price { display: flex; align-items: baseline; justify-content: center; gap: 0.625rem; }
  .price .amount { font-size: 3.5rem; font-weight: 700; letter-spacing: -0.03em; }
  .price .unit   { color: var(--muted); font-size: 0.9375rem; }
  .price-features {
    list-style: none; padding: 0;
    margin: 1.75rem 0 2rem;
    text-align: left;
    & li {
      padding: 0.5rem 0;
      border-bottom: 1px dashed var(--line-soft);
      font-size: 0.9375rem; color: var(--fg-soft);
      display: flex; gap: 0.625rem;
      &::before { content: "✓"; color: var(--accent); font-weight: 700; }
      &:last-child { border-bottom: 0; }
    }
  }
  .legal { font-size: 0.8125rem; color: var(--muted); margin-top: 1rem; }

  .builder {
    max-width: 760px; margin-inline: auto;
    padding: 0 1.5rem clamp(2rem, 5vw, 3.5rem);
  }
  .builder-card {
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    padding: 1.5rem 1.75rem;
    background: var(--bg-soft);
  }
  .builder-head {
    font-size: 0.75rem; font-weight: 700;
    letter-spacing: 0.08em; text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.5rem;
  }
  .builder-card p { font-size: 0.9375rem; }

  .faq {
    max-width: 760px; margin-inline: auto;
    padding: clamp(2rem, 5vw, 4rem) 1.5rem;
    h2 { text-align: center; margin-bottom: 2rem; }
    details {
      border-bottom: 1px solid var(--line);
      padding: 1rem 0;
      &[open] summary { color: var(--fg); }
      summary {
        cursor: pointer; list-style: none;
        font-size: 1.0625rem; font-weight: 600;
        color: var(--fg-soft);
        display: flex; justify-content: space-between; align-items: center;
        padding: 0.25rem 0;
        gap: 1rem;
        &::-webkit-details-marker { display: none; }
        &::after { content: "+"; font-size: 1.5rem; font-weight: 300; color: var(--muted); flex: none; }
      }
      &[open] summary::after { content: "−"; }
      p { margin-top: 0.75rem; font-size: 0.9375rem; }
      code { font-family: var(--font-mono); font-size: 0.8125rem; background: var(--bg-soft); border: 1px solid var(--line); padding: 0.0625rem 0.375rem; border-radius: 4px; }
    }
  }

  dialog {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 2rem;
    max-width: 28rem;
    box-shadow: var(--shadow-3);
    &::backdrop { background: color-mix(in srgb, var(--fg) 40%, transparent); backdrop-filter: blur(4px); }
    h2 { margin-bottom: 0.75rem; }
    p  { margin-bottom: 0.5rem; }
    form { margin-top: 1.25rem; display: flex; justify-content: flex-end; }
  }
  .muted { color: var(--muted); font-size: 0.875rem; }

  footer {
    border-top: 1px solid var(--line);
    padding: 2rem 1.5rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.875rem;
    p + p { margin-top: 0.375rem; }
  }
  .footer-fine { color: color-mix(in srgb, var(--muted), white 30%); }
}
