/* ── TOKENS ── */
:root {
  --bg:            #f0ede8;
  --bg2:           #e8e4de;
  --card:          rgba(255,252,248,0.92);
  --card-solid:    #fdfaf6;
  --ink:           #1c1814;
  --ink2:          #3a342e;
  --muted:         #8c8077;
  --faint:         #b5afa8;
  --border:        rgba(28,24,20,0.08);
  --border-hard:   rgba(28,24,20,0.14);
  --accent:        #10b981;
  --accent-light:  rgba(16,185,129,0.09);
  --accent-glow:   rgba(16,185,129,0.20);
  --neu-out:       5px 5px 12px rgba(0,0,0,0.07), -4px -4px 10px rgba(255,255,255,0.90);
  --neu-in:        inset 2px 2px 6px rgba(0,0,0,0.07), inset -2px -2px 5px rgba(255,255,255,0.80);
  --grid-line:     rgba(28,24,20,0.10);
  --success:       #3eb97a;
  --warning:       #d4920a;
  --error:         #c0392b;
  --nav-h:         62px;
  --radius:        14px;
  --f-display:     'DM Serif Display', Georgia, serif;
  --f-body:        'Syne', system-ui, sans-serif;
  --f-mono:        'DM Mono', 'Fira Mono', monospace;
}

/* ── DARK MODE ── */
body.dark {
  --bg:            #2b2e36;
  --bg2:           #343840;
  --card:          rgba(46,50,61,0.92);
  --card-solid:    #2e3239;
  --ink:           #f0ece6;
  --ink2:          #cec8bf;
  --muted:         #8c877f;
  --faint:         #5c5750;
  --border:        rgba(240,236,230,0.07);
  --border-hard:   rgba(240,236,230,0.13);
  --accent:        #34d399;
  --accent-light:  rgba(52,211,153,0.12);
  --accent-glow:   rgba(52,211,153,0.24);
  --neu-out:       5px 5px 14px rgba(0,0,0,0.38), -3px -3px 8px rgba(255,255,255,0.03);
  --neu-in:        inset 2px 2px 6px rgba(0,0,0,0.32), inset -2px -2px 5px rgba(255,255,255,0.025);
  --grid-line:     rgba(240,236,230,0.07);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--f-body);
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background .35s, color .35s;
  line-height: 1.6;
}

/* ── GRAIN OVERLAY ── */
.grain {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: .026;
  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: 180px;
}

/* ── ANIMATED GRID ── */
.grid-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }

.grid-line-v {
  position: absolute;
  width: 1px;
  top: 0;
  bottom: 0;
  background: var(--grid-line);
  overflow: hidden;
}

.grid-line-h {
  position: absolute;
  height: 1px;
  left: 0;
  right: 0;
  background: var(--grid-line);
  overflow: hidden;
}

.grid-comet-v {
  position: absolute;
  left: -1px;
  right: -1px;
  border-radius: 999px;
  animation: cometV linear infinite;
  background: linear-gradient(180deg,
    transparent 0%,
    var(--accent) 20%,
    var(--accent) 80%,
    transparent 100%
  );
  height: 50px;
  opacity: 0.4;
  filter: blur(4px);
}

.grid-comet-h {
  position: absolute;
  top: -1px;
  bottom: -1px;
  border-radius: 999px;
  animation: cometH linear infinite;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent) 20%,
    var(--accent) 80%,
    transparent 100%
  );
  width: 50px;
  opacity: 0.4;
  filter: blur(4px);
}

@keyframes cometV {
  0%   { top: -20%; opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.5; }
  100% { top: 110%; opacity: 0; }
}
@keyframes cometH {
  0%   { left: -20%; opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.5; }
  100% { left: 110%; opacity: 0; }
}

/* ── NAVIGATION ── */
nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 48px;
  background: var(--card);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  transition: background .35s;
}

.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none;
}

.nav-logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 10px var(--accent-glow);
  flex-shrink: 0;
}
.nav-logo.sm { width: 26px; height: 26px; font-size: .85rem; border-radius: 7px; }

.nav-brand-name {
  font-family: var(--f-mono);
  font-weight: 600;
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
}

.nav-right { display: flex; align-items: center; gap: 10px; }

.nav-link {
  padding: 7px 16px;
  border-radius: 9px;
  font-family: var(--f-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  transition: all .2s;
  background: none;
  cursor: pointer;
}
.nav-link:hover {
  color: var(--ink);
  background: var(--accent-light);
  border-color: var(--border-hard);
}
.nav-link.filled {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  box-shadow: var(--neu-out);
}
.nav-link.filled:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.theme-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border-hard);
  background: var(--card-solid);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: .78rem;
  box-shadow: var(--neu-out);
  transition: all .2s;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ── HERO SECTION ── */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--nav-h) + 60px) 24px 80px;
  overflow: hidden;
}

