/* ============================================================
   raosiddharth.com — shared design tokens
   Scan layer: plain, IBM Plex Sans, no texture
   Writing layer: typewriter (Courier Prime) + script accent (Caveat), paper texture
   ============================================================ */

@font-face {
  font-family: 'IBM Plex Sans';
  src: url('fonts/IBMPlexSans.ttf') format('truetype');
  font-weight: 100 800;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/CourierPrime.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Courier Prime';
  src: url('fonts/CourierPrimeBold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'Caveat';
  src: url('fonts/Caveat.ttf') format('truetype');
  font-weight: 400 700;
  font-display: swap;
}

:root {
  /* ---- palette ---- */
  --paper:      #FAF8F3;   /* ground */
  --ink:        #1C1A17;   /* primary text / scan layer surfaces */
  --ink-soft:   #5C5650;   /* secondary text */
  --stamp:      #8C3D2E;   /* accent — used sparingly, like a stamp */
  --rule:       #DDD6CB;   /* hairline borders */
  --paper-deep: #F2EEE4;   /* slightly deeper paper for cards/sections */

  /* ---- type ---- */
  --f-scan:  'IBM Plex Sans', -apple-system, sans-serif;
  --f-type:  'Courier Prime', 'Courier New', monospace;
  --f-script:'Caveat', cursive;

  /* ---- layout ---- */
  --container: 1120px;
  --pad-x: clamp(24px, 5vw, 64px);
  --section-y: clamp(56px, 8vw, 104px);
  --radius: 2px; /* near-zero — paper/ink doesn't have soft UI corners */
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-scan);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

/* ============================================================
   NAV — scan layer, sitewide
   ============================================================ */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--pad-x);
  border-bottom: 1px solid var(--rule);
}
.site-nav .wordmark {
  font-family: var(--f-scan);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.site-nav .wordmark .rao { color: var(--stamp); }
.site-nav .navlinks {
  display: flex;
  gap: 32px;
  list-style: none;
}
.site-nav .navlinks a {
  font-size: 13.5px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  transition: color 0.15s ease;
}
.site-nav .navlinks a:hover,
.site-nav .navlinks a.active { color: var(--ink); }
.site-nav .navlinks a.active { font-weight: 600; }
.nav-toggle { display: none; }

@media (max-width: 680px) {
  .site-nav { padding: 18px 20px; }
  .navlinks { gap: 18px; }
  .navlinks a { font-size: 12.5px; }
}

/* ============================================================
   FOOTER — sitewide
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 40px var(--pad-x) 48px;
  margin-top: var(--section-y);
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.footer-nav {
  display: flex;
  gap: 24px;
  list-style: none;
  flex-wrap: wrap;
}
.footer-nav a {
  font-family: var(--f-scan);
  font-size: 12.5px;
  color: var(--ink-soft);
  transition: color 0.15s ease;
}
.footer-nav a:hover, .footer-nav a.active { color: var(--stamp); }
.footer-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  max-width: var(--container);
  margin: 0 auto 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.footer-wordmark {
  font-family: var(--f-scan);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.footer-wordmark .rao { color: var(--stamp); }
.footer-copy {
  font-size: 12px;
  color: var(--ink-soft);
}
.footer-social {
  display: flex;
  align-items: center;
  gap: 18px;
}
.footer-social a {
  color: var(--ink-soft);
  opacity: 0.75;
  transition: opacity 0.15s ease, color 0.15s ease;
  display: flex;
}
.footer-social a:hover { opacity: 1; color: var(--stamp); }
.footer-social svg { width: 17px; height: 17px; display: block; }

/* ============================================================
   SCAN LAYER — plain, spec-sheet, no texture
   ============================================================ */
.kicker {
  font-family: var(--f-scan);
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.section-label {
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--stamp);
}
h1.scan-h1 {
  font-family: var(--f-scan);
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
}
h2.scan-h2 {
  font-family: var(--f-scan);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
}
p.scan-sub {
  font-family: var(--f-scan);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 560px;
}

.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  font-family: var(--f-scan);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  padding: 5px 11px;
}

.btn {
  display: inline-block;
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  color: var(--ink);
  transition: background 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-fill {
  background: var(--ink);
  color: var(--paper);
}
.btn-fill:hover { background: var(--stamp); border-color: var(--stamp); }
.btn-stamp { border-color: var(--stamp); color: var(--stamp); }
.btn-stamp:hover { background: var(--stamp); color: var(--paper); }

.status-line {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-scan);
  font-size: 12.5px;
  color: var(--ink-soft);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--stamp);
  flex-shrink: 0;
}

