/* ------------------------------------------------------------------
   sauravdas.me — shared styles for the landing page and section pages.
   White ground, black type, dark green for emphasis, one serif, no italics.
   ------------------------------------------------------------------ */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --ink-2: #333333;
  --muted: #6b6b6b;
  --line: #e7e7e7;
  --line-strong: #c9c9c9;
  --green: #1f5c3a;
  --green-deep: #174630;
  --green-soft: #eef4ef;
  --tint: #f7f7f5;
  --font: "Source Serif 4", Georgia, "Times New Roman", serif;
  --radius: 12px;
  --nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--font);
  font-variation-settings: "opsz" 16;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--green); color: #fff; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; border-radius: 4px; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 14px; border-radius: 8px;
  font-size: 14px; text-decoration: none; transition: top 0.2s;
}
.skip:focus { top: 14px; }

.wrap { width: min(1040px, calc(100% - 48px)); margin: 0 auto; }
.narrow { width: min(720px, calc(100% - 48px)); margin: 0 auto; }
.small { font-size: 13px; letter-spacing: 0.02em; }
.green { color: var(--green); }

/* Nav ------------------------------------------------------------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.94);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; min-height: var(--nav-h); }
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; font-size: 19px; }
.wordmark .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); }
.nav-links { display: flex; align-items: center; justify-content: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-block; padding: 8px 10px; border-radius: 6px; text-decoration: none;
  font-size: 15px; color: var(--ink-2); transition: color 0.15s, background-color 0.15s;
}
.nav-links a:hover { color: var(--ink); background: var(--tint); }
.nav-links a[aria-current="page"] { color: var(--green); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  padding: 10px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; line-height: 1;
  border: 1px solid transparent; transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.btn-solid { background: var(--green); color: #fff; }
.btn-solid:hover { background: var(--green-deep); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: #fff; }
.btn-ghost:hover { border-color: var(--ink); }

/* Page heads --------------------------------------------------------- */
.page-head { padding: clamp(40px, 6vw, 72px) 0 clamp(24px, 4vw, 40px); }
.kicker { color: var(--green); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; margin: 0 0 10px; }
h1 { margin: 0 0 16px; font-weight: 500; font-size: clamp(34px, 4.8vw, 56px); line-height: 1.08; letter-spacing: -0.015em; font-variation-settings: "opsz" 56; text-wrap: balance; }
h2 { margin: 0; font-weight: 500; font-size: clamp(24px, 3vw, 34px); line-height: 1.15; letter-spacing: -0.012em; font-variation-settings: "opsz" 36; text-wrap: balance; }
.lede { margin: 0; max-width: 58ch; font-size: clamp(17px, 1.5vw, 19px); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.page-head .lede + .actions { margin-top: 22px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.section { padding: clamp(28px, 4vw, 48px) 0; }
.section + .section { border-top: 1px solid var(--line); }
.section-head { display: grid; grid-template-columns: 1fr auto; gap: 12px 32px; align-items: end; margin-bottom: 18px; }
.section-head .side { justify-self: end; white-space: nowrap; }
.section-sub { margin: 8px 0 0; max-width: 62ch; color: var(--ink-2); text-wrap: pretty; }
main { padding-bottom: clamp(48px, 7vw, 88px); }

/* Landing hero -------------------------------------------------------- */
.hero { padding: clamp(48px, 7vw, 88px) 0 clamp(28px, 4vw, 44px); }
.hero h1 { font-size: clamp(36px, 5vw, 60px); font-variation-settings: "opsz" 60; margin-bottom: 20px; }
.eyebrow { color: var(--green); font-weight: 600; margin-bottom: 18px; }
.status { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); margin-top: 22px; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }

/* Cards -------------------------------------------------------------- */
.card {
  position: relative; display: block; text-decoration: none; color: inherit; background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  transition: border-color 0.15s, transform 0.2s ease;
}
a.card:hover, .card.lift:hover { border-color: var(--green); transform: translateY(-2px); }
.card .go { position: absolute; top: 18px; right: 18px; color: var(--muted); transition: color 0.15s; }
a.card:hover .go, .card.lift:hover .go { color: var(--green); }
.card h3 { margin: 0 0 4px; font-size: 18px; font-weight: 600; line-height: 1.3; }
.card p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 14px; }
.meta .series { color: var(--green); font-weight: 600; }

