/* ===========================================================================
   TinySkiff ESP32-S3 Lab · landing (/)
   A light, minimal, self-contained design for the front door — approachable for
   someone picking up an ESP32-S3 for the first time. The course pages keep their
   own styling; this stylesheet does not depend on course.css.
   =========================================================================== */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Spline Sans Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Cool-neutral paper — not cream. */
  --bg:        #fcfcfd;
  --card:      #ffffff;
  --surface:   #f4f5f8;
  --surface-2: #eef0f4;
  --line:      #e5e7ee;
  --line-soft: #eef0f5;

  --ink:   #171a20;
  --ink-2: #4c525d;
  --ink-3: #7b828e;

  /* One calm, friendly accent + two muted track hues used only on tiny pills. */
  --accent:      #3557f0;
  --accent-strong: #2743c9;
  --accent-tint: #eef1fe;
  --accent-ink:  #223bb8;
  --c-hue:   #2743c9;   --c-tint:  #eef1fe;
  --py-hue:  #0f7d86;   --py-tint: #e4f4f5;

  --r-lg: 18px;
  --r-md: 12px;
  --r-sm: 8px;

  --shadow-sm: 0 1px 2px rgba(18, 22, 33, .04), 0 1px 3px rgba(18, 22, 33, .05);
  --shadow-md: 0 6px 22px rgba(18, 22, 33, .07);

  --wrap: 1080px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.mono { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

a { color: inherit; }

.page { width: 100%; }

section,
.hero-grid,
.colophon > * {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 40px);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: .74rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .9rem;
}

.hl { color: var(--accent); }

/* ---- Hero ---------------------------------------------------------------- */

.hero {
  position: relative;
  padding-block: clamp(56px, 9vw, 104px) clamp(40px, 6vw, 72px);
  /* Faint breadboard-dot motif — a subject nod, kept barely-there. */
  background-image: radial-gradient(rgba(23, 26, 32, .045) 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: -11px -11px;
  border-bottom: 1px solid var(--line-soft);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.35fr .9fr;
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
}

.hero-copy h1 {
  font-size: clamp(2.15rem, 5.2vw, 3.5rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 1.1rem;
}

.lede {
  font-size: 1.12rem;
  color: var(--ink-2);
  max-width: 40ch;
  margin: 0 0 1.75rem;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin-bottom: 1.15rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  border-radius: var(--r-md);
  padding: .72em 1.25em;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(53, 87, 240, .35), 0 6px 18px rgba(53, 87, 240, .22);
}
.btn-primary:hover { background: var(--accent-strong); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: var(--card);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--ink-3); transform: translateY(-1px); }

.hero-foot {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--ink-3);
  margin: 0;
}

/* Voyage progress card — a friendly 30-day tracker, not an instrument gauge. */
.voyage-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  padding: 1.35rem 1.4rem 1.5rem;
}

.voyage-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.voyage-title { font-weight: 600; font-size: .98rem; }
.voyage-count {
  font-family: var(--font-mono);
  font-size: .82rem;
  color: var(--ink-3);
}
.voyage-count b { color: var(--accent); font-weight: 600; }

.voyage {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 6px;
  margin-bottom: 1.1rem;
}
.voyage .pip {
  aspect-ratio: 1;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background .2s ease, border-color .2s ease, transform .2s ease;
}
.voyage .pip.is-done {
  background: var(--accent);
  border-color: var(--accent);
}
.voyage .pip.is-next {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.voyage-resume {
  display: inline-block;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  font-size: .95rem;
  margin-bottom: .35rem;
}
/* app.js toggles the `hidden` attribute; don't let display override it, or a
   fresh visitor with no saved progress sees a dead "Resume →" link. */
.voyage-resume[hidden] { display: none; }
.voyage-resume:hover { text-decoration: underline; }

.voyage-note {
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.5;
  color: var(--ink-3);
  margin: 0;
}

/* ---- Section scaffolding ------------------------------------------------- */

main > section { padding-block: clamp(48px, 7vw, 80px); }

.section-head { margin-bottom: 2rem; }
.section-h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 650;
  margin: 0 0 .7rem;
}
.section-sub {
  color: var(--ink-2);
  font-size: 1.05rem;
  max-width: 58ch;
  margin: 0;
}

/* ---- Legs ---------------------------------------------------------------- */

.legs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 14px;
}

.leg {
  display: flex;
  gap: .9rem;
  padding: 1.15rem 1.2rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.leg:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: var(--shadow-md);
}
.leg-no {
  font-size: .82rem;
  font-weight: 500;
  color: var(--accent);
  padding-top: .15rem;
}
.leg-body { display: flex; flex-direction: column; gap: .15rem; }
.leg-range {
  font-size: .72rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.leg-name { font-weight: 600; font-size: 1.05rem; }
.leg-sub { color: var(--ink-2); font-size: .92rem; line-height: 1.45; }

/* ---- Library (secondary) ------------------------------------------------- */

.lib {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.lib-stats {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: 1.4rem;
}
.lib-stat {
  display: inline-flex;
  align-items: baseline;
  gap: .4rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .4rem .85rem;
}
.lib-stat b { font-size: 1rem; font-weight: 700; }
.lib-stat span { font-size: .82rem; color: var(--ink-2); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin-bottom: .9rem;
}
#search,
#trackFilter {
  font: inherit;
  font-size: .95rem;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--ink);
  padding: .65em .9em;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#search { flex: 1 1 260px; }
#search::placeholder { color: var(--ink-3); }
#search:focus,
#trackFilter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-tint);
}
#trackFilter { cursor: pointer; }