/* stats bar */
.stats-band {
  background: var(--ink);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stats-band .stat {
  min-width: 0;
  padding: 32px clamp(16px, 3vw, 32px);
  border-right: 1px solid rgba(250,248,243,0.1);
}
.stats-band .stat:last-child { border-right: none; }
.stats-band .num {
  font-family: var(--f-scan);
  font-weight: 700;
  font-size: clamp(1.6rem, 2.6vw, 2.1rem);
  color: var(--paper);
}
.stats-band .num .plus { color: #b06650; }
.stats-band .lbl {
  font-family: var(--f-scan);
  font-size: 12px;
  color: rgba(250,248,243,0.55);
  margin-top: 6px;
  line-height: 1.4;
}
@media (max-width: 760px) {
  .stats-band { grid-template-columns: repeat(2, 1fr); }
  .stats-band .stat:nth-child(2) { border-right: none; }
}

/* project / article rows (Economist-list style, scan layer) */
.row-list a.row {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  gap: 24px;
  align-items: start;
  padding: 22px 0;
  border-top: 1px solid var(--rule);
  transition: background 0.15s ease;
}
.row-list a.row:last-child { border-bottom: 1px solid var(--rule); }
.row-list a.row:hover { background: var(--paper-deep); }
.row-cat {
  font-family: var(--f-scan);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stamp);
  padding-top: 3px;
}
.row-title {
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 5px;
}
.row-excerpt {
  font-family: var(--f-scan);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.row-arrow { color: var(--rule); font-size: 18px; padding-top: 2px; }
.row-list a.row:hover .row-arrow { color: var(--stamp); }
@media (max-width: 640px) {
  .row-list a.row { grid-template-columns: 1fr; gap: 8px; }
  .row-arrow { display: none; }
}

/* card grid (blueprint 12-grid, etc) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.card-grid a.card {
  background: var(--paper);
  padding: 26px 24px;
  transition: background 0.15s ease;
}
.card-grid a.card:hover { background: var(--paper-deep); }
.card-cat {
  font-family: var(--f-scan);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 10px;
}
.card-title {
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.32;
}
.card-desc {
  font-family: var(--f-scan);
  font-size: 12.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.card-stack {
  margin-top: 12px;
  font-family: var(--f-type);
  font-size: 10.5px;
  color: var(--ink-soft);
}
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   WRITING LAYER — Construct articles, About full voice
   typewriter body/headlines, script quotes/signature, paper texture
   ============================================================ */
.writing-layer {
  background-image: url('img/paper_subtle.png');
  background-size: cover;
  background-attachment: local;
  position: relative;
}
.writing-layer .ring {
  position: absolute;
  pointer-events: none;
  z-index: 0;
  opacity: 0.85;
}
.writing-inner {
  position: relative;
  z-index: 1;
  max-width: 680px;
  margin: 0 auto;
  padding: var(--section-y) var(--pad-x);
}
.byline-script {
  font-family: var(--f-script);
  font-weight: 600;
  font-size: 22px;
  color: var(--stamp);
  display: inline-block;
  margin-bottom: 6px;
}
.w-cat {
  font-family: var(--f-type);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 14px;
}
h1.w-title, h2.w-title {
  font-family: var(--f-type);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  line-height: 1.32;
  color: var(--ink);
  margin-bottom: 18px;
  letter-spacing: -0.005em;
}
.w-meta {
  font-family: var(--f-type);
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 32px;
}
.w-body {
  font-family: var(--f-type);
  font-size: 15.5px;
  line-height: 1.85;
  color: #29251f;
}
.w-body p { margin-bottom: 16px; }
.w-body p.opener { font-weight: 700; }
.w-pullquote {
  font-family: var(--f-script);
  font-weight: 600;
  font-size: 28px;
  color: var(--stamp);
  line-height: 1.32;
  margin: 28px 0 28px 6px;
  border-left: 2px solid #c9a98f;
  padding-left: 18px;
}
.w-sig {
  margin-top: 32px;
  font-family: var(--f-script);
  font-weight: 600;
  font-size: 22px;
  color: var(--stamp);
}
.w-divider {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 36px 0;
}
.w-callout {
  background: rgba(140,61,46,0.05);
  border-left: 2px solid var(--stamp);
  padding: 16px 20px;
  margin: 24px 0;
  font-family: var(--f-type);
  font-size: 14px;
  line-height: 1.7;
  color: #29251f;
}
.w-callout a { color: var(--stamp); font-weight: 700; }
.w-callout a:hover { text-decoration: underline; }

/* category tabs on Construct */
.cat-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.cat-tabs button {
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.01em;
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.15s ease;
}
.cat-tabs button.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.cat-tabs button:hover:not(.active) {
  border-color: var(--ink);
  color: var(--ink);
}
.discovery-line {
  font-family: var(--f-type);
  font-size: 13px;
  color: var(--ink-soft);
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 4px;
}
.discovery-line a { color: var(--stamp); font-weight: 700; }
.discovery-line a:hover { text-decoration: underline; }

/* premium substack card */
.premium-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0;
  background: var(--paper);
  border: 1px solid var(--rule);
  margin-bottom: 28px;
  transition: border-color 0.2s ease;
}
.premium-card:hover { border-color: var(--stamp); }
.premium-card .pc-thumb {
  background: var(--paper-deep);
  border-right: 1px solid var(--rule);
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
}
.premium-card .pc-thumb img { width: 100%; display: block; }
.premium-card .pc-body { padding: 20px 22px; }
.premium-card .pc-label {
  font-family: var(--f-type);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 8px;
}
.premium-card .pc-title {
  font-family: var(--f-scan);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  line-height: 1.3;
  margin-bottom: 8px;
}
.premium-card .pc-excerpt {
  font-family: var(--f-scan);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 10px;
}
.premium-card .pc-cta {
  font-family: var(--f-scan);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--stamp);
}
@media (max-width: 560px) {
  .premium-card { grid-template-columns: 1fr; }
  .premium-card .pc-thumb { border-right: none; border-bottom: 1px solid var(--rule); aspect-ratio: 400/200; }
}

