/* ==========================================================================
   MyClipCloud — design system (shared + public site)
   Tokens → base → layout → components → sections → utilities
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand */
  --purple: #7357f6;
  --purple-600: #6247ea;
  --purple-deep: #4c35b5;
  --purple-50: #f4f1ff;
  --purple-100: #e9e3ff;
  --purple-200: #d6ccff;
  --sky: #38bdf8;
  --sky-text: #0369a1;
  --sky-50: #eaf8ff;
  --sky-100: #d3f0fd;
  --gradient: linear-gradient(120deg, #7357f6 0%, #8c7afb 45%, #38bdf8 100%);
  --gradient-deep: linear-gradient(125deg, #34248f 0%, #4c35b5 45%, #6247ea 100%);

  /* Neutrals */
  --white: #ffffff;
  --ink: #17213c;
  --ink-2: #344054;
  --muted: #667085;
  --canvas: #f8faff;
  --surface: #ffffff;
  --surface-2: #f3f6fc;
  --border: #e5eaf4;
  --border-strong: #d3dbea;

  /* Semantic (contrast-checked on their tinted backgrounds) */
  --success: #027a48;
  --success-bg: #ecfdf3;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --info: var(--purple-deep);
  --info-bg: var(--purple-50);

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.375rem, 1.1rem + 1vw, 1.625rem);
  --fs-2xl: clamp(1.625rem, 1.2rem + 1.6vw, 2.125rem);
  --fs-3xl: clamp(2rem, 1.35rem + 2.6vw, 3.25rem);

  /* Space (4px base) */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;
  --s-9: 6rem;

  /* Shape & depth */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 18px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(23, 33, 60, 0.06);
  --shadow-2: 0 1px 2px rgba(23, 33, 60, 0.05), 0 6px 18px -8px rgba(23, 33, 60, 0.14);
  --shadow-3: 0 2px 6px rgba(23, 33, 60, 0.06), 0 18px 40px -16px rgba(52, 36, 143, 0.28);
  --ring: 0 0 0 3px rgba(115, 87, 246, 0.35);

  /* Motion */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 140ms;
  --t-base: 200ms;
  --t-panel: 260ms;

  --container: 1160px;
  --gutter: clamp(1rem, 0.6rem + 1.6vw, 1.5rem);
  --header-h: 64px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #eef1fb;
    --ink-2: #c9cfe3;
    --muted: #9aa3bd;
    --canvas: #0e1222;
    --surface: #151a2e;
    --surface-2: #1b2139;
    --border: #262d48;
    --border-strong: #343c5c;
    --purple-50: #1f1a3f;
    --purple-100: #2a2257;
    --purple-200: #3a3075;
    --sky-50: #0f2333;
    --sky-100: #123049;
    --sky-text: #7dd3fc;
    --info: #b7a8ff;
    --success: #6ce9a6;
    --success-bg: #0d2a1e;
    --warning: #fdb022;
    --warning-bg: #2b1d08;
    --danger: #fda29b;
    --danger-bg: #2d1312;
    --shadow-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px -10px rgba(0, 0, 0, 0.55);
    --shadow-3: 0 2px 8px rgba(0, 0, 0, 0.35), 0 24px 48px -18px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--canvas);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 var(--s-3);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-3xl);
  letter-spacing: -0.035em;
}

h2 {
  font-size: var(--fs-2xl);
}

h3 {
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 var(--s-4);
  text-wrap: pretty;
}

a {
  color: var(--purple-deep);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--purple);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) a {
    color: #b7a8ff;
  }
}

code,
kbd,
pre {
  font-family: var(--mono);
  font-size: 0.92em;
}

kbd {
  display: inline-block;
  padding: 0.05em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 0.82em;
  line-height: 1.5;
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection {
  background: var(--purple-200);
  color: var(--ink);
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 100;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: #fff;
  font-weight: 600;
}

.skip-link:focus {
  top: var(--s-3);
  color: #fff;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow {
  max-width: calc(760px + 2 * var(--gutter));
}

.section {
  padding-block: clamp(3rem, 2rem + 4vw, 6rem);
}

.section--tight {
  padding-block: clamp(2rem, 1.5rem + 2vw, 3.5rem);
}

.section--surface {
  background: var(--surface);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 680px;
  margin-bottom: var(--s-7);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-3);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--purple-deep);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .eyebrow {
    color: #b7a8ff;
  }
}

