/* Shared foundation: tokens, preview bar, dialogs, toasts, buttons, motion. */
:root {
  --ink: #15181f;
  --ink-2: #2b3038;
  --muted: #5e6470;
  --line: #e2ddd4;
  --line-2: #efebe4;
  --paper: #faf8f4;
  --white: #ffffff;
  --stone: #f1ede6;
  --sand: #e8e1d5;
  --accent: #a0551f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e7da;
  --ok: #2a6f47;
  --ok-soft: #e3f1e7;
  --warn: #8a5e0e;
  --warn-soft: #fbf0d6;
  --info: #2c5f8a;
  --info-soft: #e1ecf6;
  --danger: #a33a2a;
  --danger-soft: #f8e3df;
  --sgl-ink: #08181a;
  --sgl-ink-2: #0d2c33;
  --sgl-leaf: #426544;
  --sgl-fresh: #8fbf72;
  --sgl-grape: #77475b;
  --sgl-grape-2: #b07a96;
  --sgl-sand: #eadfc9;
  --sgl-foam: #f3efe3;
  --sgl-mist: #a9bdb5;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Manrope", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(21, 24, 31, .06), 0 8px 24px rgba(21, 24, 31, .08);
  --shadow-lg: 0 2px 4px rgba(21, 24, 31, .06), 0 24px 60px rgba(21, 24, 31, .16);
  --bar-h: 52px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--paper); line-height: 1.55; font-size: 16px; -webkit-font-smoothing: antialiased; padding-top: var(--bar-h); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 1em; }
