/* Make it homepage (sign-in). Space Grotesk for display, Inter for UI.
   Palette in OKLCH, alpha borders, nested radii (panel 28 - padding 20 = 8). */
@font-face { font-family: "Inter"; src: url("/assets/fonts/inter-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("/assets/fonts/space-grotesk-latin.woff2") format("woff2"); font-weight: 500 700; font-display: swap; }

:root {
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: oklch(0.965 0.004 265);
  --surface: oklch(1 0 0);
  --text: oklch(0.25 0.01 265);
  --muted: oklch(0.50 0.01 265);
  --border: rgb(0 0 0 / 0.1);
  --input: rgb(0 0 0 / 0.2);
  --accent: oklch(0.53 0.19 259);
  --accent-hover: oklch(0.47 0.18 259);
  --accent-soft: oklch(0.955 0.025 259);
  --on-accent: oklch(1 0 0);
  --error: oklch(0.50 0.19 25);
  --error-bg: oklch(0.96 0.03 25);
  --story-a: oklch(0.95 0.035 259);
  --story-b: oklch(0.985 0.012 225);
  --panel-r: 28px; --panel-pad: 32px; --inner-r: 12px;
  --ease-out: cubic-bezier(.2,0,0,1);
  --ease-spring: cubic-bezier(.34,1.4,.64,1);
  color-scheme: light;
}
.dark {
  --bg: oklch(0.17 0.005 265);
  --surface: oklch(0.23 0.006 265);
  --text: oklch(0.95 0.005 265);
  --muted: oklch(0.74 0.01 265);
  --border: rgb(255 255 255 / 0.1);
  --input: rgb(255 255 255 / 0.2);
  --accent: oklch(0.76 0.12 259);
  --accent-hover: oklch(0.82 0.10 259);
  --accent-soft: oklch(0.30 0.05 259);
  --on-accent: oklch(0.18 0.03 259);
  --error: oklch(0.78 0.12 25);
  --error-bg: oklch(0.28 0.05 25);
  --story-a: oklch(0.24 0.04 259);
  --story-b: oklch(0.19 0.015 225);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font-ui); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input { font: inherit; }
button { cursor: pointer; }
:where(a, button, input):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Layout: story left, sign-in right; full height in dvh ---- */
.auth-shell { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 1fr); }
.auth-story {
  position: relative; display: flex; flex-direction: column; padding: 32px 48px 48px;
  background: linear-gradient(150deg in oklch, var(--story-a), var(--story-b));
  border-right: 1px solid var(--border); overflow: hidden;
}
.auth-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font: 700 20px/1 var(--font-display); letter-spacing: -.02em; }
.auth-brand img { width: 36px; height: 36px; border-radius: 10px; }
.dark .auth-brand img { filter: invert(1) hue-rotate(180deg); }
.auth-brand small { display: block; margin-top: 4px; font: 600 12px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.auth-story-body { margin: auto 0; max-width: 520px; padding-top: 32px; }
.auth-hero { width: min(300px, 70%); aspect-ratio: 6 / 5; margin: 0 0 12px -12px; }
.auth-story h1 { font: 700 clamp(36px, 4.4vw, 56px)/1.04 var(--font-display); letter-spacing: -.035em; margin: 0 0 16px; text-wrap: balance; }
.auth-story p { color: var(--muted); font-size: 17px; max-width: 42ch; margin: 0; }
.auth-steps { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 28px 0 0; }
.auth-steps li { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 999px; background: rgb(255 255 255 / 0.6); border: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.dark .auth-steps li { background: rgb(255 255 255 / 0.06); }
.auth-steps b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 12px; }

.auth-main { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-topline { display: flex; justify-content: flex-end; }
.theme-switch { min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; transition: background-color .16s var(--ease-out), transform .16s var(--ease-out); }
.theme-switch:hover { background: var(--accent-soft); }
.theme-switch:active { transform: scale(.97); transition-duration: 90ms; }
.auth-panel {
  width: 100%; max-width: 420px; margin: auto; padding: var(--panel-pad);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--panel-r);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 18px 48px rgb(20 30 60 / 0.08);
}
.dark .auth-panel { box-shadow: none; }
.auth-panel :is(h1,h2) { font: 700 30px/1.1 var(--font-display); letter-spacing: -.03em; margin: 0 0 6px; }
.auth-subtitle { color: var(--muted); font-size: 14px; margin: 0 0 8px; }
.auth-note { color: var(--muted); font-size: 13px; margin: 20px 0 0; text-align: center; }
.auth-footer { text-align: center; font-size: 12px; color: var(--muted); margin: 16px 0 0; }

/* ---- Form ---- */
label { display: block; font-size: 13px; font-weight: 600; margin: 18px 0 8px; }
input { width: 100%; min-height: 48px; padding: 12px 14px; border: 1px solid var(--input); border-radius: var(--inner-r); background: var(--surface); color: var(--text); transition: border-color .16s var(--ease-out), box-shadow .16s var(--ease-out); }
input:hover { border-color: var(--muted); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.password-field { position: relative; }
.password-field input { padding-right: 52px; }
.password-toggle { position: absolute; right: 2px; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); display: grid; place-items: center; }
.password-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.eye-icon { position: relative; width: 20px; height: 13px; border: 2px solid currentColor; border-radius: 70% 15%; transform: rotate(45deg); display: block; }
.eye-icon::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: currentColor; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.password-toggle[aria-pressed="true"] .eye-icon::before { content: ""; position: absolute; width: 24px; height: 2px; background: currentColor; left: -4px; top: 4px; }
.primary {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 24px;
  border: 0; border-radius: var(--inner-r); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 15px; text-decoration: none;
  box-shadow: 0 8px 20px color-mix(in oklch, var(--accent) 30%, transparent);
  transition: background-color .16s var(--ease-out), transform .16s var(--ease-out), box-shadow .16s var(--ease-out);
}
.primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.primary:active { transform: scale(.97); box-shadow: none; transition-duration: 90ms; }
.primary span { transition: transform .16s var(--ease-out); }
.primary:hover span { transform: translateX(3px); }
.primary[aria-busy="true"] { cursor: progress; }
.primary[aria-busy="true"] > span:not(.mk-lottie) { display: none; }
.primary .mk-lottie { width: 24px; height: 24px; }
.auth-error { padding: 12px 14px; margin: 12px 0 0; background: var(--error-bg); color: var(--error); border-radius: var(--inner-r); font-size: 14px; }
.connection-state { padding: 12px 14px; background: var(--accent-soft); color: var(--accent); border-radius: var(--inner-r); overflow-wrap: anywhere; }
code { font-size: 12px; overflow-wrap: anywhere; }

/* ---- Animation presets: data-anim="fade-up | scale-in | blur-in", style="--d:N" staggers by 60 ms ---- */
@media (prefers-reduced-motion: no-preference) {
  [data-anim] { animation: var(--anim, mk-fade-up) .5s var(--ease-out) calc(var(--d, 0) * 60ms + 80ms) both; }
  [data-anim="scale-in"] { --anim: mk-scale-in; }
  [data-anim="blur-in"] { --anim: mk-blur-in; }
  .auth-error { animation: mk-shake .36s var(--ease-out); }
}
@keyframes mk-fade-up { from { opacity: 0; transform: translateY(14px); } }
@keyframes mk-scale-in { from { opacity: 0; transform: scale(.92); } }
@keyframes mk-blur-in { from { opacity: 0; filter: blur(6px); } }
@keyframes mk-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---- Phones: the story becomes a short header ---- */
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-story { padding: 20px 20px 24px; border-right: 0; border-bottom: 1px solid var(--border); }
  .auth-story-body { padding-top: 12px; }
  .auth-hero, .auth-story p, .auth-steps { display: none; }
  .auth-story h1 { font-size: 28px; margin: 0; }
  .auth-main { padding: 16px 16px 24px; }
  .auth-topline { position: absolute; top: 16px; right: 16px; }
  .auth-panel { --panel-pad: 22px; margin: 8px auto auto; }
}

