/* components.css — redesign component styles. Ported px-for-px from
   plans/redesign-mockup-spec/shared.css (site html is 62.5%, so px render
   literally). Builds on tokens.css + base.css; does not duplicate base rules.
   NOTE: .badge is a NEW class; legacy latest.css uses .section-badge — no clash.

   Phase 2 (homepage): hero, buttons, section heads, badges, cards, post-rows.
   Later phases append talk cards / project grid here. */

/* ---- Hero ---- */
.hero {
  display: flex;
  gap: 56px;
  align-items: center;
  justify-content: space-between;
  padding: 72px 0 52px;
}
.hero-main { flex: 1; min-width: 0; }
.hero-kicker {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin: 0;
}
.hero-title {
  font-size: clamp(34px, 5vw, 52px);
  margin: 12px 0 14px;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-weight: 700;
}
.hero-tagline {
  font-size: clamp(17px, 2vw, 20.5px);
  line-height: 1.55;
  color: var(--muted);
  max-width: 54ch;
  margin: 0 0 16px;
  text-wrap: pretty;
}
.hero-meta {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--faint);
  margin: 0 0 28px;
}
.hero-ctas {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.hero-side {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.hero-photo {
  width: 208px;
  height: 208px;
  border-radius: 24px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.hero-prompt {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--faint);
  margin: 0;
}
.hero-prompt .p-accent { color: var(--accent); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14.5px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { box-shadow: var(--shadow); color: var(--accent-contrast); }
.btn-outline { border-color: var(--border-strong); color: var(--fg); background: var(--surface); }
.btn-outline:hover { border-color: var(--accent); color: var(--fg); }
.btn-link { color: var(--accent-strong); font-weight: 600; font-size: 14.5px; }
.btn-link:hover { text-decoration: underline; }

/* ---- Sections ---- */
.section { padding: 40px 0; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-title { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.section-hash { color: var(--accent); font-family: var(--font-mono); font-weight: 600; margin-right: 8px; }
.see-all { font-family: var(--font-mono); font-size: 13px; color: var(--accent-strong); white-space: nowrap; }
.see-all:hover { text-decoration: underline; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge-post { color: var(--accent-strong); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge-project { color: var(--amber); background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.badge-ailab { color: var(--violet); background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 35%, transparent); }
.badge-co { color: var(--green); background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.badge-talk { color: var(--accent-strong); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.badge-meetup { color: var(--green); background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.badge-podcast { color: var(--violet); background: var(--violet-soft); border-color: color-mix(in srgb, var(--violet) 35%, transparent); }
.badge-workshop { color: var(--amber); background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.badge-sample { color: var(--faint); background: transparent; border: 1px dashed var(--border-strong); }

/* ---- Cards (featured) ---- */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--fg);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.card-title { font-size: 16.5px; font-weight: 600; line-height: 1.35; margin: 0; color: var(--fg); }
.card-desc { font-size: 14px; color: var(--muted); line-height: 1.55; margin: 0; }
.card-foot { margin-top: auto; padding-top: 6px; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-strong); }

/* ---- List page head (Phase 3: /posts/, /co-authored/, /ai-lab/, /latest/) ---- */
.page-head { padding: 60px 0 8px; max-width: 780px; }
.page-kicker { font-family: var(--font-mono); font-size: 13px; color: var(--accent-strong); margin: 0; }
.page-title { font-size: clamp(30px, 4.5vw, 42px); letter-spacing: -0.02em; margin: 10px 0 14px; font-weight: 700; }
.page-intro { font-size: 17px; line-height: 1.65; color: var(--muted); margin: 0 0 4px; text-wrap: pretty; }
.page-intro p { margin: 0 0 12px; }
.page-intro p:last-child { margin-bottom: 0; }

/* ---- Filter pills (Phase 3) ---- */
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 10px; }
.pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 5px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.pill:hover { border-color: var(--accent); color: var(--accent-strong); }
.pill.is-active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }

/* ---- Post rows ---- */
.post-rows { display: flex; flex-direction: column; }
.post-row {
  display: flex;
  gap: 18px;
  align-items: baseline;
  padding: 14px 6px;
  border-bottom: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  transition: background 0.15s;
}
.post-row:hover { background: var(--surface-2); }
.post-date { font-family: var(--font-mono); font-size: 13px; color: var(--faint); min-width: 108px; white-space: nowrap; }
.post-title { font-weight: 500; font-size: 15.5px; flex: 1; min-width: 0; line-height: 1.45; }
.post-row:hover .post-title { color: var(--accent-strong); }
.post-row .badge { align-self: center; }

/* ---- Projects grid (Phase 4; ported px-as-is from mockup shared.css) ---- */
.proj-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 28px 0 8px; }
.proj-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.proj-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.proj-media { aspect-ratio: 16 / 9; display: grid; place-items: center; border-bottom: 1px solid var(--border); overflow: hidden; }
.proj-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--font-mono); font-weight: 600; font-size: 36px; }
.tile-a { background: var(--accent-soft); color: var(--accent-strong); }
.tile-b { background: var(--amber-soft); color: var(--amber); }
.tile-c { background: var(--violet-soft); color: var(--violet); }
.tile-d { background: var(--green-soft); color: var(--green); }
.proj-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.proj-title { font-weight: 600; font-size: 16px; margin: 0; }
.proj-title a { color: var(--fg); }
.proj-card:hover .proj-title a { color: var(--accent-strong); }
/* Stretched-link: title anchor covers the whole card (keeps card + github link both clickable, no nested <a>). */
.proj-link::after { content: ""; position: absolute; inset: 0; z-index: 0; }
.proj-desc { font-size: 13.5px; color: var(--muted); line-height: 1.5; margin: 0; }
.proj-foot { margin-top: auto; padding-top: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.chip-tool { font-family: var(--font-mono); font-size: 11px; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.gh-link { position: relative; z-index: 1; font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-strong); }
.gh-link:hover { text-decoration: underline; }

/* ---- Talk cards (Phase 5: /speaking/; ported px-as-is from mockup shared.css) ---- */
.page-cta { margin: 20px 0 0; }
.talk-list { display: flex; flex-direction: column; gap: 14px; margin: 24px 0 8px; }
.talk-card { display: flex; gap: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 22px; transition: border-color 0.15s; }
.talk-card:hover { border-color: var(--accent); }
.talk-date { font-family: var(--font-mono); font-size: 13px; color: var(--faint); min-width: 96px; padding-top: 3px; }
.talk-main { flex: 1; min-width: 0; }
.talk-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.talk-head .badge { align-self: center; }
.talk-title { font-size: 17px; font-weight: 600; margin: 0; }
.talk-event { font-size: 14px; color: var(--muted); margin-top: 5px; }
.talk-summary { font-size: 14px; color: var(--muted); line-height: 1.55; margin-top: 8px; }
.talk-links { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.talk-link { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent-strong); border: 1px solid var(--border); padding: 5px 11px; border-radius: 8px; transition: border-color 0.15s; }
.talk-link:hover { border-color: var(--accent); }
.talk-empty { font-family: var(--font-mono); font-size: 13.5px; color: var(--muted); margin: 28px 0 8px; }

/* ---- About page (reuses .hero-meta / .hero-ctas / .btn) ---- */
.about-lead { margin: 0 0 22px; }
.about-ctas { margin: 26px 0 10px; }
.about-note { font-family: var(--font-mono); font-size: 12.5px; color: var(--faint); margin: 34px 0 0; }

/* ---- Section badges (/latest/ feed rows; absorbed from legacy latest.css) ----
   The /latest/ template (layouts/latest/list.html) tags each row with
   `.section-badge.section-<section>`. This is a distinct outlined-pill style (not
   the filled .badge chips) kept for the mixed posts/projects/co-authored feed.
   Retokenized so both schemes stay legible without the old body.colorscheme-dark
   overrides. */
.section-badge {
  display: inline-block;
  color: var(--muted); /* default for any untyped entry (external talk/link) */
  font-size: 1.2rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2em 0.55em;
  margin: 0 0.4em;
  border-radius: 999px;
  vertical-align: middle;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.section-badge.section-posts { color: var(--accent-strong); }
.section-badge.section-projects { color: var(--amber); }
.section-badge.section-co-authored { color: var(--violet); }

/* /latest/ rows: date + badge + title on a wrapping baseline row. Overrides the
   generic nowrap `.list ul li` rule in base.css so long titles can wrap. */
.list.latest ul li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.5rem;
  white-space: normal;
}
.list.latest ul li .date { flex: 0 0 auto; }
.list.latest ul li .title { flex: 1 1 12rem; }

/* ---- Responsive ---- */
@media (max-width: 920px) {
  .card-grid, .proj-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .card-grid, .proj-grid { grid-template-columns: 1fr; }
  .hero {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 28px;
    padding: 40px 0 28px;
  }
  .hero-photo { width: 148px; height: 148px; border-radius: 18px; }
  .hero-side { align-items: flex-start; }
  .post-date { min-width: 88px; font-size: 12px; }
  /* Accessibility: keep CTA buttons a >=44px touch target on mobile. */
  .btn { min-height: 44px; }
  .talk-card { flex-direction: column; gap: 10px; }
}
@media (max-width: 480px) {
  .section-badge { margin-left: 0; }
}
