/* ==========================================================================
   tirthap.com: quiet editorial
   Tokens live here. Change the palette and type here, not in templates.
   ========================================================================== */

@font-face {
  font-family: 'Newsreader';
  src: url('/static/fonts/newsreader-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Inter';
  src: url('/static/fonts/inter-latin.woff2') format('woff2');
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  --paper: #f7f3ec;
  --paper-2: #f1ebe0;
  --ink: #1b1a17;
  --muted: #6e685e;
  --rule: #dcd4c7;
  --accent: #8a3b2e;
  --accent-ink: #ffffff;

  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', 'JetBrains Mono', Menlo, Consolas, monospace;

  --page: 1180px;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 66ch;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #151412;
  --paper-2: #1c1a17;
  --ink: #f1ece2;
  --muted: #a49c8f;
  --rule: #332f29;
  --accent: #d08a75;
  --accent-ink: #151412;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --paper: #151412;
    --paper-2: #1c1a17;
    --ink: #f1ece2;
    --muted: #a49c8f;
    --rule: #332f29;
    --accent: #d08a75;
    --accent-ink: #151412;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main { flex: 1 0 auto; }

h1, h2, h3, p, ul, ol, blockquote, figure { margin: 0; }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

a:hover { color: var(--accent); text-decoration-color: var(--accent); }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: var(--gutter);
  z-index: 20;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: none;
  transition: top 0.2s var(--ease);
}

.skip-link:focus { top: 1rem; color: var(--paper); }

.wrap {
  width: min(calc(100% - 2 * var(--gutter)), var(--page));
  margin-inline: auto;
}

/* --------------------------------------------------------------------------
   Header / footer
   -------------------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--rule);
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.35rem;
  line-height: 1;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  margin-left: auto;
}

.site-nav a,
.theme-toggle {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover { color: var(--ink); }

.theme-toggle {
  padding: 0.38rem 0.55rem;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.theme-toggle:hover { border-color: var(--ink); color: var(--ink); }

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1rem 2rem;
  padding: 2rem 0 3.5rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.04em;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .colophon { margin-left: auto; }

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.hero {
  padding: clamp(3rem, 8vw, 7rem) 0 clamp(2.5rem, 5vw, 4.5rem);
}

.kicker,
.label {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.kicker { margin-bottom: 1.5rem; }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(16rem, 0.65fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: end;
}

.hero h1 {
  font-size: clamp(2.75rem, 10.2vw, 8rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
  white-space: nowrap;
}

.hero-aside { padding-bottom: 0.55rem; }

.lede {
  max-width: 24ch;
  margin-bottom: 1.75rem;
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.2vw, 1.85rem);
  line-height: 1.25;
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  padding: 0;
  list-style: none;
}

.hero-links a {
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--accent);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.hero-links a:hover { color: var(--accent); }

.section {
  padding: clamp(2.75rem, 6vw, 6rem) 0;
  border-top: 1px solid var(--rule);
}

.section-grid {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 4rem);
}

.prose {
  max-width: var(--measure);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.prose p + p { margin-top: 1.1em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.prose h2,
.prose h3 {
  margin: 2rem 0 0.75rem;
}

.prose h2 { font-size: 1.75rem; }
.prose h3 { font-size: 1.35rem; }

.prose ul,
.prose ol {
  padding-left: 1.2em;
  margin: 1em 0;
}

.prose li + li { margin-top: 0.35em; }

.prose code {
  padding: 0.1em 0.3em;
  border-radius: 2px;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 0.9em;
}

.prose pre {
  overflow: auto;
  padding: 1rem;
  border: 1px solid var(--rule);
  background: var(--paper-2);
  font-size: 0.875rem;
  line-height: 1.6;
}

.prose pre code { padding: 0; background: none; }

.prose blockquote {
  margin: 1.5rem 0;
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.15rem;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0;
}

.prose figure { margin: 2rem 0; }

.prose figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.prose hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.prose th,
.prose td {
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.work {
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.work li {
  display: grid;
  grid-template-columns: 10rem minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--rule);
  transition: background-color 0.2s var(--ease);
}

.work li:hover { background: var(--paper-2); }

.work .org {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1.25;
}

.work .role { color: var(--muted); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem 2rem;
  padding: 0;
  list-style: none;
}

.links a {
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.15rem;
}

.links a:hover { border-color: var(--accent); }

/* --------------------------------------------------------------------------
   Credits / 404
   -------------------------------------------------------------------------- */

.page-head {
  padding: clamp(3.5rem, 8vw, 6rem) 0 2rem;
}

.page-head h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }

.page-head .subtitle {
  margin-top: 0.75rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.25rem;
}

.credits-list {
  display: grid;
  gap: 2.25rem;
  max-width: var(--measure);
  padding-bottom: clamp(3rem, 7vw, 6rem);
}

.credits-list h2 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}

.credits-list p { color: var(--muted); }

.notfound {
  display: flex;
  min-height: 62vh;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: 4rem 0;
}

.notfound h1 {
  font-size: clamp(3.5rem, 10vw, 7rem);
  line-height: 0.95;
}

.notfound p {
  max-width: 38ch;
  margin: 1.25rem 0 1.75rem;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 1.35rem;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

/* Content is visible by default; JS only marks below-fold sections as pending.
   If JS fails or is disabled, nothing is hidden. */
.reveal {
  opacity: 1;
  transform: none;
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.reveal.reveal-pending {
  opacity: 0;
  transform: translateY(10px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media print {
  .reveal { opacity: 1 !important; transform: none !important; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 2rem; }
  .hero-aside { padding-bottom: 0; }
}

@media (max-width: 800px) {
  .section-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .work li { grid-template-columns: 1fr; gap: 0.25rem; }
  .site-footer .colophon { margin-left: 0; }
}

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; gap: 0.75rem 1rem; padding: 1rem 0; }
  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .theme-toggle { margin-left: auto; }
  .lede { max-width: 32ch; }
}