/* ---- v2: visual panel like a product showcase, switch link top-right (sign in <-> sign up) ---- */
.auth-story { justify-content: center; gap: 28px; }
.auth-mosaic { display: grid; grid-template-columns: 1.4fr 1fr; grid-template-rows: 1fr 1fr; gap: 12px; width: min(560px, 100%); margin: 0 auto; }
.auth-mosaic img { width: 100%; height: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 18px; background: var(--surface); }
.auth-mosaic img:first-child { grid-row: span 2; border-radius: 24px; }
.auth-mosaic img:nth-child(4) { display: none; }
.auth-story-body { margin: 0 auto; width: min(560px, 100%); padding: 0; }
.auth-story-title { font: 700 clamp(26px, 2.6vw, 36px)/1.1 var(--font-display); letter-spacing: -.03em; color: var(--text) !important; margin: 0 !important; text-wrap: balance; }
.auth-topline { justify-content: space-between; align-items: center; gap: 12px; }
.auth-brand-sm { font-size: 18px; }
.auth-switch { margin: 0; font-size: 14px; color: var(--muted); }
.auth-switch a { font-weight: 600; }
.auth-footer .theme-switch { min-height: 32px; padding: 0 10px; font-size: 12px; border-radius: 8px; vertical-align: middle; }
@media (max-width: 860px) {
  .auth-story { display: none; }
  .auth-topline { position: static; }
}

