:root {
  --bg: #fffdf9;
  --bg-panel: #f7f2ea;
  --ink: #241d14;
  --ink-soft: #5a4f40;
  --line: #e6ddcd;
  --rust: #b3502e;
  --clay: #c98a4b;
  --olive: #67713f;
  --sand: #d9b98a;
  --dark: #241d14;
  --dark-panel: #2e2519;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  font-size: 18px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Fira Code', Menlo, Consolas, monospace;
}

/* --- Nav --- */

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.6rem clamp(0.9rem, 1.6vw, 1.6rem);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(255, 253, 249, 0.92);
  backdrop-filter: blur(6px);
  z-index: 10;
}

.wordmark {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.wordmark span {
  color: var(--rust);
}

nav a.repo-link {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  border: 1.5px solid var(--ink);
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}

nav a.repo-link:hover {
  background: var(--ink);
  color: var(--bg);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-tutorial {
  font-family: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--bg);
  background: var(--olive);
  border: none;
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease;
}

.btn-tutorial:hover {
  background: #565f34;
  transform: translateY(-1px);
}

.btn-tutorial[aria-pressed='true'] {
  background: var(--rust);
}

/* --- Tutorial tour --- */

.tutorial-spotlight {
  position: fixed;
  pointer-events: none;
  border: 2px solid var(--rust);
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(36, 29, 20, 0.72);
  transition: top 0.45s ease, left 0.45s ease, width 0.45s ease, height 0.45s ease;
  z-index: 998;
}

.tutorial-spotlight[hidden] {
  display: none;
}

.tutorial-panel {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 4vw, 2.2rem);
  transform: translateX(-50%);
  width: min(92vw, 560px);
  background: var(--dark);
  color: #f2e9da;
  border-radius: 18px;
  padding: 1.5rem 1.7rem 1.3rem;
  box-shadow: 0 20px 60px rgba(36, 29, 20, 0.4);
  z-index: 1000;
  border: 1px solid #3a2f20;
}

.tutorial-panel[hidden] {
  display: none;
}

.tutorial-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.7rem;
}

.tutorial-step-count {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sand);
}

.tutorial-skip {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #cbbfa9;
  background: none;
  border: 1px solid #4a3c28;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.tutorial-skip:hover {
  border-color: var(--sand);
  color: #f2e9da;
}

.tutorial-panel h3 {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
  font-weight: 800;
}

.tutorial-panel p {
  margin: 0 0 1.1rem;
  font-size: 1.02rem;
  line-height: 1.55;
  color: #e3d7c4;
}

.tutorial-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.tutorial-nav-btn {
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.55rem 1.3rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1.5px solid #4a3c28;
  background: transparent;
  color: #f2e9da;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.tutorial-nav-btn:hover {
  border-color: var(--sand);
}

.tutorial-nav-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.tutorial-nav-btn-primary {
  background: var(--clay);
  border-color: var(--clay);
  color: var(--dark);
}

.tutorial-nav-btn-primary:hover {
  background: var(--sand);
  border-color: var(--sand);
}

.tutorial-progress-dots {
  display: flex;
  gap: 0.4rem;
}

.tutorial-progress-dots .dot-step {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4a3c28;
  transition: background 0.15s ease;
}

.tutorial-progress-dots .dot-step.done {
  background: var(--sand);
}

/* --- Hero --- */

.hero {
  padding: clamp(3rem, 8vw, 7rem) clamp(0.9rem, 1.6vw, 1.6rem) clamp(2rem, 5vw, 4rem);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--rust);
  margin: 0 0 1.2rem;
}

