/* ============================================================
   Hareesh Gali — personal site
   Concept: "Instrumented" — a system under observation.
   Type: Instrument Serif (the human) × IBM Plex Mono (the machine)
   ============================================================ */

:root {
  --paper:      #f5f5f2;
  --paper-lift: #fbfbf9;
  --ink:        #14161a;
  --ink-soft:   #6b6e73;
  --ink-faint:  #9a9c9f;
  --line:       #dededa;
  --line-soft:  #e8e8e4;

  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --pad: clamp(1.5rem, 4vw, 3.25rem);
  --maxw: 1320px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

a { color: inherit; }

/* ---- ambient trace canvas ---------------------------------- */
.trace-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

/* subtle paper glow that lifts the text off the topology */
.veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(52% 40% at 50% 42%,
      rgba(245,245,242,0.88) 0%,
      rgba(245,245,242,0.55) 44%,
      rgba(245,245,242,0.0) 80%);
}

/* ---- shared shell ------------------------------------------ */
.shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  max-width: var(--maxw);
  margin: 0 auto;
}

/* ---- masthead ---------------------------------------------- */
.masthead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.masthead .role b {
  color: var(--ink);
  font-weight: 500;
}
.masthead .role span { color: var(--ink-faint); }

.mono-link {
  font-family: var(--mono);
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color 0.35s var(--ease), border-color 0.35s var(--ease);
  white-space: nowrap;
}
.mono-link:hover,
.mono-link:focus-visible { color: var(--ink); border-color: var(--ink); }
.mono-link .arrow {
  display: inline-block;
  transition: transform 0.35s var(--ease);
}
.mono-link:hover .arrow,
.mono-link:focus-visible .arrow { transform: translate(2px, -2px); }

/* ---- hero -------------------------------------------------- */
.hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: clamp(2rem, 8vh, 6rem) 0;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 clamp(1rem, 3vh, 1.75rem);
}

.name {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(4.2rem, 15vw, 13rem);
  line-height: 0.86;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}
.name em {
  font-style: italic;
  color: var(--ink);
}

.tagline {
  font-family: var(--mono);
  font-size: clamp(13px, 1.35vw, 15px);
  line-height: 1.65;
  letter-spacing: 0.005em;
  color: var(--ink-soft);
  max-width: 34ch;
  margin: clamp(1.75rem, 4vh, 2.5rem) auto 0;
}
.tagline b { color: var(--ink); font-weight: 500; }

/* ---- footer links ------------------------------------------ */
.foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  border-top: 1px solid var(--line);
  padding-top: 1.15rem;
  font-size: 12px;
  letter-spacing: 0.04em;
}
.foot .links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}
.foot .sig {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ============================================================
   Blog index
   ============================================================ */
.page-head {
  padding: clamp(3rem, 12vh, 7rem) 0 clamp(2rem, 6vh, 3.5rem);
  max-width: 44ch;
}
.page-head .eyebrow { text-align: left; }
.page-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.92;
  letter-spacing: -0.015em;
  margin: 0 0 1.25rem;
}
.page-head p {
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0;
}

.posts {
  flex: 1;
  border-top: 1px solid var(--line);
}

.empty {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: clamp(2.5rem, 8vh, 5rem) 0;
  margin: 0;
}

.post {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  gap: 1.5rem;
  align-items: baseline;
  padding: clamp(1.6rem, 3.5vh, 2.4rem) 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: padding-left 0.4s var(--ease);
}
.post:hover,
.post:focus-visible { padding-left: 0.75rem; outline: none; }

.post .idx {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  padding-top: 0.55em;
}

.post .body h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.02;
  letter-spacing: -0.01em;
  margin: 0 0 0.55rem;
  color: var(--ink);
  transition: color 0.35s var(--ease);
}
.post .body p {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0;
  max-width: 56ch;
}
.post .tags {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.85rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.post .meta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  text-align: right;
  white-space: nowrap;
  padding-top: 0.55em;
}
.post .meta .arrow {
  display: block;
  margin-top: 0.6rem;
  color: var(--ink-soft);
  transition: transform 0.4s var(--ease), color 0.35s var(--ease);
}
.post:hover .arrow,
.post:focus-visible .arrow { transform: translate(3px, -3px); color: var(--ink); }