/* ---- v3: live product panels (different per page), Google button, verify code, checkout wait ---- */
.auth-story { align-items: center; }
.ap-card { width: min(440px, 100%); border-radius: 24px; background: var(--surface); box-shadow: 0 30px 60px rgb(0 0 0 / .18), inset 0 0 0 1px var(--border); padding: 18px; }
.ap-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-family: var(--font-display); }
.ap-chip { font: 600 12px var(--font-ui); padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.ap-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.ap-row img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }
.ap-row b { display: block; font-size: 14px; }
.ap-row small { color: var(--muted); font-size: 12px; }
.ap-status { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; }
.ap-status.is-run { background: oklch(0.85 0.1 85 / .25); color: oklch(0.7 0.14 75); }
.ap-status.is-ready { background: var(--accent-soft); color: var(--accent); }
.ap-status.is-done { background: oklch(0.72 0.16 150 / .18); color: oklch(0.62 0.15 150); }
.ap-product { position: relative; }
.ap-hero { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 16px; }
.ap-thumbs { display: flex; gap: 8px; margin-top: 10px; }
.ap-thumbs img { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; }
.ap-meta { display: flex; justify-content: space-between; margin-top: 12px; font-size: 14px; }
.ap-meta span { color: var(--muted); }
.ap-toast { position: absolute; left: 50%; top: 24px; transform: translateX(-50%); display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-radius: 14px; background: var(--surface); box-shadow: 0 12px 30px rgb(0 0 0 / .2), inset 0 0 0 1px var(--border); font-weight: 600; font-size: 14px; white-space: nowrap; }
.ap-tick { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: oklch(0.72 0.16 150); color: #fff; font-size: 12px; }
.auth-story .ap-title { color: var(--text); font: 700 clamp(24px, 2.4vw, 32px)/1.15 var(--font-display); letter-spacing: -.03em; margin: 28px 0 6px; text-align: center; text-wrap: balance; }
.auth-story .ap-sub { margin: 0; color: var(--muted); text-align: center; }
.ap-mark img { width: 72px; height: 72px; border-radius: 20px; }
.dark .ap-mark img { filter: invert(1) hue-rotate(180deg); }
.ap-plain { justify-content: center; }
@media (prefers-reduced-motion: no-preference) {
  .ap-card { animation: ap-rise 520ms var(--ease-out) both; }
  .ap-status.is-run { animation: ap-pulse 1.6s ease-in-out infinite; }
  .ap-toast { animation: ap-drop 520ms 600ms var(--ease-spring) both; }
  @keyframes ap-rise { from { opacity: 0; transform: translateY(14px); } }
  @keyframes ap-pulse { 50% { opacity: .55; } }
  @keyframes ap-drop { from { opacity: 0; transform: translate(-50%, -10px); } }
}
.auth-google { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border-radius: 12px; border: 1px solid var(--input); background: var(--surface); color: var(--text); font-weight: 600; text-decoration: none; transition: background-color 160ms var(--ease-out); }
.auth-google:hover { background: var(--accent-soft); }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 16px 0 4px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-check { display: flex !important; gap: 10px; align-items: flex-start; font-weight: 400 !important; font-size: 14px; color: var(--muted); margin-top: 12px; }
.auth-check input { width: 18px; height: 18px; margin-top: 2px; flex: none; }
.auth-hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.auth-forgot { margin: 8px 0 0; text-align: right; font-size: 14px; }
.auth-ok { padding: 12px 14px; border-radius: 12px; background: oklch(0.72 0.16 150 / .14); margin-bottom: 12px; font-size: 14px; }
.auth-code { font: 600 28px/1 var(--font-display) !important; letter-spacing: .4em; text-align: center; }
.auth-inline { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin: 14px 0 0; font-size: 14px; color: var(--muted); }
.auth-switch .auth-inline { margin: 0; }
.auth-linkbtn { border: 0; background: none; padding: 8px 4px; color: var(--accent); font-weight: 600; cursor: pointer; }
.cf-turnstile { margin-top: 14px; min-height: 65px; }
.checkout-wait { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; padding: 24px; }
.checkout-wait h1 { font: 700 24px var(--font-display); margin: 8px 0 0; }
.checkout-wait p { color: var(--muted); }
