/* =============================================================
   How Devs Learn — Terminal / Craft design system
   A "diagnostic readout" aesthetic. The dependence-meter color
   scale (green -> amber -> red) is the site's core motif.
   ============================================================= */

/* ---------- Tokens ---------- */
:root {
  /* surfaces */
  --ink:        #0c0e0f;
  --ink-2:      #0f1213;
  --panel:      #14181a;
  --panel-2:    #1a1f22;
  --border:     #262c30;
  --border-soft:#1e2427;

  /* text */
  --text:       #e8edf0;
  --muted:      #8a949b;
  --faint:      #5c666c;

  /* meaningful accents (the dependence scale) */
  --green:      #4ade80;  /* self-reliant / good  */
  --green-dim:  #2f9c5a;
  --amber:      #e3b341;  /* caution              */
  --red:        #ff6b6b;  /* dependent / warning  */

  /* usage */
  --accent:     var(--green);
  --accent-ink: #05130a;

  /* type */
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* scale */
  --step--1: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --step-0:  clamp(0.95rem, 0.92rem + 0.15vw, 1.02rem);
  --step-1:  clamp(1.12rem, 1.05rem + 0.4vw, 1.35rem);
  --step-2:  clamp(1.45rem, 1.3rem + 0.8vw, 2rem);
  --step-3:  clamp(2rem, 1.6rem + 2vw, 3.25rem);
  --step-4:  clamp(2.6rem, 1.9rem + 3.4vw, 4.75rem);

  /* structure */
  --container: 1080px;
  --radius: 10px;
  --radius-sm: 6px;
  --gap: clamp(1rem, 0.7rem + 1.4vw, 1.6rem);
  --section-y: clamp(4rem, 2.5rem + 6vw, 8rem);

  --ease: cubic-bezier(0.4, 0, 0.15, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* faint scanline / grid texture, kept very subtle */
  background-image:
    radial-gradient(1200px 700px at 78% -8%, rgba(74,222,128,0.06), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(227,179,65,0.04), transparent 60%);
  background-repeat: no-repeat;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; color: inherit; background: none; border: none; }
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
  border-radius: 3px;
}
::selection { background: rgba(74,222,128,0.28); color: #fff; }

/* ---------- Layout ---------- */
.container { width: min(100% - 2.4rem, var(--container)); margin-inline: auto; }
.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 5rem); }