.lead {
  font-size: var(--fs-md);
  color: var(--ink-2);
  line-height: 1.65;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: var(--s-5);
}

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
}

.stack > * + * {
  margin-top: var(--s-4);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-border: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: 0.55rem 1.05rem;
  border: 1px solid var(--btn-border);
  border-radius: var(--r-md);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--t-fast) var(--ease-out), border-color var(--t-fast) var(--ease-out),
    color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.btn:hover {
  color: var(--btn-fg);
  border-color: var(--purple-200);
  background: var(--purple-50);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  --btn-bg: var(--purple);
  --btn-fg: #fff;
  --btn-border: transparent;
  box-shadow: 0 1px 2px rgba(52, 36, 143, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn--primary:hover {
  color: #fff;
  background: var(--purple-600);
  border-color: transparent;
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-border: transparent;
}

.btn--danger {
  --btn-fg: var(--danger);
  --btn-border: color-mix(in srgb, var(--danger) 35%, transparent);
}

.btn--danger:hover {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger);
}

.btn--danger-solid {
  --btn-bg: #b42318;
  --btn-fg: #fff;
  --btn-border: transparent;
}

.btn--danger-solid:hover {
  background: #912018;
  color: #fff;
}

.btn--lg {
  min-height: 52px;
  padding: 0.75rem 1.35rem;
  font-size: var(--fs-base);
  border-radius: var(--r-lg);
}

.btn--sm {
  min-height: 36px;
  padding: 0.35rem 0.7rem;
  font-size: var(--fs-xs);
  border-radius: var(--r-sm);
}

.btn--icon {
  width: 44px;
  padding: 0;
}

.btn--sm.btn--icon {
  width: 36px;
}

/* Google sign-in button (follows Google's light-theme branding) */
.btn--google {
  --btn-bg: #fff;
  --btn-fg: #1f1f1f;
  --btn-border: #747775;
  gap: 0.75rem;
  font-weight: 500;
  font-family: var(--font);
}

.btn--google:hover {
  background: #f8f9fb;
  color: #1f1f1f;
  border-color: #747775;
}

.btn--google .g-logo {
  width: 20px;
  height: 20px;
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: var(--s-2);
}

.label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}

.hint {
  font-size: var(--fs-sm);
  color: var(--muted);
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 44px;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--fs-base);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.55;
}

.input:hover,
.textarea:hover,
.select:hover {
  border-color: var(--purple-200);
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: var(--ring);
}

.field-error {
  font-size: var(--fs-sm);
  color: var(--danger);
  font-weight: 500;
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

/* Switch (checkbox styled as toggle; keeps native semantics) */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  width: 48px;
  height: 28px;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 1; /* the real control must receive clicks, not the visual track */
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch__track {
  pointer-events: none;
  width: 100%;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--border-strong);
  transition: background-color var(--t-base) var(--ease-out);
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(23, 33, 60, 0.3);
  transition: transform var(--t-base) var(--ease-out);
}

.switch input:checked + .switch__track {
  background: var(--purple);
}

.switch input:checked + .switch__track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch__track {
  box-shadow: var(--ring);
}

.switch input:disabled + .switch__track {
  opacity: 0.5;
}

/* ---------- Cards & surfaces ---------- */
.card {
  position: relative;
  padding: var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}

.card--raised {
  box-shadow: var(--shadow-2);
}

.card--flush {
  padding: 0;
  overflow: hidden;
}

.card__title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-bottom: var(--s-2);
  font-size: var(--fs-md);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge--purple {
  background: var(--purple-50);
  color: var(--purple-deep);
}

.badge--sky {
  background: var(--sky-50);
  color: var(--sky-text);
}

.badge--success {
  background: var(--success-bg);
  color: var(--success);
}

.badge--warning {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge--purple {
    color: #c9bdff;
  }
}

.icon-tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: var(--s-4);
  border-radius: 12px;
  background: var(--purple-50);
  color: var(--purple);
}

