/* ---------- Tokens ---------- */
:root {
  --bg: #f6f5f2;
  --surface: #f6f5f2;
  --text: #0b0b0b;
  --text-soft: rgba(11, 11, 11, 0.8);
  --muted: rgba(11, 11, 11, 0.55);
  --line: rgba(11, 11, 11, 0.14);
  --accent: #0b0b0b;
  --accent-text: #f6f5f2;
  --danger: #b42318;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1200px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b;
    --surface: #0b0b0b;
    --text: #f6f5f2;
    --text-soft: rgba(246, 245, 242, 0.8);
    --muted: rgba(246, 245, 242, 0.55);
    --line: rgba(246, 245, 242, 0.16);
    --accent: #f6f5f2;
    --accent-text: #0b0b0b;
    --danger: #ff8a80;
  }
}

:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --surface: #0b0b0b;
  --text: #f6f5f2;
  --text-soft: rgba(246, 245, 242, 0.8);
  --muted: rgba(246, 245, 242, 0.55);
  --line: rgba(246, 245, 242, 0.16);
  --accent: #f6f5f2;
  --accent-text: #0b0b0b;
  --danger: #ff8a80;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, "system-ui", "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
  color: var(--text);
}

p { color: var(--text-soft); margin: 0 0 16px; }

a { color: var(--text); }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

main { flex: 1; }

/* Monospace label, e.g. "01  Chapter" */
.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 20px;
}

/* ---------- Header / nav (full width, edge to edge) ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  min-height: 64px;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.brand {
  font-family: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-links a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 6px;
  text-decoration-thickness: 1px;
}

/* ---------- Gate (home) ---------- */
.gate {
  min-height: calc(100vh - 64px - 80px);
  display: flex;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 72px;
}

.gate-inner { max-width: 520px; }

.gate h1 {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  margin: 0 0 20px;
}

.gate p.lede { font-size: 1.125rem; margin: 0 0 40px; }

.password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.password-form label {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.password-form .row {
  display: flex;
  gap: 8px;
}

.password-form input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 1rem;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
}

.password-form button,
.btn {
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  padding: 12px 22px;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}

.error {
  color: var(--danger);
  font-size: 0.9375rem;
  margin: 0;
}

/* ---------- My Work ---------- */
.hero {
  padding-top: 88px;
  padding-bottom: 56px;
}

.hero h1 {
  font-size: clamp(2.75rem, 7.5vw, 5.25rem);
  letter-spacing: -0.045em;
  margin: 0 0 28px;
  max-width: 15ch;
}

.hero p {
  font-size: clamp(1.0625rem, 1.8vw, 1.25rem);
  max-width: 640px;
  margin: 0;
}

.chapters {
  padding-bottom: 112px;
}

.chapters h2 {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 0 0 16px;
}

/* Bordered grid of chapter cells */
.chapter-menu {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.chapter-menu li {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.chapter {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "num arrow"
    "title title"
    "desc desc";
  gap: 16px 24px;
  height: 100%;
  min-height: 220px;
  padding: 28px clamp(20px, 3vw, 32px);
  text-decoration: none;
  color: var(--text);
  transition: background 0.15s ease;
}

.chapter:hover { background: var(--line); }

.chapter-num {
  grid-area: num;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chapter-arrow {
  grid-area: arrow;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1;
}

.chapter-title {
  grid-area: title;
  font-family: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: clamp(1.375rem, 2.6vw, 1.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
  align-self: end;
}

.chapter-desc {
  grid-area: desc;
  font-size: 0.9375rem;
  color: var(--muted);
  margin: 0;
  max-width: 44ch;
}

/* ---------- Chapter & About pages ---------- */
.article {
  padding-top: 64px;
  padding-bottom: 112px;
  max-width: 800px;
}

.back {
  display: inline-block;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9375rem;
  margin-bottom: 40px;
}

.back:hover { color: var(--text); text-decoration: underline; text-underline-offset: 4px; }

.article h1 {
  font-size: clamp(2.5rem, 6.5vw, 4rem);
  letter-spacing: -0.045em;
  margin: 0 0 24px;
}

.article .lead {
  font-size: clamp(1.125rem, 2vw, 1.3125rem);
  margin: 0 0 56px;
}

.article h2 {
  font-size: 1.5rem;
  margin: 56px 0 14px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.article p { font-size: 1.0625rem; }

.placeholder {
  color: var(--muted);
  font-style: italic;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}

/* About: sub-menu of strengths */
.submenu {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.submenu li { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.submenu a {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 18px;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  height: 100%;
}

.submenu a:hover { background: var(--line); }

.submenu .eyebrow { margin: 0; }

.strength {
  padding-top: 48px;
  padding-bottom: 8px;
  scroll-margin-top: 88px;
  border-top: 1px solid var(--line);
  margin-top: 56px;
}

.strength h2 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  margin: 0 0 20px;
  padding-top: 0;
  border-top: 0;
}

.strength .eyebrow { margin-bottom: 12px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Small screens ---------- */
@media (max-width: 720px) {
  .chapter-menu { grid-template-columns: 1fr; }
  .nav { flex-direction: column; align-items: flex-start; gap: 10px; padding-top: 14px; padding-bottom: 14px; }
  .nav-links { width: 100%; justify-content: space-between; gap: 12px; }
  .nav-links a { font-size: 0.875rem; }
  .password-form .row { flex-direction: column; }
  .password-form button { width: 100%; }
  .submenu a { width: 100%; }
  .submenu li { width: 100%; }
}