/* Landing hub: one card per section of the site */
.hub { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.hub .card { min-height: 150px; display: grid; align-content: space-between; gap: 16px; }
.hub .card .label { color: var(--green); font-weight: 600; }
.hub .card h3 { font-size: 19px; font-weight: 500; }
.hub .card .count { color: var(--muted); font-size: 14px; }

/* "Right now" */
.now { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.now-head { padding: 12px 16px; border-bottom: 1px solid var(--line); color: var(--muted); background: var(--tint); }
.now a { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 14px 16px; text-decoration: none; transition: background-color 0.15s; }
.now a + a { border-top: 1px solid var(--line); }
.now a:hover { background: var(--tint); }
.now .k { display: block; color: var(--green); font-weight: 600; margin-bottom: 2px; }
.now .v { display: block; font-weight: 500; line-height: 1.35; }
.now .v small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; margin-top: 2px; }
.now .go { color: var(--muted); }
.now-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Products */
.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.product { min-height: 150px; display: grid; align-content: space-between; gap: 18px; }
.live { display: inline-flex; align-items: center; gap: 7px; color: var(--green); font-size: 14px; font-weight: 600; }
.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.product .domain { color: var(--muted); font-size: 14px; }

/* Writing */
.featured { display: grid; gap: 22px; padding: 26px; }
.featured .tag { color: var(--green); font-weight: 600; }
.featured h3 { margin: 10px 0 0; font-size: clamp(24px, 2.6vw, 32px); font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; font-variation-settings: "opsz" 32; text-wrap: balance; }
.featured p { margin: 12px 0 0; font-size: 16px; max-width: 60ch; text-wrap: pretty; }
.essays { display: grid; gap: 10px; }
.essay { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; padding: 16px 18px; }
.essay h3 { font-size: 17px; }
.essay h3 span { color: var(--muted); font-weight: 400; }
.essay p { font-size: 15px; margin-bottom: 6px; }
.essay .go { position: static; }
.series-head { display: flex; align-items: baseline; gap: 12px; margin: 0 0 10px; }
.series-head h2 { font-size: 22px; }
.series-head span { color: var(--muted); font-size: 14px; }

/* Experiments */
.experiments { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.experiment { display: grid; gap: 12px; align-content: start; }
.experiment h3 a { text-decoration: none; }
.experiment h3 a::after { content: ''; position: absolute; inset: 0; } /* whole card opens the repo */
.experiment h3 .go { position: static; font-size: 15px; margin-left: 6px; }
.experiment .foot { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: 14px; }
.experiment .foot a { color: var(--green); text-decoration: none; border-bottom: 1px solid transparent; }
.experiment .foot a:hover { border-bottom-color: currentColor; }

/* Apps */
.app { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; padding: 24px; }
.app-icon { width: 88px; height: 88px; border-radius: 22px; border: 1px solid var(--line); }
.app h3 { font-size: 26px; font-weight: 500; margin-bottom: 6px; font-variation-settings: "opsz" 28; }
.app p { margin-bottom: 14px; max-width: 54ch; text-wrap: pretty; }
.app .links { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 14px; text-decoration: none; }
.pill-green { background: var(--green-soft); color: var(--green); font-weight: 600; }
.pill-link { border: 1px solid var(--line-strong); color: var(--ink-2); transition: border-color 0.15s, color 0.15s; }
.pill-link:hover { border-color: var(--green); color: var(--green); }

/* About: plain prose, read like a letter */
.prose { font-size: 18.5px; line-height: 1.7; color: var(--ink-2); }
.prose p { margin: 0 0 1.25em; text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--green); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.prose a:hover { border-bottom-color: currentColor; }
.prose .lead { font-size: clamp(21px, 2.2vw, 25px); line-height: 1.4; color: var(--ink); }
.aside-card { padding: 22px; }
.aside-card h3 { margin-bottom: 8px; }
.aside-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.aside-card li a { text-decoration: none; color: var(--green); font-weight: 600; border-bottom: 1px solid transparent; }
.aside-card li a:hover { border-bottom-color: currentColor; }
.aside-card li span { display: block; color: var(--muted); font-size: 14px; }
.contact { display: grid; gap: 18px; padding: 24px; }
.contact h3 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 500; line-height: 1.15; font-variation-settings: "opsz" 28; text-wrap: balance; }
.socials { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.socials a { color: var(--green); text-decoration: none; font-weight: 600; font-size: 15px; border-bottom: 1px solid transparent; }
.socials a:hover { border-bottom-color: currentColor; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.two-col .stack { display: grid; gap: 12px; }

/* Books */
.empty { border: 1px dashed var(--line-strong); border-radius: 12px; padding: 28px; color: var(--ink-2); background: var(--tint); }
.empty a { color: var(--green); font-weight: 600; text-decoration: none; border-bottom: 1px solid transparent; }
.empty a:hover { border-bottom-color: currentColor; }
.book { padding: 32px 0; border-top: 1px solid var(--line); }
.book:first-of-type { border-top: 0; padding-top: 8px; }
.book-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.book h2 { margin: 0 0 4px; font-size: 26px; }
.book .by { margin: 0 0 14px; color: var(--green); font-weight: 600; font-size: 15px; }
.book p { margin: 0 0 14px; color: var(--ink-2); }
.book p:last-child { margin-bottom: 0; }
.book .verdict { display: inline-block; padding: 5px 11px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-weight: 600; font-size: 14px; margin-top: 4px; }

/* Footer -------------------------------------------------------------- */
footer { border-top: 1px solid var(--line); padding: 36px 0 40px; }
.sitemap { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; margin-bottom: 32px; }
.sitemap h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sitemap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.sitemap a { text-decoration: none; color: var(--ink-2); font-size: 15px; }
.sitemap a:hover { color: var(--green); }
.sitemap .blurb { color: var(--ink-2); font-size: 15px; max-width: 34ch; margin: 10px 0 0; }
.foot-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px 20px; color: var(--muted); font-size: 14px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.foot-links a { text-decoration: none; color: var(--ink-2); }
.foot-links a:hover { color: var(--green); }

.totop {
  position: fixed; right: 18px; bottom: 18px; z-index: 40; width: 42px; height: 42px; border-radius: 50%;
  background: var(--green); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.totop.show { opacity: 1; pointer-events: auto; }
.totop svg { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}

/* Responsive ----------------------------------------------------------- */
@media (max-width: 960px) {
  .hub { grid-template-columns: repeat(2, 1fr); }
  .two-col, .now-grid { grid-template-columns: 1fr; }
  .sitemap { grid-template-columns: 1fr 1fr 1fr; }
  .sitemap > div:first-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .nav-inner { grid-template-columns: 1fr auto; grid-template-rows: auto auto; padding: 8px 0 6px; min-height: 0; }
  .wordmark { grid-column: 1; grid-row: 1; }
  .btn-nav { grid-column: 2; grid-row: 1; justify-self: end; padding: 8px 13px; font-size: 14px; }
  .nav-links { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin: 4px -24px 0; padding: 0 24px; -webkit-overflow-scrolling: touch; }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { white-space: nowrap; font-size: 14.5px; padding: 6px 10px; }
  .section-head { grid-template-columns: 1fr; }
  .section-head .side { justify-self: start; }
  .app { grid-template-columns: 1fr; }
  .sitemap { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .wrap, .narrow { width: calc(100% - 32px); }
  .nav-links { margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .hub { grid-template-columns: 1fr; }
  .hub .card { min-height: 0; }
  .sitemap { grid-template-columns: 1fr; }
}
