/* =========================================================
   Claude Code — Field Guide
   Editorial white layout. Sticky sidebar TOC. Serif display.
   ========================================================= */

:root {
  --bg:           #fdfcfa;
  --bg-alt:       #f5f2ec;
  --ink:          #1a1814;
  --ink-soft:     #45423c;
  --ink-mute:     #8a8478;
  --line:         #e8e2d6;
  --line-strong:  #d0c8b8;
  --accent:       #b8541f;   /* deep clay/terracotta */
  --accent-soft:  #f4e9dc;
  --ok:           #4e7a4a;

  --code-bg:      #17150f;
  --code-ink:     #e8dfce;
  --code-mute:    #8a816f;
  --code-hl:      #e8a572;

  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --max-read: 680px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
ul, ol { padding: 0; margin: 0; }
img, svg { display: block; max-width: 100%; }
code, kbd, pre { font-family: var(--font-mono); }
em { font-style: italic; }

/* selection */
::selection { background: var(--accent-soft); color: var(--ink); }


/* =========================================================
   PAGE SHELL — sidebar + main column
   ========================================================= */
.page {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.side {
  border-right: 1px solid var(--line);
  background: var(--bg);
}
.side__inner {
  position: sticky;
  top: 0;
  padding: 48px 32px 32px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 48px;
}
.brand__mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  flex-shrink: 0;
}
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.brand__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand__sub {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* Table of contents */
.toc__label {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 14px;
  font-weight: 500;
}
.toc__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toc__list a {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 8px 10px 8px 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.toc__list a span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}
.toc__list a:hover {
  color: var(--ink);
  background: var(--bg-alt);
}
.toc__list a.is-active {
  color: var(--ink);
  font-weight: 500;
}
.toc__list a.is-active span {
  color: var(--accent);
}

.side__foot {
  margin-top: auto;
  padding-top: 32px;
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.6;
}


/* =========================================================
   MAIN COLUMN
   ========================================================= */
.main {
  padding: 72px 64px 120px;
  max-width: 900px;
}


/* ---------- COVER ---------- */
.cover {
  padding: 16px 0 64px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 72px;
}
.cover__eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 28px;
  font-weight: 500;
}
.cover__title {
  font-family: var(--font-display);
  font-weight: 380;
  font-size: clamp(44px, 6.5vw, 84px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 28px;
  color: var(--ink);
  font-variation-settings: "opsz" 144, "SOFT" 50;
}
.cover__title em {
  font-style: italic;
  font-weight: 350;
  color: var(--accent);
}
.cover__lede {
  font-family: var(--font-display);
  font-weight: 350;
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 0 36px;
  font-variation-settings: "opsz" 36;
}
.cover__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-mute);
  align-items: center;
}
.cover__meta strong {
  color: var(--ink);
  font-weight: 600;
}
.cover__meta .sep,
.end__links .sep { color: var(--line-strong); }
.nowrap { white-space: nowrap; }


/* =========================================================
   CHAPTER
   ========================================================= */
.chapter {
  padding: 72px 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 24px;
}
.chapter:last-of-type { border-bottom: none; }

.chapter__num {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin: 0 0 12px;
  font-weight: 500;
}
.chapter__title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(32px, 3.8vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 36px;
  color: var(--ink);
  font-variation-settings: "opsz" 72;
}

.h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 40px 0 16px;
  color: var(--ink);
}

/* body paragraphs */
.chapter p {
  max-width: var(--max-read);
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 16.5px;
  line-height: 1.7;
}
.chapter p.lead {
  font-family: var(--font-display);
  font-weight: 360;
  font-size: 22px;
  line-height: 1.5;
  color: var(--ink);
  max-width: var(--max-read);
  margin: 0 0 28px;
  font-variation-settings: "opsz" 36;
}
.chapter p em {
  color: var(--ink);
}
.chapter p strong,
.chapter li strong {
  color: var(--ink);
  font-weight: 600;
}
.chapter p code,
.chapter li code {
  font-size: 0.88em;
  padding: 1px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
}

/* lists */
.list {
  list-style: none;
  max-width: var(--max-read);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0 0 18px;
}
.list li {
  position: relative;
  padding-left: 24px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.65;
}
.list li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 11px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 999px;
}


/* ---------- PULLQUOTE ---------- */
.pullquote {
  max-width: var(--max-read);
  margin: 36px 0 0;
  padding: 28px 32px;
  border-left: 2px solid var(--accent);
  background: var(--bg-alt);
  border-radius: 0 8px 8px 0;
}
.pullquote p {
  margin: 0 !important;
  font-family: var(--font-display);
  font-weight: 360;
  font-style: italic;
  font-size: 22px;
  line-height: 1.45;
  color: var(--ink);
  font-variation-settings: "opsz" 36;
}