.icon-tile .icon {
  width: 22px;
  height: 22px;
}

.icon-tile--sky {
  background: var(--sky-50);
  color: #0284c7;
}

.icon-tile--ink {
  background: var(--surface-2);
  color: var(--ink-2);
}

.notice {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.notice > .icon {
  margin-top: 2px;
  color: var(--purple);
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice--info {
  background: var(--info-bg);
  border-color: var(--purple-100);
}

.notice--warning {
  background: var(--warning-bg);
  border-color: color-mix(in srgb, var(--warning) 25%, transparent);
}

.notice--warning > .icon {
  color: var(--warning);
}

.notice--danger {
  background: var(--danger-bg);
  border-color: color-mix(in srgb, var(--danger) 25%, transparent);
}

.notice--danger > .icon {
  color: var(--danger);
}

.notice--success {
  background: var(--success-bg);
  border-color: color-mix(in srgb, var(--success) 25%, transparent);
}

.notice--success > .icon {
  color: var(--success);
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  -webkit-backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-base) var(--ease-out), background-color var(--t-base) var(--ease-out);
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--s-5);
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.075rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  flex: none;
}

.brand:hover {
  color: var(--ink);
}

.brand__mark {
  width: 32px;
  height: 32px;
}

.brand__name b {
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  margin-left: auto;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  transition: color var(--t-fast) var(--ease-out), background-color var(--t-fast) var(--ease-out);
}

.site-nav__link::after {
  content: "";
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--t-base) var(--ease-out);
}

.site-nav__link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.site-nav__link[aria-current="page"] {
  color: var(--ink);
}

.site-nav__link[aria-current="page"]::after {
  transform: scaleX(1);
}

.site-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-left: var(--s-3);
}

.nav-toggle {
  display: none;
  margin-left: auto;
}

@media (max-width: 959px) {
  .nav-toggle {
    display: inline-flex;
  }

  .js .site-nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--s-4);
    max-height: calc(100dvh - var(--header-h));
    overflow-y: auto;
    margin: 0;
    padding: var(--s-4) var(--gutter) calc(var(--s-5) + env(safe-area-inset-bottom));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--t-panel) var(--ease-out), transform var(--t-panel) var(--ease-out), visibility 0s linear var(--t-panel);
  }

  .js .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity var(--t-panel) var(--ease-out), transform var(--t-panel) var(--ease-out), visibility 0s;
  }

  .site-nav__links {
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav__link {
    min-height: 48px;
    font-size: var(--fs-base);
  }

  .site-nav__link::after {
    display: none;
  }

  .site-nav__link[aria-current="page"] {
    background: var(--purple-50);
  }

  .site-nav__actions {
    margin: 0;
    flex-direction: column;
    align-items: stretch;
  }

  .site-nav__actions .btn {
    width: 100%;
  }

  html:not(.js) .site-header__inner {
    height: auto;
    flex-wrap: wrap;
    padding-block: var(--s-3);
  }

  html:not(.js) .site-nav {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-block: clamp(2.5rem, 1.5rem + 5vw, 5.5rem) clamp(3rem, 2rem + 4vw, 5rem);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--purple) 16%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 30%, #000 20%, transparent 75%);
}

.hero__grid {
  display: grid;
  gap: clamp(2rem, 1rem + 4vw, 4rem);
  align-items: center;
}

@media (min-width: 1000px) {
  .hero__grid {
    grid-template-columns: 1.02fr 1fr;
  }
}

.hero__title {
  margin-bottom: var(--s-4);
}

.hero__title .accent {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-3);
  margin: var(--s-5) 0 var(--s-4);
}

.trust-note {
  display: flex;
  gap: var(--s-2);
  align-items: flex-start;
  max-width: 560px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.trust-note .icon {
  margin-top: 3px;
  color: var(--purple);
}

/* Interactive local-only demo */
.demo {
  position: relative;
  display: grid;
  gap: var(--s-4);
}

.demo::before {
  content: "";
  position: absolute;
  inset: 8% -4% -6% 6%;
  z-index: -1;
  border-radius: 32px;
  background: var(--gradient);
  opacity: 0.16;
  filter: blur(36px);
}

@media (min-width: 600px) {
  .demo {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: end;
  }
}

.device-frame {
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}

.device-frame__bar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--muted);
}

