/* ==========================================================================
   Madhav Rao — Personal Website & Digital Garden
   Minimal v2: hairlines, whitespace, dot tags, inline Lucide icons.
   Single stylesheet. No build step, no JS.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #FCFCFB;
  --surface: #F4F3F0;
  --ink: #1A1A18;
  --ink-soft: #5C5A54;
  --accent: #1E6B5C;
  --rule: #EAE8E3;

  --pillar-arch: #1E5AA8;
  --pillar-uiux: #A8501E;
  --pillar-product: #6B1E8F;
  --pillar-teaching: #75641A;
  --pillar-agentic: #1E6B5C;
  --pillar-data: #0E7490;
  --pillar-platform: #9F1239;

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, monospace;

  --measure: 42rem;
  --wide: 44rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --surface: #201F1C;
    --ink: #ECEAE4;
    --ink-soft: #A3A199;
    --accent: #5CBBA4;
    --rule: #2C2B28;

    --pillar-arch: #7FB1E8;
    --pillar-uiux: #E8A37F;
    --pillar-product: #C58FDD;
    --pillar-teaching: #D4C06A;
    --pillar-agentic: #5CBBA4;
    --pillar-data: #6CC5DE;
    --pillar-platform: #E58FA6;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 600;
  margin: 0 0 1rem;
}
h1 { font-size: 1.875rem; }
h2 { font-size: 1.25rem; margin-top: 3rem; }
h3 { font-size: 1.0625rem; margin-top: 2rem; }

p { margin: 0 0 1.25rem; }

a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--rule); text-decoration-thickness: 1px; text-underline-offset: 3px; transition: text-decoration-color 120ms ease; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--surface);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}
pre {
  background: var(--surface);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  line-height: 1.55;
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 1.75rem 0;
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-soft);
}
blockquote p { margin: 0; }

hr { border: none; border-top: 1px solid var(--rule); margin: 3rem 0; }

ul, ol { padding-left: 1.25rem; margin: 0 0 1.25rem; }
li { margin-bottom: 0.5rem; }

img { max-width: 100%; height: auto; }

::selection { background: var(--accent); color: var(--bg); }

/* ---------- Icons (inline Lucide SVGs) ---------- */
.icon {
  width: 1.05em;
  height: 1.05em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.16em;
  flex-shrink: 0;
}
.icon-lg { width: 1.25rem; height: 1.25rem; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 0.5rem 1rem;
  z-index: 10;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ---------- Layout ---------- */
.container { max-width: var(--wide); margin: 0 auto; padding: 0 1.5rem; }
.prose { max-width: var(--measure); margin: 0 auto; padding: 0 1.5rem; }

main { padding: 3.5rem 0 5rem; }

/* ---------- Header ---------- */
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 2rem;
  padding-bottom: 0.875rem;
  border-bottom: 1px dotted var(--ink-soft);
}
.wordmark {
  font-weight: 600;
  font-size: 1.2em;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
  text-transform: lowercase;
}

/* Mobile nav toggle (CSS-only checkbox pattern; label/input hidden on desktop) */
.nav-toggle {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.nav-toggle-label { display: none; }
.nav-toggle:focus-visible ~ .nav-toggle-label {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.site-nav { display: flex; align-items: center; gap: 1.25rem; overflow-x: auto; }
.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.875rem;
  line-height: 1;
  white-space: nowrap;
  text-transform: lowercase;
}
.site-nav a:hover { color: var(--accent); }
.site-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0 3rem;
  color: var(--ink-soft);
  font-size: 0.875rem;
}
.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer a { color: var(--ink-soft); }

/* ---------- Masthead (home) ---------- */
.masthead {
  padding: 1.5rem 0 0.5rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2.5rem;
}
.masthead-text { flex: 1; min-width: 0; }
.masthead-photo {
  margin-top: 0.35rem; /* optical alignment with the h1 cap height */
  width: 176px;
  height: 176px;
  object-fit: cover;
  object-position: 50% 22%; /* keep the face centred in the square crop */
  border-radius: 28px;
  flex-shrink: 0;
  border: 1px solid var(--rule);
}
.masthead h1 { font-size: 1.75rem; max-width: 26ch; }
.masthead .lede { font-size: 1.0625rem; color: var(--ink-soft); max-width: 52ch; }
.link-row { display: flex; gap: 2rem; margin-top: 1.75rem; flex-wrap: wrap; }
.link-row a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--accent);
}
.link-row a:hover { text-decoration: underline; text-decoration-color: var(--accent); }

/* ---------- Section labels ---------- */
.section-label {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 4rem 0 0.5rem;
}

/* ---------- Item lists (pillars, notes) ---------- */
.item-list { list-style: none; padding: 0; margin: 0; }
.item-list li { margin: 0; border-bottom: 1px solid var(--rule); }
.item-list li:first-child { border-top: 1px solid var(--rule); }