.proj-count {
  font-size: .8rem;
  color: var(--ink-3);
  margin-bottom: 1rem;
}

.proj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 14px;
}

.proj-card {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.05rem 1.1rem 1.1rem;
  box-shadow: var(--shadow-sm);
}
.proj-card h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.25;
}
.proj-pills { display: flex; flex-wrap: wrap; gap: .35rem; }
.proj-pill {
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .02em;
  padding: .2em .55em;
  border-radius: 999px;
  border: 1px solid transparent;
}
.proj-pill.is-c   { background: var(--c-tint);  color: var(--c-hue); }
.proj-pill.is-py  { background: var(--py-tint); color: var(--py-hue); }
.proj-pill.is-num { background: var(--surface-2); color: var(--ink-2); }

.proj-path {
  font-size: .76rem;
  color: var(--ink-3);
  margin: 0;
  overflow-wrap: anywhere;
}

.proj-taught {
  font-size: .82rem;
  font-weight: 500;
  color: var(--accent-ink);
  text-decoration: none;
  padding: .35rem .55rem;
  background: var(--accent-tint);
  border-radius: var(--r-sm);
  line-height: 1.35;
}
.proj-taught:hover { text-decoration: underline; }

.proj-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .8rem;
  margin-top: auto;
  padding-top: .5rem;
}
.pa-primary {
  font-weight: 600;
  font-size: .88rem;
  color: var(--accent);
  text-decoration: none;
}
.pa-primary:hover { text-decoration: underline; }
.pa-ghost {
  font: inherit;
  font-size: .85rem;
  color: var(--ink-2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}
.pa-ghost:hover { color: var(--ink); text-decoration: underline; }

/* Libraries / datasheets */
.res-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 2rem;
}
.res-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.res-card h3 {
  margin: 0 0 .75rem;
  font-size: 1rem;
  font-weight: 600;
}
.res-list { display: flex; flex-direction: column; }
.res-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem 0;
  border-top: 1px solid var(--line-soft);
}
.res-item:first-child { border-top: none; }
.res-item a { color: var(--accent-ink); text-decoration: none; font-size: .9rem; }
.res-item a:hover { text-decoration: underline; }
.res-item small { color: var(--ink-3); font-size: .74rem; white-space: nowrap; }
.res-list.compact .res-item { padding: .38rem 0; }

/* ---- Colophon ------------------------------------------------------------ */

.colophon {
  border-top: 1px solid var(--line);
  padding-block: 2.5rem 3rem;
  background: var(--card);
}
.colophon p {
  color: var(--ink-2);
  font-size: .86rem;
  max-width: 70ch;
  margin: 0 auto;
}
.src-links {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.4rem;
  margin: 1rem auto;
}
.src-links a { color: var(--accent-ink); text-decoration: none; font-size: .86rem; }
.src-links a:hover { text-decoration: underline; }
.colophon .gen { color: var(--ink-3); font-size: .74rem; }

/* ---- Code preview dialog ------------------------------------------------- */

.code-dialog {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  max-width: min(760px, 92vw);
  width: 100%;
  box-shadow: 0 24px 60px rgba(18, 22, 33, .28);
  color: var(--ink);
  background: var(--card);
}
.code-dialog::backdrop { background: rgba(18, 22, 33, .45); backdrop-filter: blur(2px); }
.code-dialog h3 { margin: 0 1.5rem .3rem 0; font-size: 1.15rem; }
.code-dialog .close {
  position: absolute;
  top: .8rem;
  right: .9rem;
  font-size: 1.5rem;
  line-height: 1;
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  padding: .1rem .3rem;
}
.code-dialog .close:hover { color: var(--ink); }
.code-dialog #dialogMeta { color: var(--ink-3); font-size: .8rem; margin: 0 0 1rem; }
.code-dialog pre {
  margin: 0;
  background: var(--ink);
  color: #e9ecf5;
  border-radius: var(--r-md);
  padding: 1.1rem 1.2rem;
  overflow: auto;
  max-height: 60vh;
}
.code-dialog code { font-family: var(--font-mono); font-size: .82rem; line-height: 1.6; }

/* ---- Focus + motion ------------------------------------------------------ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
  .btn:hover, .leg:hover { transform: none; }
}

/* ---- Responsive ---------------------------------------------------------- */

@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .voyage-card { order: 2; }
  .lede { max-width: none; }
}

@media (max-width: 460px) {
  .cta-row .btn { flex: 1 1 100%; justify-content: center; }
}