.device-frame__dots {
  display: flex;
  gap: 5px;
}

.device-frame__dots i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-strong);
}

.device-frame__body {
  padding: var(--s-4);
}

.device-frame--phone {
  border-radius: 26px;
  max-width: 280px;
  justify-self: center;
  width: 100%;
}

.device-frame--phone .device-frame__body {
  min-height: 210px;
}

.demo__textarea {
  min-height: 132px;
  font-size: var(--fs-sm);
}

.demo__hint {
  margin: var(--s-3) 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
}

.demo-clip {
  padding: var(--s-3);
  border: 1px solid var(--purple-100);
  border-radius: var(--r-md);
  background: var(--purple-50);
  font-size: var(--fs-sm);
  word-break: break-word;
  white-space: pre-wrap;
  max-height: 140px;
  overflow: hidden;
}

.demo-clip.is-new {
  animation: clip-in var(--t-panel) var(--ease-out);
}

@keyframes clip-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

.demo-meta {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-3);
  font-size: var(--fs-xs);
  color: var(--muted);
}

.demo-label {
  margin-top: var(--s-3);
  text-align: center;
  font-size: var(--fs-xs);
  color: var(--muted);
}

/* ---------- Feature cards / steps ---------- */
.feature-card h3 {
  margin-bottom: var(--s-2);
}

.feature-card p {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.feature-card a.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: var(--s-4);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
}

.feature-card a.card-link .icon {
  transition: transform var(--t-fast) var(--ease-out);
}

.feature-card a.card-link:hover .icon {
  transform: translateX(3px);
}

