/* Chai & Claude — shared styles for every page except /things (which has its own). */

/* ── Theme tokens ─────────────────────────────────── */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --text: #0a0a0a;
  --muted: rgba(10, 10, 10, 0.52);
  --faint: rgba(10, 10, 10, 0.2);
  --line: rgba(0, 0, 0, 0.09);
  --fill: rgba(0, 0, 0, 0.045);
  --tile: #f1f1f0;
  --raise: rgba(0, 0, 0, 0.12);
  --cover: #0e0e0e;
  --cover-text: #f5f5f2;
  --button: #0a0a0a;
  --button-text: #ffffff;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Geist", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side: 220px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #464a47;
    --text: #ecece8;
    --muted: rgba(236, 236, 232, 0.55);
    --faint: rgba(236, 236, 232, 0.22);
    --line: rgba(255, 255, 255, 0.08);
    --fill: rgba(255, 255, 255, 0.06);
    --tile: rgba(255, 255, 255, 0.07);
    --raise: rgba(0, 0, 0, 0.22);
    --cover: #2c2f2d;
    --cover-text: #f2f1ec;
    --button: #ecece8;
    --button-text: #1f2120;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #464a47;
  --text: #ecece8;
  --muted: rgba(236, 236, 232, 0.55);
  --faint: rgba(236, 236, 232, 0.22);
  --line: rgba(255, 255, 255, 0.08);
  --fill: rgba(255, 255, 255, 0.06);
  --tile: rgba(255, 255, 255, 0.07);
  --raise: rgba(0, 0, 0, 0.22);
  --cover: #2c2f2d;
  --cover-text: #f2f1ec;
  --button: #ecece8;
  --button-text: #1f2120;
}

/* ── Base ─────────────────────────────────────────── */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; }
::selection { background: var(--text); color: var(--bg); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* ── Layout: sidebar + main ───────────────────────── */
.site { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh;
  padding: 48px 0 40px 52px;
}
.brand, .menu-btn { display: none; }
.side-panel { height: 100%; display: flex; flex-direction: column; justify-content: space-between; }

.nav { display: flex; flex-direction: column; }
.nav a {
  padding: 13px 0; font-size: 16px; line-height: 1.4;
  color: var(--muted); text-decoration: none;
  transition: color 0.2s ease;
}
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }
.nav a[aria-current="page"]::after { content: " •"; }

.side-foot { display: grid; gap: 22px; }
.socials { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.socials a { text-decoration: none; color: var(--muted); font-size: 15px; }
.socials a:hover { color: var(--text); }
.socials b { color: var(--text); font-weight: 400; margin-right: 6px; }

.theme-switch {
  display: inline-flex; width: max-content;
  padding: 3px; border-radius: 6px;
  background: var(--fill); border: 1px solid var(--line);
}
.theme-switch button {
  border: 0; background: none; cursor: pointer;
  padding: 4px 9px; border-radius: 4px;
  font-size: 12px; line-height: 1.5; color: var(--muted);
}
.theme-switch button[aria-pressed="true"] { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px var(--raise); }
html.theming, html.theming * { transition: background-color 0.3s ease, color 0.3s ease !important; }

.main { padding: 48px 52px 120px 28px; min-width: 0; }

/* Email + Copy, top right */
.contact { display: flex; justify-content: flex-end; align-items: center; gap: 40px; font-size: 16px; }
.contact a { color: var(--muted); text-decoration: none; }
.contact a:hover { color: var(--text); }
.copy { border: 0; background: none; padding: 0; cursor: pointer; font-weight: 500; }

/* ── Shared pieces ────────────────────────────────── */
.wordmark {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(64px, 15.4vw, 300px);
  line-height: 0.92; letter-spacing: -0.035em;
  margin: -14px 0 36px; white-space: nowrap;
}
.wordmark em { font-style: italic; font-weight: 300; }

.page-title {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, 6vw, 88px); line-height: 1; letter-spacing: -0.03em;
  margin: 0 0 18px;
}
.lede { color: var(--muted); max-width: 52ch; margin: 0 0 32px; }

