/* ============================================================
   A12 — scoped skin for the auth pages (log in, sign up, reset, confirm) and the
   first-run onboarding card on /app.

   Values copied from the marketing site (../curatepics/src/styles/a12.css and
   design/a12/README.md) so a visitor who built a studio on curatepics.app lands on a
   sign-up page that is visibly the same product. Two contrast fixes already decided for
   the redesign: faint text is #687079 (not #8A919C) and green TEXT is #2E7D4B (not
   #3E8E5A) — the lighter values fail 4.5:1 on paper.

   Everything is under `.a12` so nothing here can leak into the studio app, which has its
   own A12 skin (app-a12.css). The one rule set used inside the app is the onboarding card
   at the bottom; app-a12.css maps its palette onto the app's tokens (including dark).
   ============================================================ */

.a12 {
  --c-ink: #0b0e14;
  --c-paper: #f6f7f9;
  --c-white: #ffffff;
  --c-text-2: #3d4451;
  --c-text-3: #5e6673;
  --c-faint: #687079;
  --c-disabled: #8a919c;
  --c-rule: #dde1e7;
  --c-rule-soft: #eceef2;
  --c-slate: #44607f;
  --c-slate-link: #3f5f86;
  --c-slate-tint: #e3eaf3;
  --c-slate-light: #c9d3e0;
  --c-slate-light-4: #b7bdc7;
  --c-green: #3e8e5a;
  --c-green-text: #2e7d4b;
  --c-green-light: #7fc79a;
  --c-red: #9e2b1f;
  --c-amber: #c08a2b;
  --studio-accent: var(--c-ink);
  --f-display: "freight-big-pro", Georgia, "Times New Roman", serif;
  --f-text: "neue-haas-grotesk-text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono: "fira-mono", ui-monospace, "SF Mono", Menlo, monospace;
  --gutter: clamp(20px, 4vw, 56px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  background: var(--c-paper);
  color: var(--c-ink);
  font-family: var(--f-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.a12 *, .a12 *::before, .a12 *::after { box-sizing: border-box; }
.a12 a { color: var(--c-ink); text-decoration: none; }
.a12 a:hover { color: var(--c-slate-link); }
.a12 button, .a12 input { font: inherit; color: inherit; }
.a12 h1, .a12 h2, .a12 h3 { margin: 0; text-wrap: balance; }
.a12 p { margin: 0; text-wrap: pretty; }
.a12 :focus-visible { outline: 2px solid var(--c-slate); outline-offset: 3px; }
.a12 input:focus, .a12 input:focus-visible { outline: 2px solid var(--c-slate); outline-offset: -2px; }
.a12 .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body.a12-page { margin: 0; background: #f6f7f9; }

/* ---- motion ---- */
@keyframes cpin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cpshake { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
/* Identical twin, so a second wrong password can restart the shake by swapping the
   animation name instead of remounting the form (which would steal focus). */
@keyframes cpshake2 { 0%, 100% { transform: none; } 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes cpbar { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.a12 .a12-in { animation: cpin 0.35s ease both; }
.a12 .a12-shake { animation: cpshake 0.35s ease; }
.a12 .a12-shake2 { animation: cpshake2 0.35s ease; }
@media (prefers-reduced-motion: reduce) {
  .a12 *, .a12 *::before, .a12 *::after { animation: none !important; transition: none !important; }
}

/* ---- brand mark ---- */
.a12 .a12-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; min-height: 44px; }
.a12 .a12-logo .mk { width: 28px; height: 28px; background: var(--c-ink); color: var(--c-slate-light); display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-size: 17px; font-weight: 400; }

/* ---- type ---- */
.a12 .a12-h1 { font-family: var(--f-display); font-size: clamp(38px, 5vw, 56px); line-height: 1; font-weight: 400; letter-spacing: -0.015em; }
.a12 .a12-h1.lg { font-size: clamp(38px, 5vw, 60px); }
.a12 .a12-kicker { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.06em; color: var(--c-slate-link); text-transform: uppercase; }
.a12 .a12-kicker.ok { color: var(--c-green-text); }
.a12 .a12-body { color: var(--c-text-2); font-size: 17px; }
.a12 .a12-muted { color: var(--c-text-3); }
.a12 .a12-small { font-size: 14px; }
.a12 .a12-meta { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--c-faint); }

/* ---- form controls ---- */
.a12 .a12-form { display: flex; flex-direction: column; gap: 16px; }
.a12 .a12-field { display: flex; flex-direction: column; gap: 6px; }
.a12 .a12-label { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; color: var(--c-text-3); text-transform: uppercase; }
.a12 .a12-labelrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
/* Touch hit areas. The small text links ("Log in", "Start free", "Forgot password?", the
   terms link) measured 17-24px tall and a thumb misses them. An invisible ::after grows the
   hit area to 44px on touch screens without moving a pixel of the visible text, which
   matters for links that sit inside a sentence. */
@media (hover: none) {
  .a12 .a12-tap { position: relative; }
  .a12 .a12-tap::after { content: ""; position: absolute; left: 50%; top: 50%; width: max(calc(100% + 12px), 44px); height: 44px; transform: translate(-50%, -50%); }
}
@media (max-width: 640px) {
  .a12 .a12-label { font-size: 12px; }
}
.a12 .a12-input { height: 52px; width: 100%; padding: 0 14px; border: 1px solid var(--c-ink); border-radius: 0; background: var(--c-white); font-family: var(--f-text); font-size: 17px; letter-spacing: 0; color: var(--c-ink); }
.a12 .a12-input[aria-invalid="true"] { border-color: var(--c-red); }
.a12 .a12-input::placeholder { color: var(--c-faint); }
.a12 .a12-btn { min-height: 52px; padding: 0 20px; border: 0; border-radius: 0; background: var(--c-ink); color: var(--c-paper); font-size: 16px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center; }
.a12 .a12-btn:hover { background: #1a1f28; }
/* Text on the studio accent follows --studio-accent-ink, set beside --studio-accent by
   accentStyle() in src/lib/accentInk.ts: white text vanished on a pale brand colour. The
   fallback covers the default ink accent and any setter that predates the variable. */
.a12 .a12-btn.accent { background: var(--studio-accent); color: var(--studio-accent-ink, var(--c-paper)); }
.a12 .a12-btn:disabled { background: var(--c-disabled); cursor: default; }
.a12 .a12-btn.accent:disabled { color: var(--c-paper); }
.a12 .a12-btn.block { width: 100%; }
.a12 .a12-btn.ghost { background: none; color: var(--c-ink); border: 1px solid var(--c-ink); font-weight: 400; min-height: 48px; padding: 0 18px; }
.a12 .a12-btn.ghost:hover { background: var(--c-white); }
.a12 .a12-btn.ghost:disabled { color: var(--c-faint); border-color: var(--c-rule); background: none; }
.a12 .a12-btn.quiet { background: none; color: var(--c-ink); border: 1px solid var(--c-rule); font-weight: 400; padding: 0 18px; }
.a12 .a12-link { padding: 0; border: 0; background: none; color: var(--c-slate-link); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; min-height: 24px; }
.a12 .a12-link:disabled { color: var(--c-faint); cursor: default; }
/* The SHOW/HIDE toggle: label-sized text, but a 44px hit area that overhangs the label
   row with negative margins so it doesn't push the input down. */
.a12 .a12-textbtn { padding: 0 6px; margin: -14px -6px; border: 0; background: none; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c-slate-link); cursor: pointer; min-height: 44px; min-width: 44px; }
.a12 .a12-err { font-size: 14px; color: var(--c-red); }
.a12 .a12-err .a12-link { color: var(--c-red); }
.a12 .a12-note { font-size: 14px; color: var(--c-text-3); }

/* ---- tabs ---- */
.a12 .a12-tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--c-ink); }
.a12 .a12-tab { min-height: 44px; border: 0; background: var(--c-white); color: var(--c-ink); font-size: 14px; cursor: pointer; }
.a12 .a12-tab[aria-selected="true"] { background: var(--c-ink); color: var(--c-paper); }

/* ---- rules (new password) ---- */
.a12 .a12-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.a12 .a12-rules li { display: flex; gap: 8px; color: var(--c-text-3); }
.a12 .a12-rules li.ok { color: var(--c-green-text); }
.a12 .a12-rules .m { width: 16px; font-family: var(--f-mono); }

/* ---- progress bar used on "Signed in" ---- */
.a12 .a12-bar { display: block; height: 4px; background: var(--c-rule-soft); overflow: hidden; }
.a12 .a12-bar > span { display: block; height: 4px; background: var(--studio-accent); transform-origin: left; animation: cpbar 1s var(--ease) both; }

/* ============================================================
   Log in / reset / confirm: split screen
   ============================================================ */
.a12 .a12-split { min-height: 100vh; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.a12 .a12-photo { position: relative; min-height: 240px; background: var(--c-ink); overflow: hidden; }
.a12 .a12-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0.7; }
.a12 .a12-photo .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: clamp(20px, 4vw, 48px); background: linear-gradient(transparent, rgba(11, 14, 20, 0.85)); color: var(--c-paper); display: flex; flex-direction: column; gap: 6px; }
.a12 .a12-photo .cap .k { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--c-slate-light-4); text-transform: uppercase; }
.a12 .a12-photo .cap .l { font-family: var(--f-display); font-size: clamp(28px, 3.4vw, 44px); line-height: 1.05; max-width: 440px; }
.a12 .a12-main { padding: clamp(28px, 6vw, 80px) clamp(20px, 5vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 24px; max-width: 560px; width: 100%; }
.a12 .a12-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; align-items: center; }

/* ============================================================
   Sign up: header, steps, live preview
   ============================================================ */
.a12 .a12-signup { min-height: 100vh; display: flex; flex-direction: column; }
.a12 .a12-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px var(--gutter); min-height: 60px; border-bottom: 1px solid var(--c-rule); }
.a12 .a12-top .alt { font-size: 14px; color: var(--c-text-3); }
.a12 .a12-top .alt .a12-link { color: var(--c-ink); }
.a12 .a12-cols { flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.a12 .a12-steps { padding: clamp(28px, 5vw, 64px) var(--gutter); display: flex; flex-direction: column; gap: 28px; max-width: 620px; width: 100%; }
.a12 .a12-rail { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
.a12 .a12-rail li { display: flex; flex-direction: column; gap: 6px; }
.a12 .a12-rail .seg { display: block; height: 4px; background: var(--c-rule); transition: background 0.3s ease; }
.a12 .a12-rail li.done .seg, .a12 .a12-rail li.cur .seg { background: var(--c-ink); }
.a12 .a12-rail li.later .seg { background: repeating-linear-gradient(90deg, var(--c-rule) 0 6px, transparent 6px 9px); }
.a12 .a12-rail .lbl { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.06em; color: var(--c-faint); }
.a12 .a12-rail li.cur .lbl { color: var(--c-ink); }
.a12 .a12-rail li.done .lbl { color: var(--c-text-3); }
.a12 .a12-meter { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
.a12 .a12-meter span { display: block; height: 3px; background: var(--c-rule); }
.a12 .a12-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.a12 .a12-swatch { width: 44px; height: 44px; border: 0; border-radius: 0; cursor: pointer; }
.a12 .a12-swatch[aria-checked="true"] { box-shadow: 0 0 0 2px var(--c-paper), 0 0 0 4px var(--c-ink); }
.a12 .a12-genres { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 1px; background: var(--c-rule); border: 1px solid var(--c-rule); }
.a12 .a12-genre { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; padding: 18px; border: 0; background: var(--c-white); color: var(--c-ink); text-align: left; cursor: pointer; min-height: 44px; }
.a12 .a12-genre .t { font-size: 19px; font-weight: 500; }
.a12 .a12-genre .s { font-size: 14px; color: var(--c-text-3); }
.a12 .a12-genre[aria-checked="true"] { background: var(--c-ink); color: var(--c-paper); }
.a12 .a12-genre[aria-checked="true"] .s { color: var(--c-slate-light); }
.a12 .a12-row { display: flex; gap: 12px; }
.a12 .a12-row .a12-btn:last-child { flex: 1; }
.a12 .a12-later { border: 1px dashed var(--c-rule); padding: 14px 16px; font-size: 14px; color: var(--c-text-3); background: var(--c-white); }
.a12 .a12-confirm { border-left: 4px solid var(--c-amber); background: var(--c-white); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.a12 .a12-confirm strong { font-weight: 600; }
.a12 .a12-sent { border-left: 4px solid var(--c-green); background: var(--c-white); padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; overflow-wrap: anywhere; }
.a12 .a12-sent p { margin: 0; }

.a12 .a12-preview { background: var(--c-ink); color: var(--c-paper); padding: clamp(28px, 5vw, 64px) var(--gutter); display: flex; flex-direction: column; justify-content: center; gap: 16px; }
.a12 .a12-preview .pl { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.08em; color: var(--c-slate-light-4); }
.a12 .a12-preview .note { font-size: 14px; color: var(--c-slate-light-4); max-width: 440px; }
.a12 .a12-card { background: var(--c-white); color: var(--c-ink); border-top: 5px solid var(--studio-accent); transition: border-color 0.35s ease; max-width: 520px; width: 100%; }
.a12 .a12-card .hd { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--c-rule); }
.a12 .a12-card .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.a12 .a12-card .who strong { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.a12 .a12-card .mark { width: 28px; height: 28px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--studio-accent); color: var(--studio-accent-ink, #fff); font-weight: 600; font-size: 14px; }
.a12 .a12-card .plan { font-family: var(--f-mono); font-size: 11px; color: var(--c-text-3); white-space: nowrap; }
.a12 .a12-card .bd { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.a12 .a12-card .gname { font-size: 18px; font-weight: 500; }
.a12 .a12-card .thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.a12 .a12-card .thumbs span { aspect-ratio: 1; display: block; background: var(--c-rule-soft); }
.a12 .a12-card .view { align-self: flex-start; padding: 10px 16px; background: var(--studio-accent); color: var(--studio-accent-ink, #fff); font-size: 14px; font-weight: 600; transition: background 0.35s ease; }

/* ============================================================
   First-run onboarding card on /app (palette remapped by app-a12.css inside the app).
   ============================================================ */
.a12.a12-onb { position: relative; margin-bottom: 24px; background: var(--c-white); border: 1px solid var(--c-rule); border-top: 5px solid var(--studio-accent); padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 16px; }
.a12.a12-onb .x { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: none; color: var(--c-text-3); cursor: pointer; font-size: 20px; line-height: 1; }
.a12.a12-onb .hd { display: flex; flex-direction: column; gap: 6px; padding-right: 44px; }
.a12.a12-onb h3 { font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 3vw, 36px); line-height: 1.05; letter-spacing: -0.015em; }
.a12.a12-onb .sub { font-size: 14px; color: var(--c-text-3); }
.a12.a12-onb ol.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; background: var(--c-rule); border: 1px solid var(--c-rule); }
.a12.a12-onb ol.list li { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--c-white); flex-wrap: wrap; }
.a12.a12-onb ol.list li.done { background: #fafbfc; }
.a12.a12-onb .tick { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--c-rule); font-family: var(--f-mono); font-size: 12px; color: var(--c-text-3); }
.a12.a12-onb li.done .tick { background: var(--c-green-text); border-color: var(--c-green-text); color: #fff; }
.a12.a12-onb .txt { flex: 1 1 220px; min-width: 0; }
.a12.a12-onb .txt .t { display: block; font-size: 15px; font-weight: 500; }
.a12.a12-onb li.done .txt .t { color: var(--c-text-3); text-decoration: line-through; }
.a12.a12-onb .txt .h { display: block; font-size: 13.5px; color: var(--c-text-3); margin-top: 1px; }
.a12.a12-onb .cta { flex: 0 0 auto; min-height: 44px; padding: 0 16px; display: inline-flex; align-items: center; border: 1px solid var(--c-ink); background: var(--c-white); color: var(--c-ink); font-size: 14px; font-weight: 500; }
.a12.a12-onb .cta.primary { background: var(--studio-accent); border-color: var(--studio-accent); color: var(--studio-accent-ink, #fff); }
.a12.a12-onb .cta:hover { background: var(--c-ink); color: var(--c-paper); }
