/* Lexica — shared design system (washi paper, sumi ink, sakura pink). */

:root {
  --paper: #fbf8f4;
  --paper-2: #f6f0ea;
  --card: #fffdfb;
  --ink: #2a211f;
  --ink-2: #5a4c48;
  --ink-3: #8d7f7a;
  --line: #ece3dc;
  --line-2: #dfd2c9;
  --bark: #3a2a27;
  --sakura: #e48aa6;
  --sakura-deep: #c2456f;
  --sakura-ink: #a3305a;
  --sakura-pale: #fcebf0;
  --seal: #c8312f;
  /* Surfaces & tints the themes (assets/themes.css) re-colour. The --sakura-* names are the accent family. */
  --on-ink: #fff;                               /* text on an --ink background */
  --on-accent: #fff;                            /* text on --sakura-deep / --accent-hover */
  --accent-hover: var(--sakura-ink);            /* filled-button hover */
  --glass: rgba(255, 253, 251, 0.86);
  --glass-bar: rgba(251, 248, 244, 0.82);
  --field: #fff;
  --accent-line: #f3c6d4;
  --accent-soft: #f8d5df;
  --ghost-kanji: #f3ece6;
  --faint: #b7a9a3;
  --muted-bg: #f3eeea;
  --muted-line: #c9bbb4;
  --hover-wash: rgba(252, 235, 240, 0.45);
  --out-wash: rgba(246, 240, 234, 0.55);
  --stripe: rgba(236, 227, 220, 0.5);
  --error: #d24b5a;
  --error-bg: #fff5f6;
  --error-ink: #b5283f;
  --toast-bg: var(--ink);
  --toast-ink: #fff;
  --backdrop: rgba(42, 33, 31, 0.32);
  --shadow-lg: 0 30px 80px rgba(42, 33, 31, 0.25);
  --wash-1: rgba(244, 179, 198, 0.16);
  --wash-2: rgba(228, 138, 166, 0.08);
  --focus: 0 0 0 3px rgba(194, 69, 111, 0.22);
  --shadow-sm: 0 1px 2px rgba(58, 42, 39, 0.06), 0 2px 8px rgba(58, 42, 39, 0.04);
  --shadow-md: 0 2px 6px rgba(58, 42, 39, 0.06), 0 14px 36px rgba(58, 42, 39, 0.09);
  --radius: 14px;
  --font-display: 'Shippori Mincho', 'Hiragino Mincho ProN', 'Yu Mincho', Georgia, serif;
  --font-ui: 'Zen Kaku Gothic New', 'Hiragino Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  transition: background-color .4s, color .4s;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* Faint washi fibres */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--wash-1), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, var(--wash-2), transparent 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .2 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

a { color: var(--sakura-ink); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--card); color: var(--ink);
  font-weight: 500; font-size: 14px; letter-spacing: 0.01em;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .1s;
}
.btn:hover { border-color: var(--sakura); color: var(--sakura-ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn--sakura { background: var(--sakura-deep); border-color: var(--sakura-deep); color: var(--on-accent); }
.btn--sakura:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--sakura-pale); border-color: transparent; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; padding: 0; }
.btn--sm.btn--icon { width: 32px; }

/* ---------- Vertical lettering (as on sakura prints) ---------- */
.vletters { display: flex; gap: 18px; font-family: var(--font-display); user-select: none; }
.vletters__col { display: flex; flex-direction: column; align-items: center; gap: 0.32em; line-height: 1; }
.vletters__col span { display: block; }
.vletters__col--ink { color: var(--ink); }
.vletters__col--pink { color: var(--sakura-deep); }
.vletters__gap { height: 0.5em; }

/* Hanko seal */
.seal {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 6px;
  background: var(--seal); color: #fff;
  font: 700 15px/1 var(--font-display); letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .22);
  transform: rotate(-4deg);
}

/* ---------- Falling petals ---------- */
.sakura-fall { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.sakura-fall__petal {
  position: absolute; top: -40px; display: block;
  animation-name: lx-fall, lx-flutter;
  animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite;
  animation-direction: normal, alternate;
}
.sakura-fall__petal svg { display: block; width: 100%; height: 100%; }
@keyframes lx-fall {
  0%   { transform: translate3d(0, -5vh, 0) rotate(0deg); }
  100% { transform: translate3d(var(--drift), 110vh, 0) rotate(560deg); }
}
@keyframes lx-flutter {
  0%   { margin-left: -14px; scale: 1 1; }
  100% { margin-left: 14px; scale: .55 1; }
}

.sakura-svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(440px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--toast-bg); color: var(--toast-ink); font-size: 14px;
  box-shadow: var(--shadow-md);
  animation: lx-toast-in .25s ease-out;
}
.toast--error { background: #8f1d33; }
@keyframes lx-toast-in { from { opacity: 0; transform: translateY(8px); } }

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