/* Page header used on every page except Home: title + lede on the left, optional action on the right.
   things/styles.css repeats these values for the Things page; keep them in step. */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; flex-wrap: wrap; margin-bottom: 48px; }
.page-head .lede { margin: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 2px;
  background: var(--fill); color: var(--text);
  text-decoration: none; font-weight: 500; line-height: 1.4;
  border: 0; cursor: pointer;
  transition: background 0.2s ease;
}
.btn:hover { background: var(--line); }
.btn.solid { background: var(--button); color: var(--button-text); }
.btn.solid:hover { opacity: 0.88; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.eyebrow { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 18px; }
.section { margin-top: 120px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 32px; }
.section-head h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(32px, 3.6vw, 52px); letter-spacing: -0.02em; line-height: 1.05; margin: 0; }

/* Placeholder photo: shows initials until a real photo loads */
.photo {
  position: relative; margin: 0; overflow: hidden;
  background: var(--tile);
}
.photo::before {
  content: attr(data-initials);
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--serif); font-size: clamp(32px, 4vw, 64px); color: var(--faint);
}
.photo img { position: relative; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }

/* ── Home ─────────────────────────────────────────── */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 40px; align-items: start; }
.intro p { margin: 0; font-size: 17px; }
.intro p + p { margin-top: 2px; }
.intro .actions { margin-top: 26px; }

.team { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding-bottom: 72px; }
.team > :nth-child(even) { transform: translateY(72px); }
.member .photo { aspect-ratio: 4 / 5; }
.member h3 { font-size: 17px; font-weight: 600; margin: 14px 0 0; line-height: 1.3; }
.member p { margin: 2px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

.stubs { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 40px 48px; max-width: 1080px; }
.stub { text-decoration: none; display: block; }
.stub .tile { aspect-ratio: 4 / 5; background: var(--tile); position: relative; overflow: hidden; display: grid; place-items: center; transition: transform 0.4s ease; }
.stub:hover .tile { transform: translateY(-4px); }
.stub h3 { font-size: 16px; font-weight: 600; margin: 18px 0 2px; line-height: 1.4; }
.stub p { margin: 0; color: var(--muted); font-size: 15.5px; line-height: 1.5; }
.tile .glyph { font-family: var(--serif); font-size: 120px; line-height: 1; color: var(--faint); font-style: italic; }
.mini-cover {
  width: 46%; aspect-ratio: 2 / 3; padding: 18px 14px 14px 22px;
  background: var(--cover); color: var(--cover-text);
  font-family: var(--serif); font-size: 26px; line-height: 1; letter-spacing: -0.03em;
  box-shadow: 0 16px 30px -10px var(--raise);
  transform: rotate(-3deg);
}
.mini-grid { display: grid; grid-template-columns: repeat(3, 44px); gap: 22px; }
.mini-grid i { width: 44px; height: 44px; border-radius: 10px; background: var(--faint); opacity: 0.6; }
.mini-grid i:nth-child(odd) { border-radius: 50%; }

/* ── About ────────────────────────────────────────── */
.about { display: grid; grid-template-columns: minmax(0, 560px) minmax(0, 1fr); gap: 80px; margin-top: 36px; }
.notes p { margin: 0 0 28px; }
.notes .n { color: var(--muted); opacity: 0.75; margin-right: 6px; font-variant-numeric: tabular-nums; }
.notes b { font-weight: 600; }
.notes a, .lede a, .fine a { text-decoration-color: var(--faint); text-underline-offset: 4px; }
.notes a:hover, .lede a:hover, .fine a:hover { text-decoration-color: currentColor; }
.notes ul { list-style: none; padding: 0 0 0 28px; margin: -14px 0 28px; }
.collage { position: sticky; top: 120px; height: min(78vh, 720px); }
.collage .photo { position: absolute; width: 42%; aspect-ratio: 4 / 3; box-shadow: 0 10px 30px var(--raise); }
.collage .photo:nth-child(1) { top: 4%; left: 6%; }
.collage .photo:nth-child(2) { top: 36%; left: 46%; aspect-ratio: 5 / 6; }
.collage .photo:nth-child(3) { top: 62%; left: 2%; width: 38%; }

.team-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin: 12px 0 40px; }
.team-list .member { display: grid; grid-template-columns: 72px 1fr; gap: 16px; align-items: center; }
.team-list .photo { aspect-ratio: 1; border-radius: 50%; }
.team-list .photo::before { font-size: 22px; }
.team-list h3 { margin: 0; }

