/* Aravind Sankar: site styles.
   Layout idea: a left-aligned editorial column on a 72rem wrap. The only color is one
   blue line, borrowed from the line painted along a marathon course. */
:root {
  --paper: #F4F5F2;
  --surface: #FFFFFF;
  --ink: #131716;
  --muted: #5C6662;
  --rule: #D8DCD6;
  --line: #2447F9;
  --line-soft: #E3E8FE;
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Newsreader", "Iowan Old Style", Georgia, serif;
  --wrap: 72rem;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0F1312;
    --surface: #171C1B;
    --ink: #ECEFEA;
    --muted: #9AA4A0;
    --rule: #2A3230;
    --line: #8EA1FF;
    --line-soft: #1C2444;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0F1312;
  --surface: #171C1B;
  --ink: #ECEFEA;
  --muted: #9AA4A0;
  --rule: #2A3230;
  --line: #8EA1FF;
  --line-soft: #1C2444;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--line); text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
a:hover { color: var(--line); }
:focus-visible { outline: 3px solid var(--line); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3, h4 { font-family: var(--font-display); font-stretch: 108%; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; text-wrap: balance; margin: 0; }
p { margin: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.skip { position: absolute; left: -999rem; top: 0; background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; font-family: var(--font-display); z-index: 30; }
.skip:focus { left: 0; }

/* Reading progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 20; pointer-events: none; }
.progress span { display: block; height: 100%; width: 0; background: var(--line); }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 2rem; padding-block: 1.1rem; }
.brand { display: inline-flex; align-items: center; gap: 0.7rem; text-decoration: none; font-family: var(--font-display); font-weight: 650; font-stretch: 108%; letter-spacing: -0.01em; }
.brand:hover { color: var(--ink); }
.brand__mark { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; background: var(--line); color: #fff; font-size: 0.8rem; font-weight: 750; letter-spacing: 0.02em; border-radius: 50%; }
:root[data-theme="dark"] .brand__mark { color: #0F1312; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand__mark { color: #0F1312; } }
.nav { list-style: none; display: flex; flex-wrap: wrap; gap: 0.3rem 1.6rem; margin: 0; padding: 0; font-family: var(--font-display); font-size: 0.95rem; font-weight: 500; }
.nav a { text-decoration: none; padding-block: 0.3rem; border-bottom: 2px solid transparent; }
.nav a:hover { color: var(--ink); border-bottom-color: var(--rule); }
.nav a[aria-current="page"] { border-bottom-color: var(--line); }

/* Hero */
.hero { padding-block: clamp(3rem, 8vw, 6.5rem) clamp(2.5rem, 5vw, 4rem); }
.hero__title { font-size: clamp(2.6rem, 1rem + 6.6vw, 6.25rem); font-stretch: 114%; font-weight: 700; letter-spacing: -0.035em; line-height: 0.98; max-width: 15ch; }
.hero__intro { display: flex; gap: 1.4rem; align-items: flex-start; margin-top: clamp(1.8rem, 4vw, 3rem); max-width: 46rem; }
.hero__avatar { width: 88px; height: 88px; border-radius: 50%; flex: none; object-fit: cover; }
.hero__lede { font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem); line-height: 1.45; }
.hero__facts { margin-top: 0.8rem; font-family: var(--font-display); font-size: 0.95rem; color: var(--muted); line-height: 1.5; }

/* Section furniture */
.section-title { font-size: 1.05rem; font-weight: 650; letter-spacing: 0; }
.block { padding-block: clamp(2.5rem, 5vw, 4rem); }
.block__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.4rem 1.5rem; margin-bottom: 1.2rem; }
.block__more { font-family: var(--font-display); font-size: 0.95rem; font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; gap: 0.2rem 1.4rem; font-family: var(--font-display); font-size: 0.92rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.btn { display: inline-block; font-family: var(--font-display); font-size: 0.98rem; font-weight: 600; text-decoration: none; background: var(--ink); color: var(--paper); padding: 0.75rem 1.3rem; border-radius: 999px; }
.btn:hover { background: var(--line); color: #fff; }

/* The route so far */
.route { padding-block: 1rem clamp(2.5rem, 5vw, 4rem); }
.route__line { list-style: none; margin: 2rem 0 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
.route__stop { position: relative; border-top: 2px solid var(--line); padding: 1.1rem 1rem 0 0; display: flex; flex-direction: column; gap: 0.25rem; }
.route__stop::before { content: ""; position: absolute; top: -7px; left: 0; width: 12px; height: 12px; border-radius: 50%; background: var(--paper); border: 2px solid var(--line); }
.route__stop--drive { border-top-style: dashed; }
.route__stop--now { border-top-color: transparent; }
.route__stop--now::before { background: var(--line); box-shadow: 0 0 0 5px var(--line-soft); }
.route__place { font-family: var(--font-display); font-weight: 650; font-size: 0.98rem; line-height: 1.25; }
.route__note { font-size: 0.95rem; line-height: 1.35; color: var(--muted); }
@media (max-width: 860px) {
  .route__line { grid-auto-flow: row; margin-left: 6px; }
  .route__stop { border-top: 0; border-left: 2px solid var(--line); padding: 0 0 1.3rem 1.4rem; }
  .route__stop::before { top: 0.25rem; left: -7px; }
  .route__stop--drive { border-left-style: dashed; }
  .route__stop--now { border-left-color: transparent; padding-bottom: 0; }
}

/* Latest post */
.feature { padding-block: clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); display: grid; gap: 1.1rem; justify-items: start; }
.feature__label { font-family: var(--font-display); font-size: 0.95rem; font-weight: 600; color: var(--line); }
.feature__title { font-size: clamp(2rem, 1rem + 3.6vw, 3.75rem); letter-spacing: -0.03em; line-height: 1.02; max-width: 20ch; }
.feature__title a { text-decoration: none; }
.feature__excerpt { font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem); line-height: 1.5; max-width: 60ch; }

/* Post rows */
.rows { border-bottom: 1px solid var(--rule); }
.row { display: grid; grid-template-columns: 8rem minmax(0, 1fr) 9.5rem; gap: 0.4rem 2rem; align-items: baseline; padding-block: 1.5rem; border-top: 1px solid var(--rule); }
.row__date { font-family: var(--font-display); font-size: 0.92rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.row__title { font-size: clamp(1.25rem, 1rem + 0.9vw, 1.6rem); line-height: 1.15; }
.row__title a { text-decoration: none; }
.row__excerpt { margin-top: 0.5rem; color: var(--muted); max-width: 62ch; line-height: 1.5; }
.row__meta { display: flex; flex-direction: column; gap: 0.1rem; font-family: var(--font-display); font-size: 0.92rem; color: var(--muted); text-align: right; }
@media (max-width: 760px) {
  .row { grid-template-columns: minmax(0, 1fr); }
  .row__meta { flex-direction: row; gap: 1.2rem; text-align: left; }
}

/* Topic filter */
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }
.chip { font: inherit; font-family: var(--font-display); font-size: 0.92rem; font-weight: 550; color: var(--ink); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 0.45rem 1rem; cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.empty { padding-block: 1.5rem; color: var(--muted); }

/* Projects and race log */
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3rem clamp(2rem, 5vw, 5rem); align-items: start; }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); } }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 2.5rem; }
.project { display: grid; gap: 0.5rem; text-decoration: none; }
.project img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 0.5rem; background: var(--surface); }
.project__title { font-family: var(--font-display); font-stretch: 108%; font-weight: 650; font-size: 1.3rem; letter-spacing: -0.02em; line-height: 1.15; }
.project__excerpt { color: var(--muted); line-height: 1.5; }
.project:hover { color: inherit; }
.project:hover .project__title { color: var(--line); }
.table-scroll { overflow-x: auto; }
.races { width: 100%; min-width: 26rem; border-collapse: collapse; font-size: 1rem; }
.races th { font-family: var(--font-display); font-size: 0.85rem; font-weight: 550; color: var(--muted); text-align: left; padding: 0 1rem 0.6rem 0; border-bottom: 1px solid var(--ink); }
.races td { padding: 0.9rem 1rem 0.9rem 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.races td:last-child, .races th:last-child { padding-right: 0; color: var(--muted); }
.races .num { font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.races__time { font-weight: 700; font-size: 1.15rem; }

/* Pages and posts */
.page { padding-block: clamp(2.5rem, 6vw, 5rem); }
.page__head { margin-bottom: 2rem; }
.page__title, .article__title { font-size: clamp(2.2rem, 1rem + 4.4vw, 4.25rem); font-stretch: 112%; font-weight: 700; letter-spacing: -0.03em; line-height: 1; max-width: 20ch; }
.page__head .prose { margin-top: 1.2rem; }
.page__back { margin-top: 2rem; font-family: var(--font-display); font-size: 0.95rem; font-weight: 500; }
.article { padding-block: clamp(2.5rem, 6vw, 5rem); }
.article__head { display: grid; gap: 1.3rem; padding-bottom: 2rem; margin-bottom: 2.5rem; border-bottom: 1px solid var(--rule); }
.article__portrait { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; }

.prose { max-width: 66ch; font-size: 1.1875rem; line-height: 1.68; }
.prose > * + * { margin-top: 1.25em; }
.prose h2 { font-size: 1.7rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.25rem; letter-spacing: -0.01em; margin-top: 1.9em; }
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose ul, .prose ol { padding-left: 1.3em; margin-bottom: 0; }
.prose li + li { margin-top: 0.45em; }
.prose li::marker { color: var(--line); font-family: var(--font-display); font-weight: 600; }
.prose strong { font-weight: 600; }
.prose blockquote { margin-inline: 0; padding-left: 1.4rem; border-left: 2px solid var(--line); font-size: 1.3rem; line-height: 1.5; font-style: italic; }
.prose img { border: 1px solid var(--rule); border-radius: 6px; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 1rem; line-height: 1.45; }
.prose th { font-family: var(--font-display); font-size: 0.88rem; font-weight: 600; text-align: left; border-bottom: 1px solid var(--ink); padding: 0.5rem 1.2rem 0.5rem 0; white-space: nowrap; }
.prose td { border-bottom: 1px solid var(--rule); padding: 0.7rem 1.2rem 0.7rem 0; vertical-align: top; min-width: 9rem; }
.prose code { font-size: 0.9em; background: var(--line-soft); padding: 0.1em 0.35em; border-radius: 4px; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin-block: 2.5em; }
.prose .btn, .prose .btn--primary { color: var(--paper); }
.prose .btn:hover { color: #fff; }

/* Resume blocks: a role heading followed by a dates line */
.prose h3 + p > em:only-child { font-family: var(--font-display); font-style: normal; font-size: 0.95rem; color: var(--muted); }

.pager { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 3rem; margin-top: 4rem; padding-top: 1.8rem; border-top: 1px solid var(--rule); }
.pager__link { display: grid; gap: 0.3rem; text-decoration: none; align-content: start; }
.pager__link--next { grid-column: 2; text-align: right; }
.pager__dir { font-family: var(--font-display); font-size: 0.9rem; color: var(--muted); }
.pager__title { font-family: var(--font-display); font-stretch: 108%; font-weight: 650; font-size: 1.15rem; letter-spacing: -0.015em; line-height: 1.2; }
@media (max-width: 620px) {
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager__link--next { grid-column: 1; text-align: left; }
}

/* Footer */
.site-footer { margin-top: clamp(2rem, 5vw, 4rem); border-top: 2px solid var(--line); }
.site-footer__inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem 3rem; padding-block: 2.5rem 3rem; font-family: var(--font-display); font-size: 0.98rem; }
.site-footer__title { font-stretch: 112%; font-weight: 700; font-size: clamp(1.6rem, 1rem + 2vw, 2.4rem); letter-spacing: -0.03em; line-height: 1.05; margin-bottom: 0.5rem; }
.site-footer__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; align-self: end; }
.site-footer__small { grid-column: 1 / -1; color: var(--muted); font-size: 0.88rem; }
.site-footer a { overflow-wrap: anywhere; }
@media (max-width: 620px) { .site-footer__inner { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