.blog-foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1.75rem;
  padding-top: 1.5rem;
  font-size: 12px;
}

/* ---- responsive -------------------------------------------- */
@media (max-width: 620px) {
  .masthead { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
  .masthead .role span { display: block; }
  .post {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }
  .post .idx { padding-top: 0; }
  .post .meta { text-align: left; }
  .post .meta .arrow { display: inline; margin: 0 0 0 0.5rem; }
  .foot { gap: 1rem; }
}

/* ---- reduced motion & focus -------------------------------- */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
}

:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 3px;
}

/* ============================================================
   Article — long-form post page
   ============================================================ */
.article { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: clamp(2rem,7vh,4.5rem) 0 0; }
.article-head { margin-bottom: clamp(1.5rem,5vh,2.75rem); }
.article-head .eyebrow { text-align: left; margin: 0 0 1.1rem; }
.article-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.6rem, 7vw, 4.6rem); line-height: 0.98;
  letter-spacing: -0.015em; margin: 0; color: var(--ink);
}
.article-head .standfirst {
  font-family: var(--mono); font-size: 14px; line-height: 1.7;
  color: var(--ink-soft); margin: 1.4rem 0 0; max-width: 58ch;
}
.article-head .byline {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint); margin-top: 1.4rem;
}

.prose { font-family: var(--mono); font-size: 15px; line-height: 1.8; color: #26292e; }
.prose > p { margin: 0 0 1.5rem; }
.prose h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.5rem); line-height: 1.05;
  letter-spacing: -0.01em; color: var(--ink); margin: 3rem 0 1.2rem;
}
.prose strong { color: var(--ink); font-weight: 600; }
.prose em { font-style: italic; }
.prose a { color: var(--ink); border-bottom: 1px solid var(--line); text-decoration: none; }
.prose a:hover { border-color: var(--ink); }
.prose ul, .prose ol { margin: 0 0 1.5rem; padding-left: 1.35rem; }
.prose li { margin: 0 0 0.65rem; }
.prose code {
  font-family: var(--mono); font-size: 0.86em;
  background: #ecece8; padding: 0.1em 0.36em; border-radius: 3px;
}
.prose pre {
  background: #14161a; color: #e7e7e1; font-size: 12.5px; line-height: 1.55;
  padding: 1.05rem 1.2rem; border-radius: 8px; overflow-x: auto; margin: 0 0 1.5rem;
}
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose figure { margin: 2.25rem 0; }
.prose figure.lead { margin: 0 0 2.5rem; }
.prose figure img {
  display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line);
}
.prose figcaption {
  font-family: var(--mono); font-size: 12px; line-height: 1.55;
  color: var(--ink-faint); margin-top: 0.7rem; max-width: 60ch;
}
.article-foot {
  margin-top: clamp(3rem,8vh,5rem); padding-top: 1.4rem; border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
}
@media (max-width: 620px) { .prose pre { font-size: 11px; } }

/* ---- references footer ---- */
.refs { margin-top: clamp(2.5rem,7vh,4rem); padding-top: 1.4rem; border-top: 1px solid var(--line); }
.refs h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(1.4rem,3vw,1.9rem);
  line-height: 1.05; margin: 0 0 1.1rem; color: var(--ink); }
.refs ol { list-style: decimal; margin: 0; padding-left: 1.7rem;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--ink-soft); }
.refs li { margin: 0 0 .75rem; padding-left: .2rem; }
.refs .t { font-style: italic; color: var(--ink); }
.refs a { color: var(--ink-soft); border-bottom: 1px solid var(--line); text-decoration: none; word-break: break-word; }
.refs a:hover { color: var(--ink); border-color: var(--ink); }