.cta-card {
  display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 26px 28px; background: var(--fill); border: 1px solid var(--line);
}
.cta-card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 28px; letter-spacing: -0.02em; line-height: 1.2; }
.cta-card p { margin: 4px 0 0; color: var(--muted); font-size: 15px; line-height: 1.5; }

/* ── Blog ─────────────────────────────────────────── */
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 320px)); gap: 56px 48px; }
.post a { text-decoration: none; display: block; }
.cover {
  position: relative; aspect-ratio: 2 / 3; padding: 44px 28px 22px 48px;
  background: var(--cover); color: var(--cover-text);
  display: flex; flex-direction: column;
  box-shadow: 0 18px 40px -12px var(--raise), 0 2px 6px var(--raise);
  transition: transform 0.4s cubic-bezier(.2, .7, .2, 1), box-shadow 0.4s ease;
}
/* book spine */
.cover::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 18px; background: linear-gradient(90deg, rgba(255,255,255,.06), rgba(0,0,0,.35) 70%, rgba(255,255,255,.05)); }
.post a:hover .cover { transform: translateY(-6px) rotate(-0.4deg); box-shadow: 0 28px 50px -14px var(--raise), 0 2px 6px var(--raise); }
.cover h2 { font-family: var(--serif); font-weight: 400; font-size: 40px; line-height: 1.02; letter-spacing: -0.035em; margin: 0 0 18px; }
.cover .art { flex: 1; min-height: 0; background: rgba(255,255,255,.08); display: grid; place-items: center; font-family: var(--serif); font-style: italic; font-size: 64px; color: rgba(255,255,255,.25); overflow: hidden; }
.cover .art img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1); }
/* Claude Code's pixel mascot, used as a placeholder (assets/claude-mascot.svg) */
.photo.claude-mark::before { content: ""; background: url(/assets/claude-mascot.svg) center / 42% auto no-repeat; }
/* About collage placeholders: a cup of chai, and a white & (outlined like the white cup so it shows on the grey) */
.photo.chai-cup::before { content: ""; background: url(/assets/chai-cup.svg) center / 46% auto no-repeat; }
.photo.amp-mark::before { color: #fff; font-weight: 500; -webkit-text-stroke: 1px #a9a39a; text-shadow: 0 1px 1px rgba(0,0,0,.15), 0 4px 10px rgba(0,0,0,.18); }
.cover .art.claude-mark { background: rgba(255,255,255,.08) url(/assets/claude-mascot.svg) center / 38% auto no-repeat; }
.cover footer { display: flex; justify-content: space-between; border-top: 1px solid rgba(255,255,255,.2); margin-top: 14px; padding-top: 10px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; }
.cover .lock { position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; }
.post .summary { margin: 18px 0 0; color: var(--muted); font-size: 15px; line-height: 1.6; }
.post .meta { font-size: 13px; color: var(--faint); margin-top: 6px; }

/* ── Courses ──────────────────────────────────────── */
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 48px 40px; max-width: 1180px; }
.course .tile { aspect-ratio: 4 / 3; background: var(--tile); display: flex; align-items: flex-end; justify-content: space-between; padding: 22px; position: relative; overflow: hidden; }
.course .num { font-family: var(--serif); font-size: 112px; line-height: 0.8; letter-spacing: -0.04em; color: var(--faint); }
.chip { font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 999px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.course h2 { font-size: 19px; font-weight: 600; margin: 18px 0 4px; line-height: 1.35; }
.course p { margin: 0 0 14px; color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.course ul { margin: 0 0 18px; padding-left: 18px; color: var(--muted); font-size: 14.5px; line-height: 1.7; }

/* ── Book ─────────────────────────────────────────── */
.book { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 520px); gap: 64px; align-items: start; margin-top: 12px; max-width: 1240px; }
.facts { list-style: none; padding: 0; margin: 0 0 28px; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.facts span { color: var(--muted); }
.ticks { padding-left: 20px; color: var(--muted); margin: 0 0 28px; }

.steps { display: flex; gap: 22px; margin: 0 0 24px; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.steps li[aria-current="step"] { color: var(--text); font-weight: 600; }
.steps li.done { color: var(--text); }
.steps li.done::before { content: "✓ "; }

.panel { background: var(--fill); border: 1px solid var(--line); padding: 28px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; font-size: 14px; }
.field span { color: var(--muted); }
.field input {
  font: inherit; font-size: 16px; color: var(--text);
  padding: 10px 12px; border-radius: 2px;
  background: var(--bg); border: 1px solid var(--line);
}
.field input:focus { outline: none; border-color: var(--text); }
.pay-btn { width: 100%; justify-content: center; padding: 13px 16px; font-size: 16px; margin-top: 6px; }
.fine { font-size: 13px; color: var(--muted); line-height: 1.6; margin: 14px 0 0; }
.notice { padding: 14px 16px; border: 1px solid var(--line); background: var(--bg); font-size: 14.5px; line-height: 1.6; margin-bottom: 16px; }
.notice.error { border-color: #c0392b; }
#calendly { min-width: 280px; height: 720px; background: var(--bg); }

/* ── Software ─────────────────────────────────────── */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 48px 40px; max-width: 1180px; }
.app-card .tile { aspect-ratio: 4 / 3; background: var(--tile); display: grid; place-items: center; position: relative; text-decoration: none; }
.app-card .tile .chip { position: absolute; top: 14px; right: 14px; }
.app-icon {
  width: 96px; height: 96px; border-radius: 22px;
  display: grid; place-items: center;
  background: var(--cover); color: var(--cover-text);
  font-family: var(--serif); font-size: 46px; line-height: 1;
  box-shadow: 0 14px 30px -8px var(--raise);
  transition: transform 0.4s cubic-bezier(.2, .7, .2, 1);
}
/* App icon from an image (the PNG carries its own shape and padding) */
.app-icon.img { background: none; box-shadow: none; overflow: visible; }
.app-icon.img img { width: 112%; height: 112%; max-width: none; object-fit: contain; filter: drop-shadow(0 12px 18px var(--raise)); }
.app-card .tile:hover .app-icon { transform: translateY(-4px) rotate(-2deg); }
.app-card h2 { font-size: 19px; font-weight: 600; margin: 18px 0 4px; line-height: 1.35; }
.app-card h2 a { text-decoration: none; }
.app-card p { margin: 0 0 14px; color: var(--muted); font-size: 15.5px; line-height: 1.55; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }

.breadcrumb { font-size: 14px; color: var(--muted); margin: 0 0 28px; }
.breadcrumb a { color: var(--muted); text-underline-offset: 3px; }
.app-hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin: 0 0 40px; }
.app-hero .app-icon { width: 120px; height: 120px; border-radius: 28px; font-size: 58px; }
.app-hero .page-title { margin: 0 0 8px; }
.app-hero .lede { margin: 0; }

.app-layout { display: grid; grid-template-columns: minmax(0, 660px) minmax(240px, 320px); gap: 72px; align-items: start; max-width: 1100px; }
.app-aside { position: sticky; top: 48px; display: grid; gap: 10px; }
.app-aside .btn { justify-content: center; padding: 11px 14px; }
.app-aside .facts { margin: 14px 0 0; font-size: 14.5px; }

.prose h2 { font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: -0.02em; line-height: 1.15; margin: 52px 0 14px; scroll-margin-top: 80px; }
.prose > h2:first-child { margin-top: 0; }
.prose h3 { font-size: 17px; font-weight: 600; margin: 30px 0 8px; line-height: 1.4; }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 18px; }
.prose li { margin: 5px 0; }
.prose a { text-decoration-color: var(--faint); text-underline-offset: 4px; }
.prose a:hover { text-decoration-color: currentColor; }
.prose code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 0.86em; background: var(--fill); padding: 2px 6px; border-radius: 3px; }
.prose pre { background: var(--cover); color: var(--cover-text); padding: 16px 18px; margin: 0 0 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.65; border-radius: 4px; }
.prose :not(pre) > code { overflow-wrap: anywhere; }
.prose pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.callout { border-left: 2px solid var(--text); padding: 2px 0 2px 16px; margin: 20px 0; color: var(--muted); }
.callout b { color: var(--text); }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0 8px; }
.shots .photo { aspect-ratio: 16 / 10; }
.shots .photo img { filter: none; }
.toc { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 14.5px; line-height: 1.45; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--text); }