.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; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px; z-index: 300; }
.skip:focus { top: calc(var(--bar-h) + 8px); }
body.has-dialog { overflow: hidden; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 20px; border-radius: 999px; border: 1.5px solid transparent; font-weight: 600; font-size: 15px; line-height: 1.1; cursor: pointer; text-decoration: none; transition: transform .18s var(--ease), background .18s, border-color .18s, box-shadow .18s; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; box-shadow: 0 6px 18px rgba(21, 24, 31, .2); }
.btn.accent { background: var(--accent); color: var(--accent-ink); }
.btn.accent:hover { background: #8c4a1a; box-shadow: 0 6px 18px rgba(181, 101, 44, .3); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { background: var(--white); border-color: var(--ink); }
.btn.light { background: #fff; color: var(--ink); }
.btn.light:hover { background: var(--stone); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { padding: 8px 14px; font-size: 13.5px; }
.btn.xs { padding: 6px 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }
.btn .arrow { transition: transform .18s var(--ease); display: inline-block; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Preview bar (Sea Grape Labs) ---------- */
.demo-bar { position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 200; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--sgl-ink); color: var(--sgl-foam); border-bottom: 1px solid rgba(255, 255, 255, .08); font-family: var(--sans); }
.demo-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; flex: 0 0 auto; }
.demo-brand .sgl-mark { width: 30px; height: 30px; }
.demo-brand span { display: flex; flex-direction: column; line-height: 1.05; }
.demo-brand b { font-size: 13.5px; font-weight: 700; letter-spacing: .01em; }
.demo-brand small { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--sgl-mist); margin-top: 2px; }
.demo-steps { display: flex; align-items: center; gap: 4px; margin: 0 auto; }
.demo-step { white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; text-decoration: none; color: var(--sgl-mist); font-size: 13px; font-weight: 600; transition: background .15s, color .15s; }
.demo-step:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.demo-step-n { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; background: rgba(255, 255, 255, .1); }
.demo-step.is-done .demo-step-n { background: var(--sgl-leaf); color: #fff; }
.demo-step.is-current { background: var(--sgl-foam); color: var(--sgl-ink); }
.demo-step.is-current .demo-step-n { background: var(--sgl-ink); color: #fff; }
.demo-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.demo-pill { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--sgl-sand); border: 1px solid rgba(234, 223, 201, .35); padding: 5px 9px; border-radius: 999px; }
.demo-next { color: #fff; text-decoration: none; font-size: 13px; font-weight: 700; background: var(--sgl-leaf); padding: 7px 12px; border-radius: 999px; transition: background .15s; }
.demo-next:hover { background: #557f57; }
.demo-reset { background: transparent; border: 1px solid rgba(255, 255, 255, .22); color: var(--sgl-foam); border-radius: 999px; padding: 6px 11px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.demo-reset:hover { border-color: #fff; }
.demo-bar :focus-visible { outline-color: var(--sgl-fresh); }
.demo-menu { display: none; margin-left: auto; width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; flex-direction: column; gap: 5px; align-items: center; justify-content: center; border-radius: 8px; }
.demo-menu span { width: 20px; height: 2px; background: var(--sgl-foam); border-radius: 2px; }
@media (max-width: 1060px) {
  .demo-pill { display: none; }
  .demo-step-l { display: none; }
  .demo-step { padding: 6px; }
  .demo-step.is-current .demo-step-l { display: inline; }
}
@media (max-width: 900px) { .demo-next { display: none; } }
.demo-mobile { display: none; }
@media (max-width: 760px) {
  :root { --bar-h: 130px; }
  .demo-bar { gap: 8px; padding: 0 10px; flex-wrap: wrap; align-content: flex-start; }
  .demo-bar > .demo-brand, .demo-bar > .demo-menu { height: 52px; display: flex; align-items: center; }
  .demo-mobile { display: block; flex: 1 1 100%; order: 10; padding: 0 2px 8px; }
  .demo-track { height: 3px; background: rgba(255, 255, 255, .12); border-radius: 3px; overflow: hidden; margin: 0 0 8px; }
  .demo-track span { display: block; height: 100%; background: var(--sgl-fresh); border-radius: 3px; transition: width .6s var(--ease); }
  .demo-mobile-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .demo-dots { display: flex; gap: 6px; justify-content: center; flex: 1; }
  .demo-dot { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 800; text-decoration: none; color: var(--sgl-mist); background: rgba(255, 255, 255, .1); }
  .demo-dot.is-done { background: var(--sgl-leaf); color: #fff; }
  .demo-dot.is-current { background: var(--sgl-foam); color: var(--sgl-ink); box-shadow: 0 0 0 3px rgba(143, 191, 114, .35); }
  .demo-mobile-prev, .demo-mobile-next { flex: 0 0 auto; min-width: 44px; text-align: center; text-decoration: none; color: #fff; font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); }
  .demo-mobile-next { background: var(--sgl-leaf); }
  .demo-mobile-prev.is-empty { background: transparent; }
  .demo-mobile-label { text-align: center; font-size: 12px; color: var(--sgl-mist); margin-top: 6px; }
  .demo-mobile-label b { color: #fff; }
  .demo-mobile-label span { color: var(--sgl-mist); }
  .demo-bar.is-open .demo-steps { top: var(--bar-h); }
  .demo-steps, .demo-right { display: none; }
  .demo-menu { display: flex; }
  .demo-bar.is-open .demo-steps, .demo-bar.is-open .demo-right { display: flex; position: absolute; left: 0; right: 0; background: var(--sgl-ink-2); padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .demo-bar.is-open .demo-steps { top: var(--bar-h); flex-wrap: wrap; gap: 6px; }
  .demo-bar.is-open .demo-step-l { display: inline; }
  .demo-bar.is-open .demo-right { top: calc(var(--bar-h) + 104px); justify-content: space-between; box-shadow: 0 12px 24px rgba(0, 0, 0, .3); }
}

/* ---------- Dialogs ---------- */
.dlg-backdrop { position: fixed; inset: 0; z-index: 400; background: rgba(21, 24, 31, .45); display: grid; place-items: center; padding: 20px; opacity: 0; transition: opacity .2s; backdrop-filter: blur(3px); }
.dlg-backdrop.is-in { opacity: 1; }
.dlg { background: #fff; color: var(--ink); width: min(100%, 760px); max-height: calc(100vh - 40px); border-radius: 18px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateY(12px) scale(.985); transition: transform .22s var(--ease); overflow: hidden; }
.dlg.sm { width: min(100%, 460px); }
.dlg.lg { width: min(100%, 980px); }
.dlg.xl { width: min(100%, 1180px); }
.dlg-backdrop.is-in .dlg { transform: none; }
.dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--line-2); }
.dlg-title { font-size: 20px; font-weight: 700; }
.dlg-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.dlg-x { background: var(--stone); border: 0; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; flex: 0 0 auto; }
.dlg-x:hover { background: var(--sand); }
.dlg-body { padding: 20px 24px; overflow: auto; }
.dlg-body p:last-child { margin-bottom: 0; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px 20px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
@media (max-width: 600px) { .dlg-backdrop { padding: 0; align-items: end; } .dlg { max-height: 94vh; border-radius: 18px 18px 0 0; } }

/* ---------- Toasts ---------- */
.toast-wrap { position: fixed; right: 16px; bottom: 16px; z-index: 500; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; background: var(--ink); color: #fff; padding: 12px 12px 12px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); transform: translateY(12px); opacity: 0; transition: transform .25s var(--ease), opacity .25s; font-size: 14px; }
.toast.is-in { transform: none; opacity: 1; }
.toast-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: 0 0 auto; }
.toast-ok .toast-dot { background: #6cc48a; }
.toast-body a { color: #fff; font-weight: 700; }
.toast-x { background: transparent; border: 0; color: #fff; opacity: .7; font-size: 18px; cursor: pointer; line-height: 1; padding: 0 2px; margin-left: auto; }

/* ---------- Status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; letter-spacing: .01em; white-space: nowrap; background: var(--stone); color: var(--ink-2); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.list .ico.issue { background: var(--danger-soft); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: #8a4a1b; }
.pill.plain::before { display: none; }
.sample-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); border: 1px dashed var(--line); padding: 4px 9px; border-radius: 6px; background: rgba(255, 255, 255, .6); }

/* ---------- Motion ---------- */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
[data-reveal].is-visible { opacity: 1; transform: none; }
[data-reveal="2"] { transition-delay: .12s; }
[data-reveal="3"] { transition-delay: .24s; }
[data-reveal="4"] { transition-delay: .36s; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  [data-reveal] { opacity: 1; transform: none; }
}

/* ---------- Guided scenarios ---------- */
.guide { position: fixed; left: 16px; bottom: 16px; z-index: 350; width: min(380px, calc(100vw - 32px)); background: var(--sgl-ink); color: var(--sgl-foam); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-lg); font-family: var(--sans); border: 1px solid rgba(255, 255, 255, .1); }
.guide-head { display: flex; align-items: center; gap: 10px; }
.guide-head .sgl-mark { width: 28px; height: 28px; flex: 0 0 auto; }
.guide-head span { flex: 1; line-height: 1.15; }
.guide-head b { font-size: 14px; display: block; }
.guide-head small { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--sgl-mist); }
.guide-x { background: rgba(255, 255, 255, .1); border: 0; color: #fff; width: 30px; height: 30px; border-radius: 50%; font-size: 18px; cursor: pointer; }
.guide p { margin: 12px 0; font-size: 14px; line-height: 1.5; color: #e6ebe7; }
.guide-foot { display: flex; justify-content: space-between; gap: 8px; }
.guide .btn.primary { background: var(--sgl-leaf); color: #fff; }
.guide .btn.ghost { border-color: rgba(255, 255, 255, .3); color: var(--sgl-foam); }
.guide :focus-visible { outline-color: var(--sgl-fresh); }
.guide-target { outline: 3px solid var(--sgl-fresh) !important; outline-offset: 6px; border-radius: 12px; animation: guidepulse 1.6s ease-in-out 3; }
@keyframes guidepulse { 0%, 100% { outline-color: var(--sgl-fresh); } 50% { outline-color: transparent; } }
@media (max-width: 600px) { .guide { left: 8px; right: 8px; bottom: 8px; width: auto; } .toast-wrap { bottom: 150px; } }