.hero h1 {
  font-size: clamp(2.8rem, 7vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0 0 1.5rem;
  max-width: 22ch;
  background: linear-gradient(100deg, var(--rust) 0%, var(--clay) 45%, var(--olive) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lede {
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0 0 2.2rem;
}

.hero .cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-block;
  font-weight: 700;
  font-size: 1.05rem;
  padding: 0.9rem 1.8rem;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(36, 29, 20, 0.25);
}

.btn-ghost {
  color: var(--ink);
  border: 1.5px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--ink);
}

/* --- Terminal replay panel --- */

.replay-section {
  padding: 0 clamp(0.9rem, 1.6vw, 1.6rem) clamp(3rem, 6vw, 5rem);
}

.replay-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.replay-label h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.replay-current {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.replay-current strong {
  color: var(--ink);
}

.terminal {
  background: var(--dark);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(36, 29, 20, 0.18);
  border: 1px solid #3a2f20;
}

.terminal-chrome {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.4rem;
  background: var(--dark-panel);
  border-bottom: 1px solid #3a2f20;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.dot.rust { background: var(--rust); }
.dot.clay { background: var(--clay); }
.dot.olive { background: var(--olive); }

.terminal-chrome .path {
  margin-left: 0.8rem;
  color: #cbbfa9;
  font-size: 0.9rem;
}

.terminal-body {
  height: min(52vh, 620px);
  overflow-y: auto;
  padding: 1.6rem clamp(1.2rem, 3vw, 2.2rem);
  scroll-behavior: smooth;
}

.terminal-body::-webkit-scrollbar {
  width: 10px;
}

.terminal-body::-webkit-scrollbar-thumb {
  background: #4a3c28;
  border-radius: 6px;
}

.terminal-body pre {
  margin: 0;
  color: #f2e9da;
  font-size: 1.02rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.cursor {
  display: inline-block;
  width: 0.55em;
  height: 1em;
  background: var(--sand);
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* --- Sessions grid --- */

.sessions-section {
  padding: 1rem clamp(0.9rem, 1.6vw, 1.6rem) clamp(4rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
}

.sessions-section h2,
.features h2,
.install h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 2.4rem 0 0.6rem;
}

.sessions-section p.section-sub,
.features p.section-sub {
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin: 0 0 2rem;
  max-width: 60ch;
}

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.session-card {
  text-align: left;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.3rem 1.4rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.15s ease, transform 0.12s ease;
}

.session-card:hover {
  border-color: var(--clay);
  transform: translateY(-2px);
}

.session-card.active {
  border-color: var(--rust);
  background: #fdf2ea;
}

.session-card .row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.session-card .agent {
  font-weight: 700;
  font-size: 1.15rem;
}

.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.status-completed { background: #eaf0dd; color: var(--olive); }
.status-crashed { background: #f6e0d3; color: var(--rust); }
.status-running { background: #f3e6cf; color: #8a6a2f; }

.session-card .meta {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.session-card .sid {
  color: var(--ink-soft);
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

/* --- Features --- */

.features {
  padding: 1rem clamp(0.9rem, 1.6vw, 1.6rem) clamp(4rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2.2rem;
  margin-top: 2rem;
}

.feature {
  border-top: 3px solid var(--clay);
  padding-top: 1rem;
}

.feature:nth-child(2) { border-top-color: var(--olive); }
.feature:nth-child(3) { border-top-color: var(--rust); }
.feature:nth-child(4) { border-top-color: var(--sand); }

.feature h3 {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
  font-weight: 700;
}

.feature p {
  color: var(--ink-soft);
  margin: 0;
  font-size: 1rem;
}

/* --- Install --- */

.install {
  padding: 1rem clamp(0.9rem, 1.6vw, 1.6rem) clamp(4rem, 7vw, 6rem);
  border-top: 1px solid var(--line);
}

.install pre {
  background: var(--dark);
  color: #f2e9da;
  border-radius: 16px;
  padding: 1.8rem 2rem;
  font-size: 1.05rem;
  line-height: 1.8;
  overflow-x: auto;
  margin-top: 1.6rem;
}

.install pre .cmt { color: #9a8b70; }
.install pre .accent { color: var(--sand); }

/* --- Footer --- */

footer {
  padding: 2.2rem clamp(0.9rem, 1.6vw, 1.6rem);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

footer a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

footer a:hover {
  color: var(--rust);
}