/* ── Footer line ──────────────────────────────────── */
.page-foot { margin-top: 140px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 14px; }
.page-foot a { color: var(--muted); }

/* ── Small screens: sidebar becomes a top bar with a menu ─ */
@media (max-width: 900px) {
  .site { grid-template-columns: 1fr; }
  .side {
    position: sticky; top: 0; z-index: 30; height: auto;
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; padding-top: calc(14px + env(safe-area-inset-top));
  }
  /* Blur lives on a pseudo-element: backdrop-filter on .side itself would trap the fixed menu panel inside the bar */
  .side::before {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  }
  .brand { display: block; font-family: var(--serif); font-size: 22px; text-decoration: none; letter-spacing: -0.02em; line-height: 1.2; }
  .menu-btn { display: block; border: 0; background: none; cursor: pointer; font-size: 15px; font-weight: 500; padding: 6px 0; }
  .side-panel {
    display: none;
    position: fixed; inset: 0; top: calc(56px + env(safe-area-inset-top)); z-index: 29;
    padding: 24px 20px 40px; background: var(--bg);
    height: auto;
  }
  .side.open .side-panel { display: flex; }
  .nav a { font-family: var(--serif); font-size: 40px; letter-spacing: -0.02em; padding: 4px 0; }
  .main { padding: 20px 20px 96px; }
  .contact { justify-content: flex-start; gap: 20px; font-size: 15px; }
  .wordmark { font-size: 17.5vw; margin: 8px 0 28px; white-space: normal; }
  .intro { grid-template-columns: 1fr; }
  .intro .contact { order: 3; }
  .team { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; padding-bottom: 48px; }
  .team > :nth-child(even) { transform: translateY(48px); }
  .section { margin-top: 88px; }
  .about { grid-template-columns: 1fr; gap: 40px; }
  .collage { position: relative; top: 0; height: 120vw; max-height: 560px; }
  .team-list { grid-template-columns: 1fr; }
  .book { grid-template-columns: 1fr; gap: 36px; }
  .panel { padding: 20px; }
  .app-layout { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .app-aside { position: static; order: -1; }
  .shots { grid-template-columns: 1fr; }
  .app-hero .app-icon { width: 88px; height: 88px; border-radius: 22px; font-size: 42px; }
  .posts { grid-template-columns: 1fr; justify-items: center; }
  .post { max-width: 340px; width: 100%; }
}
