:root {
  --background: #fff;
  --text: #181818;
  --muted: #747474;
  --link: #2457a7;
  --line: #d7d7d2;
  --serif: Georgia, "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 18px/1.62 var(--serif);
  text-rendering: optimizeLegibility;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}

a:hover { text-decoration-thickness: 2px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
button, iframe { font-family: var(--sans); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-180%);
  padding: .45rem .7rem;
  background: var(--text);
  color: #fff;
  font: .8rem var(--sans);
}

.skip-link:focus { transform: translateY(0); }

.site-shell, .site-header, .site-footer {
  width: min(100% - 3rem, 800px);
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 2.6rem 0 1.45rem;
  border-bottom: 1px solid var(--line);
}

.site-name {
  color: var(--text);
  font: 400 clamp(1.9rem, 5vw, 2.5rem)/1.1 var(--serif);
  letter-spacing: -.025em;
  text-decoration: none;
}

.site-nav { display: flex; gap: 1.35rem; font: .96rem var(--sans); }
.site-nav a { color: var(--text); text-decoration: none; }
.site-nav a:hover { color: var(--link); text-decoration: underline; }
.intro { padding: 2.2rem 0 4rem; }
h1, h2, h3, p { margin-top: 0; }

.bio {
  max-width: 730px;
  font-size: clamp(1.14rem, 2.7vw, 1.34rem);
  line-height: 1.62;
  letter-spacing: -.008em;
}

.bio p { margin-bottom: 1.15rem; }
.bio p:last-child { margin-bottom: 0; }

.home-section {
  padding: 2.7rem 0 4.4rem;
  border-top: 1px solid var(--line);
}

.home-section > h2, .page-heading h1 {
  margin-bottom: 2rem;
  font: 400 1.58rem/1.3 var(--serif);
}

.newsletter-list { max-width: 760px; }
.newsletter-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: start; }
.newsletter-entry + .newsletter-entry { margin-top: 2.1rem; }
.newsletter-entry h3 { margin-bottom: .28rem; font: 400 1.18rem var(--serif); }
.newsletter-entry p { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: .98rem; }

.subscribe-button {
  min-width: 6.7rem;
  margin-top: .1rem;
  padding: .5rem .85rem;
  border: 1px solid var(--text);
  border-radius: 3px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: .91rem;
}

.subscribe-button:hover { background: var(--text); color: #fff; }
.subscribe-popover {
  width: min(92vw, 520px);
  margin: auto;
  padding: 2.2rem 1rem 1rem;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 18px 60px rgb(0 0 0 / 28%);
}

.subscribe-popover::backdrop { background: rgb(0 0 0 / 68%); }
.subscribe-popover iframe { display: block; border: 0; }
.dialog-close {
  position: absolute;
  top: .45rem;
  right: .65rem;
  padding: .1rem .35rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.65rem;
  line-height: 1;
}

.work-list { margin: 0; padding: 0; list-style: none; }
.work-list li + li { margin-top: 1.75rem; }
.work-entry { width: 100%; }
.work-heading-line { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .7rem; row-gap: .15rem; }
.work-title { color: var(--link); font: 1.28rem/1.4 var(--serif); text-decoration: none; }
.work-title:hover { text-decoration: underline; }
.work-credit { color: var(--muted); font: 1.02rem/1.4 var(--sans); }
.work-credit em { font-style: italic; }
.work-summary { max-width: 710px; margin: .28rem 0 0; color: var(--muted); font-size: .98rem; line-height: 1.5; }
.see-all { margin: 2.5rem 0 0; font: .94rem var(--sans); }
.contact-list { margin: 0; }
.contact-list div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1rem; }
.contact-list div + div { margin-top: .55rem; }
.contact-list dt { color: var(--muted); font: .94rem var(--sans); }
.contact-list dd { margin: 0; }
.page-heading { padding: 2.8rem 0 2.1rem; }
.page-heading h1 { margin-bottom: 0; font-size: 2.15rem; letter-spacing: -.025em; }

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem 0;
  margin: 0 0 3.5rem;
  padding: 0;
  border: 0;
  font-family: var(--sans);
}

.category-option { position: relative; display: inline-flex; align-items: center; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1.35; }
.category-option + .category-option::before { width: 1px; height: 1em; margin: 0 .8rem; background: var(--line); content: ""; }
.category-option input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.category-option span { text-decoration: underline; text-decoration-color: transparent; text-underline-offset: .22em; }
.category-option:hover, .category-option:has(input:focus-visible) { color: var(--text); }
.category-option:has(input:focus-visible) span { outline: 2px solid var(--link); outline-offset: 4px; }
.category-option:has(input:checked) { color: var(--text); }
.category-option:has(input:checked) span { text-decoration-color: currentColor; }

.writing-index:has(#filter-policy-and-research:checked) .archive-item:not([data-categories~="policy-and-research"]),
.writing-index:has(#filter-politics:checked) .archive-item:not([data-categories~="politics"]),
.writing-index:has(#filter-kerala:checked) .archive-item:not([data-categories~="kerala"]),
.writing-index:has(#filter-culture-and-society:checked) .archive-item:not([data-categories~="culture-and-society"]),
.writing-index:has(#filter-technology:checked) .archive-item:not([data-categories~="technology"]),
.writing-index:has(#filter-personal:checked) .archive-item:not([data-categories~="personal"]),
.writing-index:has(#filter-editing:checked) .archive-item:not([data-categories~="editing"]) { display: none; }

.writing-index:has(#filter-policy-and-research:checked) .year-group:not(:has(.archive-item[data-categories~="policy-and-research"])),
.writing-index:has(#filter-politics:checked) .year-group:not(:has(.archive-item[data-categories~="politics"])),
.writing-index:has(#filter-kerala:checked) .year-group:not(:has(.archive-item[data-categories~="kerala"])),
.writing-index:has(#filter-culture-and-society:checked) .year-group:not(:has(.archive-item[data-categories~="culture-and-society"])),
.writing-index:has(#filter-technology:checked) .year-group:not(:has(.archive-item[data-categories~="technology"])),
.writing-index:has(#filter-personal:checked) .year-group:not(:has(.archive-item[data-categories~="personal"])),
.writing-index:has(#filter-editing:checked) .year-group:not(:has(.archive-item[data-categories~="editing"])) { display: none; }

.writing-archive { padding-bottom: 6rem; }
.year-group + .year-group { margin-top: 4.5rem; }
.year { margin: 0 0 1.7rem; font: 400 1.35rem var(--serif); }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1rem 0 3rem;
  color: var(--muted);
  font: .78rem var(--sans);
}

.site-footer p { margin: 0; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 1rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .site-shell, .site-header, .site-footer { width: min(100% - 2rem, 800px); }
  .site-header { padding-top: 1.7rem; }
  .site-nav { gap: .9rem; font-size: .9rem; }
  .intro { padding: 2.1rem 0 3.5rem; }
  .home-section { padding: 2.3rem 0 3.6rem; }
  .newsletter-entry { grid-template-columns: 1fr; gap: .75rem; }
  .newsletter-entry + .newsletter-entry { margin-top: 2.5rem; }
  .subscribe-button { width: fit-content; }
  .contact-list div { grid-template-columns: 1fr; gap: .05rem; }
  .contact-list div + div { margin-top: 1rem; }
  .category-nav { margin-bottom: 3.4rem; }
  .site-footer { flex-direction: column; gap: .9rem; }
  .footer-links { justify-content: flex-start; }
}

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