/* eyebrow: a shell "command" that names the section */
.eyebrow {
  font-family: var(--mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.1rem;
}
.eyebrow::before { content: "$"; color: var(--green); font-weight: 700; }

.section-title {
  font-family: var(--mono);
  font-weight: 800;
  font-size: var(--step-3);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.section-lead {
  color: var(--muted);
  max-width: 60ch;
  margin-top: 1rem;
  font-size: var(--step-1);
}

/* comment prefix helper */
.cmt { color: var(--faint); font-family: var(--mono); }
.cmt::before { content: "// "; }
.tok-green { color: var(--green); }
.tok-amber { color: var(--amber); }
.tok-red   { color: var(--red); }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  border-bottom: 1px solid var(--border-soft);
}
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; height: 64px;
}
.brand {
  font-family: var(--mono); font-weight: 700; letter-spacing: -0.01em;
  display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1rem;
}
.brand .prompt { color: var(--green); }
.brand .caret {
  width: 0.55em; height: 1.05em; background: var(--green);
  display: inline-block; translate: 0 0.16em;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.nav__links { display: flex; align-items: center; gap: 0.35rem; }
.nav__links a {
  font-family: var(--mono); font-size: var(--step--1);
  color: var(--muted); padding: 0.5rem 0.7rem; border-radius: var(--radius-sm);
  transition: color 0.18s var(--ease), background 0.18s var(--ease);
}
.nav__links a:hover { color: var(--text); background: var(--panel); }
.nav__links a[aria-current="page"] { color: var(--green); }
.nav__links a[aria-current="page"]::before { content: "› "; color: var(--green); }

.nav__toggle { display: none; padding: 0.5rem; color: var(--text); font-family: var(--mono); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 0.55rem;
  font-family: var(--mono); font-weight: 600; font-size: var(--step--1);
  padding: 0.72rem 1.15rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: transform 0.15s var(--ease), border-color 0.18s var(--ease),
              background 0.18s var(--ease), color 0.18s var(--ease);
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn--primary {
  background: var(--green); color: var(--accent-ink); border-color: var(--green);
  font-weight: 700;
}
.btn--primary:hover { box-shadow: 0 8px 26px -10px rgba(74,222,128,0.6); }
.btn--ghost { color: var(--text); background: var(--panel); }
.btn--ghost:hover { border-color: var(--green); color: var(--green); }
.btn .arrow { transition: transform 0.18s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- Window-chrome dots (used in photo frames) ---------- */
.term__dots { display: inline-flex; gap: 0.4rem; margin-right: 0.6rem; }
.term__dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--faint); }
.term__dots i:nth-child(1) { background: #ff5f57; }
.term__dots i:nth-child(2) { background: #febc2e; }
.term__dots i:nth-child(3) { background: #28c840; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: var(--gap); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.2rem, 1rem + 0.8vw, 1.7rem);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
  position: relative;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--green) 45%, var(--border)); }
.card__k {
  font-family: var(--mono); font-size: 0.72rem; color: var(--faint);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.8rem;
  display: block;
}
.card__title { font-family: var(--mono); font-weight: 700; font-size: var(--step-1); letter-spacing: -0.01em; }
.card__body { color: var(--muted); margin-top: 0.55rem; font-size: var(--step-0); }

/* house rules — habit diff cards */
.rule {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: clamp(1.1rem, 0.9rem + 0.6vw, 1.5rem);
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.rule:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--green) 40%, var(--border)); }
.rule__head {
  font-family: var(--mono); font-weight: 700; font-size: var(--step-1);
  letter-spacing: -0.01em; margin-bottom: 0.9rem; line-height: 1.25;
}
.rule__no { color: var(--faint); margin-right: 0.5rem; }
.diff {
  font-family: var(--mono); font-size: var(--step--1); line-height: 1.5;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm); overflow: hidden;
}
.diff span { display: block; padding: 0.5rem 0.75rem; }
.diff__del { background: rgba(255,107,107,0.10); color: #f0a6a6; }
.diff__add { background: rgba(74,222,128,0.10); color: #9fe6b8; border-top: 1px solid var(--border-soft); }
.diff b { display: inline-block; width: 1ch; margin-right: 0.4rem; font-weight: 800; }
.diff__del b { color: var(--red); }
.diff__add b { color: var(--green); }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font-family: var(--mono); font-size: var(--step--1);
  padding: 0.35rem 0.7rem; border: 1px solid var(--border);
  border-radius: 999px; color: var(--muted); background: var(--panel);
}
.chip::before { content: "#"; color: var(--green); margin-right: 0.15rem; }

/* ---------- Dependence gallery ---------- */
.dep-gallery { align-items: start; }
.dep-item { margin: 0; }
.dep-item img {
  width: 100%; height: auto; display: block; border-radius: var(--radius);
}
.dep-item figcaption {
  font-family: var(--mono); font-size: var(--step--1); color: var(--muted);
  margin-top: 0.9rem; line-height: 1.5;
}

/* ---------- Field notes ---------- */
.note { display: flex; flex-direction: column; }
.note .card__body { flex: 1; }
.note__foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 1.3rem; padding-top: 1rem; border-top: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: var(--step--1);
}
.note__by { color: var(--faint); }
.note__link { color: var(--green); transition: transform 0.16s var(--ease); }
.note:hover .note__link { transform: translateX(3px); }

