/* ============================================================
   Gaminvit console — design tokens + components.
   Warm editorial palette, hairline borders, no decorative noise.
   ============================================================ */

:root {
  --paper: #faf6ee;
  --paper-2: #f3ecdf;
  --card: #fffdf9;
  --ink: #2b2118;
  --ink-2: #5b4a3a;
  --ink-3: #8a7863;
  --line: #e3d9c8;
  --line-2: #d3c5ae;
  --rose: #b8556a;
  --rose-soft: #f6e2e4;
  --gold: #c98a12;
  --gold-soft: #fbeecb;
  --leaf: #4f7a52;
  --leaf-soft: #e3efe0;
  --danger: #a4443f;
  --danger-soft: #f7e4e1;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-1: 0 1px 2px rgba(43, 33, 24, 0.06), 0 4px 14px rgba(43, 33, 24, 0.05);
  --shadow-2: 0 10px 40px rgba(43, 33, 24, 0.14);

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;

  --wrap: 1140px;
  --nav-h: 62px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}

/* a whisper of paper grain — texture, not gradient */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 0.17 0 0 0 0 0.13 0 0 0 0 0.09 0 0 0 0.035 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app, #toast-root, #modal-root { position: relative; z-index: 1; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  z-index: 99;
}
.skip-link:focus { left: 0; }

a { color: var(--rose); text-underline-offset: 2px; }
a:hover { color: var(--ink); }

h1, h2, h3, h4 { font-family: var(--font-display); font-weight: 600; line-height: 1.2; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4.4vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; color: var(--ink-2); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 22px; }
.narrow { max-width: 720px; }

/* ============ NAV ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(250, 246, 238, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 1.28rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand .mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--gold);
  display: grid;
  place-items: center;
  font-size: 0.9rem;
  font-family: var(--font-body);
}
.nav-links { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.nav-link {
  padding: 0.42rem 0.7rem;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 140ms ease, color 140ms ease;
}
.nav-link:hover { background: var(--paper-2); color: var(--ink); }
.nav-link.is-active { background: var(--paper-2); color: var(--ink); font-weight: 600; }
.nav-user { display: flex; align-items: center; gap: 10px; padding-left: 10px; border-left: 1px solid var(--line); }
.nav-user .who { font-size: 0.86rem; color: var(--ink-3); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.62rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 0.93rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: transform 120ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: #3d3025; }
.btn-rose { background: var(--rose); color: #fff; }
.btn-rose:hover { background: #a24659; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b57c0d; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0.45rem 0.6rem; }
.btn-quiet:hover { background: var(--paper-2); color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 0.4rem 0.72rem; font-size: 0.85rem; }
.btn-lg { padding: 0.82rem 1.5rem; font-size: 1rem; }
.btn-block { width: 100%; }

/* ============ CARDS / LAYOUT ============ */
.section { padding: 46px 0; }
.section-tight { padding: 26px 0; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 22px;
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 16px; }
.card-head h3 { margin: 0; }
.card-head .sub { margin: 2px 0 0; font-size: 0.9rem; color: var(--ink-3); }
.card-head .spacer { margin-left: auto; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; align-items: start; }

@media (max-width: 900px) {
  .grid-3, .grid-4, .split { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ============ HERO ============ */
.hero { padding: 60px 0 30px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr); gap: 40px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 26px; } }
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 0.9rem;
}
.hero h1 { margin-bottom: 0.5rem; }
.hero .lede { font-size: 1.12rem; color: var(--ink-2); max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }

.frame {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
.frame-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 0.78rem;
  color: var(--ink-3);
  font-family: var(--font-mono);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.frame iframe { display: block; width: 100%; height: 400px; border: 0; background: #dfeaf0; }
.frame img { display: block; width: 100%; height: auto; }

/* ============ FORMS ============ */
.field { margin-bottom: 15px; }
.field > label, .field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 5px;
}
.field .hint { display: block; font-size: 0.79rem; color: var(--ink-3); margin-top: 4px; font-weight: 400; }
.input, .select, .textarea {
  width: 100%;
  padding: 0.6rem 0.72rem;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.94rem;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
.input-color { width: 46px; height: 34px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; cursor: pointer; }
.row-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 640px) { .row-2 { grid-template-columns: 1fr; } }
.row-inline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* repeatable list editor */
.list-block { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 10px; background: var(--paper); }
.list-block .list-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.list-block .list-index { font-family: var(--font-mono); font-size: 0.76rem; color: var(--ink-3); }
.list-block .list-actions { margin-left: auto; display: flex; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }
.icon-btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.list-empty { font-size: 0.88rem; color: var(--ink-3); padding: 6px 0; }

/* ============ TABLES / LISTS ============ */
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th {
  text-align: left;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-weight: 500;
}
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { font-variant-numeric: tabular-nums; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.03em;
}
.badge-draft { background: var(--paper-2); color: var(--ink-3); }
.badge-live { background: var(--leaf-soft); color: var(--leaf); }
.badge-rose { background: var(--rose-soft); color: var(--rose); }

.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .n { font-family: var(--font-display); font-size: 1.85rem; line-height: 1; }
.stat .l { font-size: 0.79rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--font-mono); }

.empty {
  text-align: center;
  padding: 42px 20px;
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  color: var(--ink-3);
  background: var(--card);
}
.empty h3 { color: var(--ink); }

.site-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
}
.site-item + .site-item { border-top: 1px solid var(--line); }
.site-item .meta { min-width: 0; }
.site-item .meta strong { display: block; font-family: var(--font-display); font-size: 1.12rem; }
.site-item .meta span { font-size: 0.85rem; color: var(--ink-3); }
.site-item .actions { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 640px) { .site-item { flex-wrap: wrap; } .site-item .actions { margin-left: 0; width: 100%; } }

/* ============ TABS (editor sections) ============ */
.tabs { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tab {
  padding: 0.5rem 0.8rem;
  border: 0;
  background: transparent;
  border-bottom: 2px solid transparent;
  color: var(--ink-3);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease, border-color 140ms ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--gold); }

/* ============ TOAST / MODAL ============ */
#toast-root { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  box-shadow: var(--shadow-2);
  animation: toast-in 220ms ease both;
}
.toast.is-error { background: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#modal-root[hidden] { display: none; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(43, 33, 24, 0.45);
  display: grid; place-items: center;
  padding: 20px;
  animation: fade-in 160ms ease both;
}
.modal {
  width: min(520px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 22px;
  animation: modal-in 200ms ease both;
}
.modal h3 { margin-top: 0; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(0.99); } to { opacity: 1; transform: none; } }

/* ============ VIEW TRANSITION ============ */
.view { animation: view-in 260ms cubic-bezier(0.22, 0.68, 0.36, 1) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ MISC ============ */
.muted { color: var(--ink-3); }
.small { font-size: 0.86rem; }
.mono { font-family: var(--font-mono); font-size: 0.86rem; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-row code {
  flex: 1 1 260px;
  min-width: 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  overflow-x: auto;
  white-space: nowrap;
}
.divider { height: 1px; background: var(--line); margin: 20px 0; border: 0; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { display: flex; align-items: center; gap: 8px; }
.price-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.price {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.price.is-featured { border-color: var(--gold); box-shadow: var(--shadow-1); }
.price .amount { font-family: var(--font-display); font-size: 1.9rem; }
.price ul { margin: 10px 0 0; padding-left: 1.1em; color: var(--ink-2); font-size: 0.9rem; }
.price li { margin-bottom: 4px; }

.steps { counter-reset: s; display: grid; gap: 14px; }
.step { display: flex; gap: 14px; }
.step::before {
  counter-increment: s;
  content: counter(s);
  flex: 0 0 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.step h4 { margin: 3px 0 2px; font-family: var(--font-body); font-size: 1rem; }
.step p { margin: 0; font-size: 0.92rem; }

.footer { border-top: 1px solid var(--line); padding: 30px 0 50px; margin-top: 40px; color: var(--ink-3); font-size: 0.88rem; }

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