/* ---------- NOTE BOX ---------- */
.note {
  max-width: var(--max-read);
  margin: 24px 0;
  padding: 16px 20px;
  background: var(--accent-soft);
  border-radius: 8px;
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.note strong {
  color: var(--ink);
  font-weight: 600;
}


/* =========================================================
   CODE BLOCKS
   ========================================================= */
.code {
  max-width: 740px;
  margin: 0 0 24px;
  background: var(--code-bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2a2620;
}
.code__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.code__lang {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--code-mute);
}
.code__copy {
  font-family: var(--font-body);
  font-size: 12px;
  padding: 4px 10px;
  color: var(--code-ink);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 5px;
  transition: background .15s, color .15s, border-color .15s;
  opacity: 0.85;
}
.code__copy:hover {
  opacity: 1;
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.22);
}
.code__copy.is-copied {
  background: var(--ok);
  border-color: transparent;
  color: #fff;
  opacity: 1;
}
.code pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  color: var(--code-ink);
  font-size: 13.5px;
  line-height: 1.75;
}


/* =========================================================
   TERMINAL
   ========================================================= */
.term {
  max-width: 740px;
  margin: 8px 0 28px;
  background: var(--code-bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2a2620;
}
.term__bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.term__dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
}
.term__dot--r { background: #ff5f56; }
.term__dot--y { background: #ffbd2e; }
.term__dot--g { background: #27c93f; }
.term__path {
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--code-mute);
}
.term__body {
  padding: 18px 22px;
  font-family: var(--font-mono);
  font-size: 13.2px;
  line-height: 1.8;
  color: var(--code-ink);
}
.term__body p { margin: 0 !important; max-width: none !important; font-family: var(--font-mono) !important; font-size: 13.2px !important; color: var(--code-ink) !important; line-height: 1.8 !important; }
.term__sp { height: 6px; }
.term__prompt { color: var(--code-hl); margin-right: 8px; }
.term__arrow { color: var(--code-hl); margin-right: 8px; }
.term__dim { color: var(--code-mute) !important; }
.term__ok  { color: #8fd19e !important; }
.term__hl  { color: var(--code-hl); }
.caret {
  display: inline-block;
  color: var(--code-ink);
  animation: blink 1.05s steps(2, start) infinite;
  margin-left: 2px;
}
@keyframes blink { to { visibility: hidden; } }


/* =========================================================
   COMPARE (vague vs. specific)
   ========================================================= */
.compare {
  max-width: var(--max-read);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 8px 0 28px;
}
.compare__col {
  padding: 20px 22px;
  border-radius: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
}
.compare__col--bad  { border-top: 2px solid #b9a89a; }
.compare__col--good { border-top: 2px solid var(--accent); }
.compare__label {
  font-size: 11px !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute) !important;
  margin: 0 0 10px !important;
  font-weight: 500;
  font-family: var(--font-body) !important;
}
.compare__text {
  font-family: var(--font-display) !important;
  font-size: 17px !important;
  line-height: 1.5 !important;
  margin: 0 !important;
  color: var(--ink) !important;
  font-weight: 360 !important;
}
@media (max-width: 720px) {
  .compare { grid-template-columns: 1fr; }
}


/* =========================================================
   CHECKLIST
   ========================================================= */
.checklist {
  list-style: none;
  counter-reset: chk;
  max-width: var(--max-read);
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
}
.checklist li {
  counter-increment: chk;
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: baseline;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
}
.checklist li:first-child { border-top: 1px solid var(--line); }
.checklist li::before {
  content: counter(chk, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.05em;
}


/* =========================================================
   PATTERNS
   ========================================================= */
.pattern {
  max-width: 740px;
  margin: 0 0 20px;
}
.pattern__label {
  font-size: 12px !important;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-mute) !important;
  margin: 0 0 8px !important;
  font-weight: 500;
}
.pattern__code {
  margin: 0;
  padding: 16px 20px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  border: 1px solid #2a2620;
  font-size: 13.5px;
  line-height: 1.75;
  overflow-x: auto;
}


/* =========================================================
   DEFINITIONS (slash commands)
   ========================================================= */
.defs {
  max-width: var(--max-read);
  margin: 0 0 12px;
}
.defs > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 24px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.defs > div:first-child { border-top: 1px solid var(--line); }
.defs dt { margin: 0; }
.defs dt code {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--accent);
  background: none !important;
  border: none !important;
  padding: 0 !important;
}
.defs dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 1.55;
}
.defs dd code {
  font-size: 0.88em;
  padding: 1px 5px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--ink);
}
@media (max-width: 620px) {
  .defs > div { grid-template-columns: 1fr; gap: 4px; }
}