.item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 1.1rem 0;
  text-decoration: none;
  color: var(--ink);
}
.item .icon { position: relative; top: 0.13em; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-weight: 500; margin: 0; }
a.item:hover .item-title { color: var(--accent); }
.item-sub { font-size: 0.875rem; color: var(--ink-soft); margin: 0.1rem 0 0; }
.item-end {
  font-size: 0.8125rem;
  color: var(--ink-soft);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---------- Dot tags ---------- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
}
.tag::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--dot, var(--ink-soft));
}
.tag-arch     { --dot: var(--pillar-arch); }
.tag-uiux     { --dot: var(--pillar-uiux); }
.tag-product  { --dot: var(--pillar-product); }
.tag-teaching { --dot: var(--pillar-teaching); }
.tag-agentic  { --dot: var(--pillar-agentic); }
.tag-data     { --dot: var(--pillar-data); }
.tag-platform { --dot: var(--pillar-platform); }

.pillar-icon-arch     { color: var(--pillar-arch); }
.pillar-icon-uiux     { color: var(--pillar-uiux); }
.pillar-icon-product  { color: var(--pillar-product); }
.pillar-icon-teaching { color: var(--pillar-teaching); }
.pillar-icon-agentic  { color: var(--pillar-agentic); }
.pillar-icon-data     { color: var(--pillar-data); }
.pillar-icon-platform { color: var(--pillar-platform); }

/* ---------- Maturity ---------- */
.maturity { color: var(--ink-soft); display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8125rem; }

/* ---------- Note pages ---------- */
.breadcrumb { font-size: 0.8125rem; color: var(--ink-soft); margin-bottom: 2rem; }
.breadcrumb a { color: var(--ink-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--accent); }

.note-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin: -0.25rem 0 2.5rem;
}

.note-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}
.note-footer h2 {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-top: 1.5rem;
}
.note-footer ul { list-style: none; padding: 0; }
.note-footer li { margin-bottom: 0.35rem; }

/* ---------- Garden legend ---------- */
.legend {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  color: var(--ink-soft);
  margin: 1.5rem 0 1rem;
}
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }

/* ---------- Garden index: toolbar, jump bar, collapsible categories ---------- */
.garden-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 0.85rem 0 0.75rem;
  border-bottom: 1px solid var(--rule);
  margin: 1.5rem 0 1rem;
}
.note-filter {
  width: 100%;
  font: inherit;
  font-size: 0.9375rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}
.note-filter::placeholder { color: var(--ink-soft); }
.note-filter:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jump-bar {
  display: flex;
  gap: 0.35rem 1.15rem;
  flex-wrap: wrap;
  font-size: 0.8125rem;
  margin-top: 0.65rem;
}
.jump-bar a { color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.jump-bar a:hover { color: var(--accent); }
.jump-bar .count { opacity: 0.65; }

details.category { scroll-margin-top: 6.5rem; }
details.category > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0;
}
details.category > summary::-webkit-details-marker { display: none; }
details.category > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
details.category > summary .section-label { margin: 1.5rem 0 0.25rem; }
details.category > summary::after {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-right: 1.5px solid var(--ink-soft);
  border-bottom: 1.5px solid var(--ink-soft);
  transform: rotate(-45deg);
  transition: transform 120ms ease;
  align-self: center;
  margin-top: 1.25rem;
}
details.category[open] > summary::after { transform: rotate(45deg); }
.category-count { font-size: 0.8125rem; color: var(--ink-soft); align-self: center; margin-top: 1.4rem; }
.filter-empty { color: var(--ink-soft); font-size: 0.9375rem; margin-top: 1.5rem; }

/* ---------- Now line (home) ---------- */
.now-line {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 1rem; }
  h1, .masthead h1 { font-size: 1.5rem; }
  .masthead { flex-direction: column-reverse; align-items: flex-start; gap: 1.5rem; }
  .masthead-photo { width: 112px; height: 112px; border-radius: 20px; }
  main { padding: 2.5rem 0 4rem; }
  .item { flex-wrap: wrap; gap: 0.5rem 1rem; }
  .item-end { width: 100%; padding-left: 2.1rem; }

  /* Hamburger menu replaces the nav row */
  .site-header .container { flex-wrap: wrap; }
  .nav-toggle-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    padding: 0.4rem;
    margin: -0.4rem;
    color: var(--ink);
  }
  .nav-toggle-label .icon { width: 1.4rem; height: 1.4rem; }
  .nav-toggle-label .icon-close { display: none; }
  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    overflow: visible;
    padding: 0.75rem 0 0.25rem;
  }
  .site-nav a {
    font-size: 1rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid var(--rule);
  }
  .site-nav a:last-child { border-bottom: none; }
  .nav-toggle:checked ~ .site-nav { display: flex; }
  .nav-toggle:checked ~ .nav-toggle-label .icon-menu { display: none; }
  .nav-toggle:checked ~ .nav-toggle-label .icon-close { display: inline-block; }

  .garden-toolbar { position: static; }
  details.category { scroll-margin-top: 1rem; }
}