.construct-list { display: flex; flex-direction: column; }
.construct-card {
  display: block;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  cursor: pointer;
}
.construct-card:first-child { border-top: none; }
.construct-card .ccat {
  font-family: var(--f-type);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 6px;
}
.construct-card .ctitle {
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 6px;
  line-height: 1.3;
}
.construct-card .cdeck {
  font-family: var(--f-scan);
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.construct-card .cmeta {
  font-family: var(--f-scan);
  font-size: 11.5px;
  color: var(--ink-soft);
  margin-top: 8px;
  opacity: 0.8;
}

/* carousel */
.carousel-outer {
  position: relative;
}
.carousel-track-wrap {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carousel-track-wrap::-webkit-scrollbar { display: none; }
.carousel-track {
  display: flex;
  gap: 20px;
}
.carousel-card {
  scroll-snap-align: start;
  flex: 0 0 320px;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.carousel-card:hover {
  border-color: var(--stamp);
  transform: translateY(-2px);
}
.carousel-card .thumb {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-deep);
  aspect-ratio: 400/280;
}
.carousel-card .thumb img { width: 100%; height: 100%; display: block; object-fit: contain; }
.carousel-card .card-body { padding: 18px 20px 20px; flex: 1; display: flex; flex-direction: column; }
.carousel-nav {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
.carousel-nav button {
  width: 36px; height: 36px;
  border: 1px solid var(--rule);
  background: var(--paper);
  cursor: pointer;
  font-family: var(--f-scan);
  font-size: 16px;
  color: var(--ink);
  transition: all 0.15s ease;
}
.carousel-nav button:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* next-article card */
.next-article {
  display: block;
  margin-top: 48px;
  padding: 24px 26px;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--stamp);
  position: relative;
  z-index: 1;
  transition: background 0.15s ease;
}
.next-article:hover { background: #efe9dc; }
.next-article .na-label {
  font-family: var(--f-type);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stamp);
  margin-bottom: 8px;
}
.next-article .na-title {
  font-family: var(--f-scan);
  font-weight: 600;
  font-size: 16.5px;
  color: var(--ink);
  line-height: 1.35;
}
.next-article .na-arrow {
  font-family: var(--f-scan);
  color: var(--stamp);
  margin-left: 6px;
}

/* accessibility: focus states */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--stamp);
  outline-offset: 2px;
}

/* fade-up animation */
.fade-up {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.fade-up.visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}
