/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Theme variables ──────────────────────────────────────── */
:root {
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono:  'DM Mono', monospace;
  --accent:  #c8f060;
  --accent2: #f0c060;
  --accent-dark: #0d0d0d;
}

[data-theme="dark"] {
  --bg:     #0d0d0d;
  --bg2:    #141414;
  --bg3:    #1a1a1a;
  --border: #2a2a2a;
  --border2:#363636;
  --text:   #e8e4dc;
  --muted:  #6b6760;
  --code-bg:#222;
  --embed-text: #9a9590;
}

[data-theme="light"] {
  --bg:     #f5f3ee;
  --bg2:    #ffffff;
  --bg3:    #eeece8;
  --border: #dddbd5;
  --border2:#ccc9c2;
  --text:   #1a1917;
  --muted:  #8a8780;
  --code-bg:#e8e6e0;
  --embed-text: #6a6860;
}

/* ── Transition on theme switch ───────────────────────────── */
body, nav, .widget-card, .embed-box, .notion-hint, footer {
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.7;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Grain ────────────────────────────────────────────────── */
.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ── Nav ──────────────────────────────────────────────────── */
nav {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 48px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.logo-dot { color: var(--accent); }

.nav-tag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* push toggle to right */
.theme-toggle { margin-left: auto; cursor: pointer; }

.toggle-track {
  position: relative;
  width: 52px;
  height: 26px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 0 5px;
  justify-content: space-between;
  transition: background 0.3s;
}

.toggle-icon {
  font-size: 11px;
  line-height: 1;
  user-select: none;
  color: var(--muted);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}

[data-theme="light"] .toggle-thumb {
  transform: translateX(26px);
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  max-width: 860px;
  margin: 0 auto;
  padding: 100px 48px 80px;
}

.hero-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
}
[data-theme="light"] .hero-label { color: #5a8a10; }

.hero-label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 1px;
  background: currentColor;
}

h1 {
  font-family: var(--font-serif);
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 28px;
}
h1 em { font-style: italic; color: var(--accent2); }
[data-theme="light"] h1 em { color: #b07010; }

.hero-sub {
  font-size: 15px;
  color: var(--muted);
  max-width: 540px;
  line-height: 1.8;
  margin-bottom: 40px;
}

.cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #0d0d0d;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  padding: 12px 28px;
  border-radius: 999px;
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: transform 0.2s, box-shadow 0.2s;
}
.cta-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(200,240,96,0.25);
}
[data-theme="light"] .cta-btn { background: #3a6b00; color: #fff; }
[data-theme="light"] .cta-btn:hover { box-shadow: 0 8px 24px rgba(58,107,0,0.2); }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 48px;
  max-width: 1100px;
  margin: 0 auto 48px;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.divider span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ── Widget Grid ──────────────────────────────────────────── */
.widget-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 48px 120px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 24px;
}

/* ── Widget Card ──────────────────────────────────────────── */
.widget-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: border-color 0.2s, background 0.3s;
}
.widget-card:hover { border-color: var(--border2); }

.widget-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.widget-name {
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
}

.widget-desc { font-size: 13px; color: var(--muted); line-height: 1.6; }

.widget-badge {
  flex-shrink: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(200,240,96,0.1);
  color: var(--accent);
  border: 1px solid rgba(200,240,96,0.2);
  padding: 4px 10px;
  border-radius: 999px;
}
[data-theme="light"] .widget-badge {
  background: rgba(58,107,0,0.08);
  color: #3a6b00;
  border-color: rgba(58,107,0,0.2);
}

/* ── Widget theme row ─────────────────────────────────────── */
.widget-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.widget-theme-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.widget-theme-toggle {
  display: flex;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.wt-btn {
  padding: 5px 14px;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: color 0.15s, background 0.15s;
}
.wt-btn.active {
  background: var(--accent);
  color: #0d0d0d;
}
[data-theme="light"] .wt-btn.active { background: #3a6b00; color: #fff; }
.wt-btn:not(.active):hover { color: var(--text); }

/* ── Widget Preview ───────────────────────────────────────── */
.widget-preview {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  height: 180px;
}
.widget-preview iframe { width: 100%; height: 100%; border: none; display: block; }

/* ── Embed Box ────────────────────────────────────────────── */
.embed-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 16px 14px;
}
.embed-box-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}
.embed-code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--embed-text);
  line-height: 1.7;
  white-space: pre;
  overflow-x: auto;
  padding-bottom: 14px;
}

/* ── Copy Buttons ─────────────────────────────────────────── */
.copy-btns { display: flex; gap: 8px; }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg3);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 0.03em;
}
.copy-btn:hover {
  background: var(--accent);
  color: #0d0d0d;
  border-color: var(--accent);
}
[data-theme="light"] .copy-btn:hover { background: #3a6b00; color: #fff; border-color: #3a6b00; }
.copy-btn.copied { background: var(--accent); color: #0d0d0d; border-color: var(--accent); }
[data-theme="light"] .copy-btn.copied { background: #3a6b00; color: #fff; border-color: #3a6b00; }

/* ── Notion Hint ──────────────────────────────────────────── */
.notion-hint {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
}
.notion-hint svg { flex-shrink: 0; opacity: 0.6; }
.notion-hint code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--code-bg);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 4px;
}
[data-theme="light"] .notion-hint code { color: #3a6b00; }

/* ── Footer ───────────────────────────────────────────────── */
footer {
  border-top: 1px solid var(--border);
  padding: 28px 48px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
footer a { color: var(--muted); text-decoration: underline; }
footer a:hover { color: var(--text); }

/* ── Animations ───────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hero { animation: fadeUp 0.7s ease both; }
.widget-card { animation: fadeUp 0.6s ease both; animation-delay: 0.15s; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 640px) {
  nav, .hero, .widget-grid, .divider, footer { padding-left: 20px; padding-right: 20px; }
  .hero { padding-top: 60px; }
  .widget-grid { grid-template-columns: 1fr; }
}

/* ── Dark / Light copy buttons ────────────────────────────── */
.dark-btn {
  background: #191919;
  color: #e8e4dc;
  border-color: #3a3a3a;
}
.dark-btn:hover, .dark-btn.copied {
  background: var(--accent);
  color: #0d0d0d;
  border-color: var(--accent);
}
[data-theme="light"] .dark-btn:hover,
[data-theme="light"] .dark-btn.copied {
  background: #3a6b00;
  color: #fff;
  border-color: #3a6b00;
}

.light-btn {
  background: #ffffff;
  color: #1a1917;
  border-color: #ddd;
}
.light-btn:hover, .light-btn.copied {
  background: var(--accent);
  color: #0d0d0d;
  border-color: var(--accent);
}
[data-theme="light"] .light-btn:hover,
[data-theme="light"] .light-btn.copied {
  background: #3a6b00;
  color: #fff;
  border-color: #3a6b00;
}

/* ── Name input ───────────────────────────────────────────── */
.name-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 4px;
}
.name-input:focus { border-color: var(--border2); }
.name-input::placeholder { color: var(--muted); }

/* ── Name input ───────────────────────────────────────────── */
.name-input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  margin-top: 4px;
}
.name-input::placeholder { color: var(--muted); }
.name-input:focus { border-color: var(--border2); }
[data-theme="light"] .name-input { background: var(--bg3); }