.steps {
  counter-reset: step;
  display: grid;
  gap: var(--s-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 860px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}

.steps li {
  position: relative;
  padding: var(--s-5);
  padding-top: calc(var(--s-5) + 8px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.steps li::before {
  counter-increment: step;
  content: counter(step);
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: var(--s-4);
  border-radius: 10px;
  background: var(--gradient);
  color: #fff;
  font-weight: 700;
  font-size: var(--fs-sm);
}

.steps h3 {
  margin-bottom: var(--s-2);
}

.steps p {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* Split layout: text + visual */
.split {
  display: grid;
  gap: var(--s-7);
  align-items: center;
}

@media (min-width: 920px) {
  .split {
    grid-template-columns: 1fr 1fr;
  }

  .split--reverse > :first-child {
    order: 2;
  }
}

.check-list {
  display: grid;
  gap: var(--s-3);
  margin: var(--s-4) 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  color: var(--ink-2);
}

.check-list .icon {
  margin-top: 3px;
  color: var(--success);
}

.check-list--limits .icon {
  color: var(--warning);
}

/* ---------- Tables ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table th,
.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table thead th {
  background: var(--surface-2);
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}

.table tbody tr:last-child td,
.table tbody tr:last-child th {
  border-bottom: 0;
}

.table tbody th {
  font-weight: 600;
}

/* ---------- FAQ ---------- */
.faq {
  display: grid;
  gap: var(--s-3);
}

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.faq details[open] {
  border-color: var(--purple-200);
  box-shadow: var(--shadow-2);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  min-height: 56px;
  padding: var(--s-4) var(--s-5);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary .icon {
  color: var(--muted);
  transition: transform var(--t-base) var(--ease-out);
}

.faq details[open] summary .icon {
  transform: rotate(180deg);
}

.faq .faq__answer {
  padding: 0 var(--s-5) var(--s-5);
  color: var(--ink-2);
}

.faq .faq__answer p:last-child {
  margin-bottom: 0;
}

/* ---------- CTA band ---------- */
.cta-band {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 1.5rem + 3vw, 3.5rem);
  border-radius: 24px;
  background: var(--gradient-deep);
  color: #fff;
  text-align: center;
}

.cta-band::after {
  content: "";
  position: absolute;
  right: -10%;
  top: -60%;
  width: 60%;
  height: 180%;
  background: radial-gradient(closest-side, rgba(56, 189, 248, 0.45), transparent);
  pointer-events: none;
}

.cta-band h2 {
  color: #fff;
  position: relative;
}

.cta-band p {
  position: relative;
  max-width: 560px;
  margin-inline: auto;
  color: rgba(255, 255, 255, 0.88);
}

.cta-band .cluster {
  position: relative;
  justify-content: center;
  margin-top: var(--s-5);
}

.cta-band .btn--light {
  --btn-bg: #fff;
  --btn-fg: var(--purple-deep);
  --btn-border: transparent;
}

.cta-band .btn--light:hover {
  background: #f1edff;
  color: var(--purple-deep);
}

.cta-band .btn--outline-light {
  --btn-bg: transparent;
  --btn-fg: #fff;
  --btn-border: rgba(255, 255, 255, 0.45);
}

.cta-band .btn--outline-light:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* ---------- Page header & prose ---------- */
.page-hero {
  padding-block: clamp(2.5rem, 1.5rem + 4vw, 4.5rem) clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.page-hero .lead {
  max-width: 680px;
}

.breadcrumbs {
  margin-bottom: var(--s-4);
  font-size: var(--fs-sm);
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
}

.breadcrumbs li + li::before {
  content: "/";
  margin-right: var(--s-2);
  color: var(--border-strong);
}

.breadcrumbs a {
  color: var(--muted);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--purple-deep);
}

.answer-box {
  margin: 0 0 var(--s-6);
  padding: var(--s-5);
  border: 1px solid var(--purple-100);
  border-left: 4px solid var(--purple);
  border-radius: var(--r-lg);
  background: var(--purple-50);
  color: var(--ink);
}

.answer-box p:last-child {
  margin: 0;
}

.answer-box__label {
  display: block;
  margin-bottom: var(--s-2);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--purple-deep);
}

.prose {
  max-width: 72ch;
  color: var(--ink-2);
  font-size: 1.0625rem;
}

.prose h2 {
  margin-top: var(--s-7);
  font-size: var(--fs-xl);
}

.prose h3 {
  margin-top: var(--s-6);
}

.prose ul,
.prose ol {
  padding-left: 1.3rem;
  margin: 0 0 var(--s-4);
}

.prose li + li {
  margin-top: var(--s-2);
}

.prose blockquote {
  margin: var(--s-5) 0;
  padding: var(--s-2) var(--s-5);
  border-left: 3px solid var(--purple-200);
  color: var(--ink-2);
}

.prose pre {
  overflow-x: auto;
  padding: var(--s-4);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.prose table {
  width: 100%;
  margin: var(--s-5) 0;
  border-collapse: collapse;
  font-size: var(--fs-sm);
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  text-align: left;
}

.prose th {
  background: var(--surface-2);
}

.prose img {
  border-radius: var(--r-md);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-4);
  font-size: var(--fs-sm);
  color: var(--muted);
}

.draft-banner {
  margin-bottom: var(--s-6);
}

.toc {
  padding: var(--s-4) var(--s-5);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  font-size: var(--fs-sm);
}

.toc ol {
  margin: var(--s-2) 0 0;
  padding-left: 1.2rem;
}

/* Blog listing */
.post-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-base) var(--ease-out), transform var(--t-base) var(--ease-out);
}

.post-card:hover {
  color: inherit;
  border-color: var(--purple-200);
  box-shadow: var(--shadow-2);
  transform: translateY(-2px);
}

.post-card h2,
.post-card h3 {
  font-size: var(--fs-md);
  margin-bottom: var(--s-2);
}

.post-card p {
  margin: 0 0 var(--s-4);
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.post-card .article-meta {
  margin-top: auto;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: var(--s-8);
  padding-block: var(--s-8) calc(var(--s-6) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
  font-size: var(--fs-sm);
}

.site-footer__grid {
  display: grid;
  gap: var(--s-6);
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.site-footer__brand {
  grid-column: 1 / -1;
  max-width: 360px;
}

@media (min-width: 900px) {
  .site-footer__grid {
    grid-template-columns: 1.6fr repeat(4, 1fr);
  }

  .site-footer__brand {
    grid-column: auto;
  }
}

.site-footer h2 {
  margin-bottom: var(--s-3);
  font-size: var(--fs-sm);
  letter-spacing: 0;
}

.site-footer ul {
  display: grid;
  gap: var(--s-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--ink-2);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--purple-deep);
  text-decoration: underline;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s-3);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--border);
  color: var(--muted);
}

/* ---------- Auth page ---------- */
.auth-wrap {
  display: grid;
  place-items: center;
  min-height: calc(100dvh - var(--header-h) - 120px);
  padding-block: var(--s-7);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  padding: clamp(1.5rem, 1rem + 2vw, 2.5rem);
  text-align: center;
}

.auth-card .brand__mark {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--s-4);
}

