@layer base, layout, components;

@layer base {
  :root {
    color-scheme: dark;
    --background: #0b0c15;
    --panel: #121423;
    --line: #2a2e47;
    --text: #f4f5ff;
    --muted: #b2b7cf;
    --accent: #b6a7ff;
    --ink: #151029;
    --radius: 22px;
    font-family: "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
  }

  *, *::before, *::after { box-sizing: border-box; }
  [hidden] { display: none !important; }
  html { scroll-behavior: smooth; }
  body { margin: 0; background: var(--background); color: var(--text); }
  h1, h2, h3, p { margin: 0; }
  a { color: inherit; text-decoration: none; }
  button, input { font: inherit; }
  :focus-visible { outline: 2px solid #d5c9ff; outline-offset: 4px; }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
  }
}

@layer layout {
  .container { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
  .header { border-bottom: 1px solid #22253b; }
  .header-inner { min-height: 76px; display: flex; align-items: center; justify-content: space-between; }
  .hero { min-height: 414px; position: relative; isolation: isolate; display: grid; align-items: center; overflow: hidden; }
  .hero-content { padding-block: 56px; position: relative; z-index: 1; }
  .plans { padding-top: 20px; padding-bottom: 64px; scroll-margin-top: 22px; }
  .section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 24px; flex-wrap: wrap; margin-bottom: 24px; }
  .section-heading p { color: var(--muted); }
  .plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding-block: 24px; gap: 12px; border-top: 1px solid var(--line); }
  .footer p { color: var(--muted); font-size: 0.875rem; }

  @media (max-width: 760px) {
    .container { width: calc(100% - 36px); }
    .plan-grid { grid-template-columns: 1fr; gap: 12px; }
    .plans { padding-bottom: 40px; }
  }
}

@layer components {
  .brand { display: inline-flex; align-items: center; gap: 8px; font-size: 1.25rem; font-weight: 750; }
  .brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: var(--ink); font-size: 1.4rem; }
  .brand-type { font-size: 0.9rem; color: var(--muted); letter-spacing: 0.05em; }
  .nav-link { display: block; padding: 8px 16px; color: var(--muted); border-radius: 9px; }
  .nav-link:hover { background: var(--panel); color: var(--text); }
  .hero h1 { font-size: clamp(2.45rem, 6vw, 4.9rem); font-weight: 750; line-height: 1.02; letter-spacing: -0.065em; }
  .hero h1 span { color: var(--accent); }
  .hero p { color: #c7c9df; margin-top: 22px; margin-bottom: 27px; max-width: 355px; font-size: 1.075rem; }
  .hero-art { position: absolute; inset: 0 0 0 40%; isolation: isolate; }
  .hero-art::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 68% 55%, #38219190, transparent 67%); }
  .planet { position: absolute; width: min(68%, 340px); aspect-ratio: 1; left: 64%; top: 50%; translate: -50% -50%; border-radius: 50%; border: 1px solid #a79aff80; background: repeating-linear-gradient(159deg, transparent 0 14px, #b0a2ff2e 15px, transparent 16px 22px), radial-gradient(ellipse at 36% 30%, #9d8dff, #453599 37%, #18133b 68%, #0b0c15 87%); box-shadow: inset 8px 8px 25px #c1b5ff80, 0 0 70px #7050ff45; }
  .orbit { position: absolute; width: 72%; height: 31%; top: 50%; left: 64%; border: 1px solid #9986ff78; border-radius: 50%; transform: translate(-50%, -50%) rotate(-22deg); }
  .orbit-outer { width: 90%; height: 42%; border-color: #8f79ff49; }
  .horizon { position: absolute; width: 72%; height: 31%; top: 50%; left: 64%; border: 1px solid transparent; border-bottom-color: #d4c2ff; border-radius: 50%; transform: translate(-50%, -50%) rotate(-22deg); }
  .north-star, .small-star, .far-star { position: absolute; color: #e3d9ff; text-shadow: 0 0 20px #9f87ff; line-height: 1; }
  .north-star { left: 77%; top: 21%; font-size: 45px; }
  .small-star { left: 38%; top: 72%; font-size: 21px; }
  .far-star { left: 48%; top: 16%; font-size: 13px; }
  .section-heading h2, .dialog h2 { font-size: clamp(1.65rem, 3.3vw, 2.35rem); letter-spacing: -0.035em; line-height: 1.12; }
  .plan { display: flex; flex-direction: column; align-items: start; padding: 25px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); }
  .plan-featured { border-color: #9381e2; background: linear-gradient(150deg, #272045, #18172b 76%); }
  .period { color: var(--accent); font-size: 0.875rem; font-weight: 650; }
  .plan h3 { margin-block: 8px 12px; font-size: 1.5rem; }
  .price { font-size: clamp(2.15rem, 4vw, 3.15rem); line-height: 1.08; font-weight: 750; letter-spacing: -0.05em; font-variant-numeric: tabular-nums; }
  .price span { font-size: 0.64em; font-weight: 550; color: var(--muted); }
  .plan-description { color: var(--muted); margin-block: 13px 22px; }
  .button { display: inline-flex; justify-content: center; align-items: center; min-height: 48px; padding: 10px 22px; border: 1px solid transparent; border-radius: 11px; font-weight: 700; cursor: pointer; }
  .button:disabled { opacity: 0.65; cursor: default; }
  .button-light { background: var(--text); color: var(--ink); }
  .button-light:hover { background: #d9d3f6; }
  .button-outline { background: #1c2035; border-color: #373c59; color: var(--text); }
  .button-outline:hover:not(:disabled) { background: #2b2d49; }
  .button-accent { background: var(--accent); color: var(--ink); }
  .button-accent:hover:not(:disabled) { background: #c9bdff; }
  .plan .button { margin-top: auto; width: 100%; }
  .dialog { width: min(470px, calc(100% - 28px)); max-height: calc(100% - 28px); padding: 28px; background: var(--panel); color: var(--text); border: 1px solid #4a416b; border-radius: var(--radius); }
  .dialog::backdrop { background: #060712d9; backdrop-filter: blur(5px); }
  .dialog h2 { margin: 8px 24px 14px 0; font-size: 1.75rem; }
  .close-button { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; cursor: pointer; font-size: 1.6rem; }
  .close-button:hover { background: #282941; color: var(--text); }
  .dialog form { display: grid; }
  .dialog label { font-size: 0.925rem; margin: 12px 0 5px; }
  .dialog input { width: 100%; min-width: 0; min-height: 45px; border: 1px solid #484a67; border-radius: 9px; background: var(--background); color: var(--text); padding: 10px 12px; }
  .dialog input::placeholder { color: #969bb4; }
  .form-note, .form-error, .preview-note { margin-top: 12px; font-size: 0.875rem; color: var(--muted); }
  .form-error { color: #ffb1be; }
  .preview-note { color: var(--accent); }
  .dialog .button { margin-top: 16px; width: 100%; }
  .success-mark { display: grid; place-items: center; background: var(--accent); color: var(--ink); width: 42px; height: 42px; border-radius: 50%; font-size: 1.35rem; font-weight: 750; }
  #success-text { color: var(--muted); }

  @media (max-width: 760px) {
    .hero { min-height: 340px; }
    .hero-content { padding-block: 40px; }
    .hero-art { left: 24%; opacity: 0.48; }
    .hero p { max-width: 290px; }
    .plan { padding: 21px; }
  }

  @media (max-width: 420px) {
    .header-inner { min-height: 64px; }
    .hero h1 { font-size: clamp(1.9rem, 9vw, 2.45rem); }
    .dialog { padding: 21px; }
  }
}