/* =========================================================
   SHORTCUTS
   ========================================================= */
.shortcuts {
  max-width: var(--max-read);
  display: grid;
  gap: 10px;
  margin: 0 0 18px;
}
.shortcuts > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink-soft);
}
.shortcuts > div:first-child { border-top: 1px solid var(--line); }
.shortcuts > div > span {
  flex: 1;
  min-width: 240px;
}
kbd {
  display: inline-block;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  line-height: 1.3;
}


/* =========================================================
   WORKFLOWS
   ========================================================= */
.wf {
  max-width: 740px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}
.wf:last-of-type { padding-bottom: 0; }
.wf__num {
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute) !important;
  margin: 0 0 8px !important;
  font-weight: 500;
}
.wf__title {
  font-family: var(--font-display);
  font-weight: 450;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 10px;
  color: var(--ink);
  font-variation-settings: "opsz" 36;
}
.wf p {
  max-width: 620px;
  margin: 0 0 16px !important;
  font-size: 16px !important;
  color: var(--ink-soft) !important;
}
.wf__code {
  margin: 0;
  padding: 16px 20px;
  background: var(--code-bg);
  color: var(--code-ink);
  border-radius: 10px;
  border: 1px solid #2a2620;
  font-size: 13.5px;
  line-height: 1.75;
  overflow-x: auto;
}


/* =========================================================
   HABITS
   ========================================================= */
.habits {
  list-style: none;
  counter-reset: hab;
  max-width: var(--max-read);
  margin: 0;
  display: grid;
  gap: 0;
}
.habits li {
  counter-increment: hab;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.habits li:first-child { border-top: 1px solid var(--line); }
.habits li::before {
  content: counter(hab, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.04em;
}
.habits h4 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 19px;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
  color: var(--ink);
}
.habits h4 code {
  font-size: 0.82em;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 1px 6px;
  background: var(--bg-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.habits p {
  margin: 0 !important;
  max-width: none !important;
  color: var(--ink-soft) !important;
  font-size: 15.5px !important;
  line-height: 1.55 !important;
}


/* =========================================================
   END & COLOPHON
   ========================================================= */
.end {
  max-width: var(--max-read);
  margin-top: 72px;
  text-align: center;
  padding: 40px 0 0;
}
.end__mark {
  font-family: var(--font-display) !important;
  font-style: italic;
  font-size: 18px !important;
  color: var(--ink-mute) !important;
  letter-spacing: 0.2em;
  margin: 0 0 24px !important;
}
.end__text {
  font-family: var(--font-display) !important;
  font-size: 19px !important;
  line-height: 1.5 !important;
  color: var(--ink) !important;
  font-weight: 360 !important;
  max-width: 560px;
  margin: 0 auto 28px !important;
}
.end__links {
  font-family: var(--font-body) !important;
  font-size: 14px !important;
  color: var(--ink-mute) !important;
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  margin: 0 !important;
}
.end__links a {
  color: var(--accent);
  border-bottom: 1px solid transparent;
  transition: border-color .15s;
}
.end__links a:hover { border-bottom-color: var(--accent); }

.colophon {
  margin-top: 80px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  max-width: var(--max-read);
}
.colophon p {
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.6;
  margin: 0;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 1100px) {
  .page { grid-template-columns: 240px 1fr; }
  .side__inner { padding: 40px 24px 24px; }
  .main { padding: 60px 48px 120px; }
}

@media (max-width: 860px) {
  .page { grid-template-columns: 1fr; }
  .side {
    border-right: none;
    border-bottom: 1px solid var(--line);
    background: var(--bg);
  }
  .side__inner {
    position: static;
    height: auto;
    padding: 24px 24px 20px;
    flex-direction: column;
  }
  .brand { margin-bottom: 20px; }
  .toc__list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .toc__list a {
    grid-template-columns: auto 1fr;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
  }
  .side__foot { display: none; }
  .main { padding: 40px 24px 80px; }
  .cover { padding: 8px 0 40px; margin-bottom: 48px; }
  .chapter { padding: 48px 0; }
}

@media (max-width: 480px) {
  .cover__title { font-size: 40px; }
  .cover__lede  { font-size: 18px; }
  .chapter p.lead { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  html { scroll-behavior: auto; }
}


/* scrollbars in code blocks */
.code pre::-webkit-scrollbar,
.term__body::-webkit-scrollbar,
.wf__code::-webkit-scrollbar,
.pattern__code::-webkit-scrollbar { height: 6px; }
.code pre::-webkit-scrollbar-thumb,
.term__body::-webkit-scrollbar-thumb,
.wf__code::-webkit-scrollbar-thumb,
.pattern__code::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 999px; }