.auth-card .btn {
  width: 100%;
}

.auth-card .fine-print {
  margin: var(--s-5) 0 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  text-align: left;
}

.divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-5) 0;
  font-size: var(--fs-xs);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Toasts & dialogs (shared with app) ---------- */
.toast-region {
  position: fixed;
  right: var(--s-4);
  bottom: calc(var(--s-4) + env(safe-area-inset-bottom));
  z-index: 90;
  display: grid;
  gap: var(--s-2);
  width: min(380px, calc(100vw - 2 * var(--s-4)));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toast-in var(--t-panel) var(--ease-out);
}

.toast.is-leaving {
  animation: toast-out var(--t-base) ease-in forwards;
}

.toast > .icon {
  margin-top: 1px;
  color: var(--purple);
}

.toast--success > .icon {
  color: var(--success);
}

.toast--error > .icon {
  color: var(--danger);
}

.toast--warning > .icon {
  color: var(--warning);
}

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(4px);
  }
}

@media (max-width: 899px) {
  .has-bottom-nav .toast-region {
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
}

dialog.modal {
  width: min(520px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-3);
}

dialog.modal[open] {
  animation: modal-in var(--t-panel) var(--ease-out);
}

dialog.modal::backdrop {
  background: rgba(14, 18, 34, 0.48);
  backdrop-filter: blur(3px);
  animation: fade-in var(--t-panel) var(--ease-out);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

.modal__inner {
  padding: var(--s-5);
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-3);
}

.modal__head h2 {
  margin: 0;
  font-size: var(--fs-lg);
}

.modal__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-5);
}

/* ---------- Error pages ---------- */
.error-page {
  display: grid;
  place-items: center;
  min-height: 60vh;
  padding-block: var(--s-8);
  text-align: center;
}

.error-page__code {
  font-size: clamp(3.5rem, 2rem + 6vw, 6rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Utilities ---------- */
.mt-0 {
  margin-top: 0;
}

.mb-0 {
  margin-bottom: 0;
}

.mt-4 {
  margin-top: var(--s-4);
}

.mt-5 {
  margin-top: var(--s-5);
}

.mt-6 {
  margin-top: var(--s-6);
}

.mb-5 {
  margin-bottom: var(--s-5);
}

.text-center {
  text-align: center;
}

.text-sm {
  font-size: var(--fs-sm);
}

.nowrap {
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

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

@media (prefers-contrast: more) {
  :root {
    --border: #9aa5bd;
    --border-strong: #6b7795;
    --muted: #475467;
  }

  .btn,
  .card,
  .input,
  .textarea {
    border-width: 2px;
  }
}

@media (forced-colors: active) {
  .btn,
  .switch__track,
  .badge {
    border: 1px solid CanvasText;
  }

  .brand__name b,
  .hero__title .accent,
  .error-page__code {
    background: none;
    color: CanvasText;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toast-region,
  .cta-band {
    display: none !important;
  }

  body {
    background: #fff;
  }
}

.icon-tile--center {
  margin-inline: auto;
}

.h2 {
  font-size: var(--fs-2xl);
}

/* ---------- Email sign-in / sign-up forms ---------- */
.auth-form {
  display: grid;
  gap: var(--s-4);
  text-align: left;
}

.auth-form .btn--primary {
  width: 100%;
}

.field-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
}

.password-field {
  position: relative;
}

.password-field .input {
  padding-right: 4.5rem;
}

.password-field .btn {
  position: absolute;
  top: 50%;
  right: 4px;
  min-height: 34px;
  transform: translateY(-50%);
}

.password-field .btn:active {
  transform: translateY(-50%);
}

.auth-card .password-field .btn {
  width: auto;
}