.hero-inner {
  position: relative; z-index: 2;
  max-width: 740px;
  width: 100%;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 28px;
}

.hero-grid { position: absolute; inset: 0; z-index: 0; pointer-events: none; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-hard);
  background: var(--card);
  backdrop-filter: blur(8px);
  font-family: var(--f-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .08em;
  color: var(--muted);
  box-shadow: var(--neu-out);
}
.dot-live {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(62,185,122,.2);
  animation: livePulse 2s ease infinite;
}
@keyframes livePulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(62,185,122,.2); }
  50%      { box-shadow: 0 0 0 6px rgba(62,185,122,0); }
}

.hero-title {
  display: flex; flex-direction: column; gap: 2px;
  font-family: var(--f-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 1.05;
  color: var(--ink);
  animation: fadeUp .7s cubic-bezier(.22,1,.36,1) both;
}
.title-line { display: block; }
.title-line.italic {
  font-style: italic;
  color: var(--accent);
}

@keyframes fadeUp {
  from { opacity:0; transform: translateY(24px); }
  to   { opacity:1; transform: translateY(0); }
}

.hero-desc {
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 500px;
  animation: fadeUp .7s .12s cubic-bezier(.22,1,.36,1) both;
}

.hero-actions {
  display: flex; gap: 12px; flex-wrap: wrap; justify-content: center;
  animation: fadeUp .7s .22s cubic-bezier(.22,1,.36,1) both;
}

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 26px;
  border-radius: 10px;
  font-family: var(--f-mono);
  font-weight: 500;
  font-size: .78rem;
  letter-spacing: .06em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all .22s cubic-bezier(.34,1.56,.64,1);
}
.btn-primary {
  background: var(--ink);
  color: var(--bg);
  box-shadow: var(--neu-out);
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--accent-glow);
}
.btn-ghost {
  background: var(--card);
  color: var(--ink2);
  border: 1px solid var(--border-hard);
  backdrop-filter: blur(8px);
  box-shadow: var(--neu-out);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

/* ── CODE TERMINAL ── */
.hero-code {
  width: 100%;
  max-width: 560px;
  border-radius: var(--radius);
  border: 1px solid var(--border-hard);
  background: var(--card);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow: 0 20px 60px rgba(0,0,0,.10), var(--neu-out);
  overflow: hidden;
  animation: fadeUp .7s .34s cubic-bezier(.22,1,.36,1) both;
  text-align: left;
}
.code-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.code-dot {
  width: 10px; height: 10px; border-radius: 50%;
}
.code-dot.r { background: #ff5f57; }
.code-dot.y { background: #febc2e; }
.code-dot.g { background: #28c840; }
.code-label {
  margin-left: 6px;
  font-family: var(--f-mono);
  font-size: .65rem;
  color: var(--faint);
  letter-spacing: .06em;
}
.code-body {
  padding: 14px 18px 16px;
  font-family: var(--f-mono);
  font-size: .72rem;
  line-height: 1.8;
  color: var(--ink2);
  overflow-x: auto;
  min-height: 148px;
}
.term-line {
  display: flex; align-items: flex-start; gap: 8px;
  white-space: pre-wrap; word-break: break-all;
}
.term-prompt {
  color: var(--success);
  font-weight: 500;
  flex-shrink: 0;
  margin-top: 1px;
  user-select: none;
}
.term-output { white-space: pre-wrap; word-break: break-all; flex: 1; }
.term-cursor {
  display: inline-block;
  width: 7px; height: 1em;
  background: var(--accent);
  margin-left: 1px;
  vertical-align: text-bottom;
  animation: cursorBlink .8s step-end infinite;
  flex-shrink: 0;
}
.term-cursor.hidden { opacity: 0; }
@keyframes cursorBlink { 0%,100%{opacity:1} 50%{opacity:0} }
.term-response {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  white-space: pre-wrap; word-break: break-all;
  opacity: 0;
  transition: opacity .4s ease;
}
.term-response.visible { opacity: 1; }
.term-response .resp-prefix { color: var(--success); font-weight: 500; }
.term-response .resp-key    { color: var(--faint); }
.term-response .resp-str    { color: var(--success); }
.term-response .resp-num    { color: #f59e0b; }
.term-response .resp-bool   { color: var(--accent); }
.c-kw  { color: var(--accent); font-weight: 500; }
.c-str { color: var(--success); }

/* ── SECTION HEADER ── */
.section-header {
  text-align: center;
  margin-bottom: 56px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.section-tag {
  font-family: var(--f-mono);
  font-size: .65rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 4px 12px;
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  background: var(--accent-light);
}
.section-title {
  font-family: var(--f-display);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.2;
  color: var(--ink);
}
.section-title em {
  font-style: italic;
  color: var(--accent);
}

/* ── FEATURES SECTION ── */
.features-section {
  padding: 100px 24px;
  position: relative;
}
.features-inner { max-width: 1100px; margin: 0 auto; }

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.feature-card {
  position: relative;
  background: var(--card);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  padding: 32px 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--neu-out);
  transition: all .28s cubic-bezier(.22,1,.36,1);
  overflow: hidden;
}
.feature-card::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.feature-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 48px var(--accent-glow), var(--neu-out);
  border-color: var(--border-hard);
}
.feature-card:hover::before { opacity: 1; }
.feature-card:hover .feature-num { color: var(--accent); }

.feature-num {
  position: absolute; top: 20px; right: 24px;
  font-family: var(--f-mono);
  font-size: .6rem;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: .1em;
  transition: color .3s;
}
.feature-icon {
  width: 46px; height: 46px; border-radius: 12px;
  background: var(--bg2);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem;
  margin-bottom: 18px;
  box-shadow: var(--neu-out);
  transition: all .3s;
}
.feature-card:hover .feature-icon {
  background: var(--accent);
  color: #fff;
}
.feature-title {
  font-family: var(--f-display);
  font-size: 1.15rem;
  font-weight: normal;
  margin-bottom: 8px;
  color: var(--ink);
}
.feature-desc {
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.7;
}

/* ── FAQ SECTION ── */
.faq-section {
  padding: 100px 24px;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.faq-inner { max-width: 1100px; margin: 0 auto; }

.faq-list {
  max-width: 720px;
  margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}

.faq-item {
  background: var(--card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--neu-out);
  transition: border-color .2s, box-shadow .2s;
}
.faq-item:hover { border-color: var(--border-hard); }
.faq-item.open  { border-color: var(--accent); }

.faq-question {
  width: 100%; padding: 20px 24px;
  background: none; border: none;
  text-align: left;
  font-family: var(--f-body);
  font-size: .92rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  transition: color .2s;
}
.faq-question:hover { color: var(--accent); }
.faq-question i {
  flex-shrink: 0;
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--border-hard);
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem;
  color: var(--muted);
  transition: transform .3s, background .2s, color .2s, border-color .2s;
  box-shadow: var(--neu-in);
}
.faq-item.open .faq-question i {
  transform: rotate(45deg);
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.faq-answer {
  max-height: 0; overflow: hidden;
  transition: max-height .35s ease;
}
.faq-item.open .faq-answer { max-height: 500px; }
.faq-answer p {
  padding: 0 24px 20px;
  color: var(--muted);
  line-height: 1.75;
  font-size: .88rem;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  padding: 32px 48px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 16px;
  background: var(--card);
  backdrop-filter: blur(12px);
}
.footer-brand {
  display: flex; align-items: center; gap: 9px;
}
.footer-name {
  font-family: var(--f-mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink2);
}
.footer-copy {
  font-family: var(--f-mono);
  font-size: .68rem;
  color: var(--faint);
  letter-spacing: .04em;
}
.footer-links { display: flex; gap: 20px; }
.footer-links a {
  font-family: var(--f-mono);
  font-size: .7rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: .06em;
  transition: color .2s;
}
.footer-links a:hover { color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 960px) {
  nav { padding: 0 24px; }
}
@media (max-width: 768px) {
  .features-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  nav { padding: 0 20px; }
  footer { padding: 24px 20px; flex-direction: column; align-items: flex-start; }
  .features-section, .faq-section { padding: 72px 20px; }
}
@media (max-width: 540px) {
  .nav-link:not(.filled) { display: none; }
  .hero-title { font-size: 2.6rem; }
  .faq-question { padding: 16px 18px; font-size: .86rem; }
  .faq-answer p { padding: 14px 18px 16px; }
}

/* Guest Button Styles */
.guest-btn {
  background: rgba(191, 78, 30, 0.12) !important;
  border-radius: 40px !important;
  padding: 6px 14px !important;
  font-size: 0.8rem !important;
  transition: all 0.2s ease !important;
}

.guest-btn:hover {
  background: rgba(191, 78, 30, 0.2) !important;
  transform: translateY(-1px);
}

/* Guest Quota Toast Animation */
@keyframes guestToastSlide {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.guest-quota-toast {
  animation: guestToastSlide 0.3s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}