.submit-note {
  margin-top: var(--gap);
  display: flex; align-items: center; justify-content: space-between; gap: 1.4rem;
  flex-wrap: wrap;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: clamp(1.4rem, 1.1rem + 1.5vw, 2.2rem);
}

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border-soft);
  padding-block: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  color: var(--muted); font-family: var(--mono); font-size: var(--step--1);
}
.footer__grid { display: flex; flex-wrap: wrap; gap: 1.5rem 3rem; justify-content: space-between; }
.footer a { color: var(--muted); transition: color 0.16s var(--ease); }
.footer a:hover { color: var(--green); }
.footer__note { color: var(--faint); margin-top: 1.6rem; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(2.5rem, 1.5rem + 3vw, 4.5rem); }
.hero__title {
  font-family: var(--mono); font-weight: 800; letter-spacing: -0.03em;
  font-size: var(--step-4); line-height: 1.02; margin-bottom: 1.3rem;
}
.hero__lead { color: var(--muted); font-size: var(--step-1); max-width: 46ch; }
.hero__lead em { color: var(--text); font-style: normal; border-bottom: 2px solid var(--green); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.9rem; }
/* ---------- Coming-soon card (Tourist) ---------- */
.teaser {
  display: grid; grid-template-columns: 1.3fr 0.7fr; gap: clamp(1.5rem, 1rem + 2.5vw, 3rem);
  align-items: center;
  background: linear-gradient(180deg, var(--panel), var(--ink-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(1.6rem, 1.2rem + 2.5vw, 3.2rem);
}
.teaser .section-title { font-size: var(--step-3); }

/* ---------- About page ---------- */
.about__grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(1.6rem, 1rem + 3vw, 3.4rem); align-items: center;
}
.about__name {
  font-family: var(--mono); font-weight: 800; letter-spacing: -0.03em;
  font-size: var(--step-4); line-height: 1; margin-bottom: 0.7rem;
}
.about__role { font-family: var(--mono); color: var(--muted); font-size: var(--step-1); }
.about__role .tok-green { font-weight: 700; }
.about__bio { color: var(--muted); margin-top: 1.3rem; max-width: 52ch; font-size: var(--step-1); }
.about__bio strong { color: var(--text); }
.about__bio em { color: var(--green); font-style: normal; }
.about__thesis {
  font-family: var(--mono); font-size: var(--step-1); line-height: 1.5;
  color: var(--text); max-width: 54ch; margin-top: 1.5rem;
  border-left: 3px solid var(--green);
  padding: 0.55rem 0 0.55rem 1.1rem;
  background: linear-gradient(90deg, rgba(74,222,128,0.07), transparent 70%);
}
.about__thesis em { color: var(--green); font-style: normal; font-weight: 700; }
.about__thesis mark {
  background: rgba(74,222,128,0.22); color: var(--text);
  padding: 0.05em 0.2em; border-radius: 3px;
}
.about__links { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.7rem; }

.about__two {
  display: grid; grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(1.6rem, 1rem + 3vw, 3.4rem); align-items: center;
}
.about__two--rev .photo-frame { order: 0; }

/* photo frame styled like a terminal/file window */
.photo-frame {
  margin: 0; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 30px 70px -40px rgba(0,0,0,0.85);
}
.photo-frame__bar {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.85rem; background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono); font-size: 0.75rem; color: var(--muted);
}
.photo-frame img { width: 100%; height: 100%; max-height: 460px; object-fit: cover; display: block; }
.photo-frame--tall img { max-height: 520px; }

/* timeline */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px;
  width: 2px; background: var(--border);
}
.tl { position: relative; padding: 0 0 1.6rem 2.2rem; display: grid; gap: 0.15rem; }
.tl:last-child { padding-bottom: 0; }
.tl__dot {
  position: absolute; left: 0; top: 5px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--panel); border: 2px solid var(--faint);
}
.tl__dot[data-now] { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 4px rgba(74,222,128,0.18); }
.tl__meta { font-family: var(--mono); font-size: var(--step--1); color: var(--muted); }
.tl__role { font-family: var(--mono); font-weight: 700; font-size: var(--step-1); letter-spacing: -0.01em; }
.tl__org { color: var(--green); font-family: var(--mono); font-size: var(--step-0); }

/* plain lists */
.plainlist { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.plainlist li { display: grid; gap: 0.15rem; }
.plainlist strong { font-family: var(--mono); font-weight: 700; font-size: var(--step-1); }
.plainlist .dim { color: var(--muted); font-size: var(--step-0); }
.plainlist--marked li { border-left: 2px solid var(--green-dim); padding-left: 1rem; }

@media (max-width: 820px) {
  .about__grid, .about__two { grid-template-columns: 1fr; }
  .about__two--rev .photo-frame { order: 1; }
}

@media (max-width: 820px) {
  .teaser { grid-template-columns: 1fr; }
}

/* utilities */
.stack > * + * { margin-top: 1rem; }
.center { text-align: center; margin-inline: auto; }
.mono { font-family: var(--mono); }
.divider { height: 1px; background: var(--border-soft); border: 0; margin-block: var(--section-y); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid--3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 680px) {
  .grid--3, .grid--2 { grid-template-columns: 1fr; }
  .nav__links {
    position: fixed; inset: 64px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--ink-2); border-bottom: 1px solid var(--border);
    padding: 0.5rem; transform: translateY(-140%);
    transition: transform 0.28s var(--ease); box-shadow: 0 30px 60px -30px #000;
  }
  .nav__links.is-open { transform: none; }
  .nav__links a { padding: 0.85rem 0.9rem; border-radius: var(--radius-sm); }
  .nav__toggle { display: inline-flex; }
}
