/* ---------------------------------------------------------------- */
/* Design tokens                                                     */
/* ---------------------------------------------------------------- */
:root {
  --bg: #ffffff;
  --surface: #f4f5f7;
  --ink: #15171c;
  --muted: #5b6270;
  --border: #e4e6ea;
  --accent: #2440d6;
  --accent-ink: #ffffff;
  --coral: #ff6b4a;
  --shadow: 0 1px 2px rgba(20, 22, 30, 0.04), 0 8px 24px rgba(20, 22, 30, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121317;
    --surface: #1b1d22;
    --ink: #eceef2;
    --muted: #9aa1ad;
    --border: #2a2d34;
    --accent: #7d94ff;
    --accent-ink: #10131f;
    --coral: #ff8a6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

.cover-1 { background: url('img/covers/do-aur-do-pyaar.svg') center/cover no-repeat, linear-gradient(135deg, #ff6b4a, #ff3d81); }
.cover-2 { background: url('img/covers/song-in-movies.svg') center/cover no-repeat, linear-gradient(135deg, #2440d6, #7d3cff); }
.cover-3 { background: url('img/covers/kannathil-muthamittal.svg') center/cover no-repeat, linear-gradient(135deg, #0f9b8e, #0c5c74); }
.cover-4 { background: url('img/covers/minnaram.svg') center/cover no-repeat, linear-gradient(135deg, #f7b733, #fc4a1a); }

/* ---------------------------------------------------------------- */
/* Base                                                               */
/* ---------------------------------------------------------------- */
* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  counter-reset: sidenote-counter;
}

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

h1, h2, h3 {
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

img { max-width: 100%; display: block; }

.eyebrow {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.6rem;
  border-radius: 999px;
  background: var(--coral);
  color: #1a1200;
}

/* ---------------------------------------------------------------- */
/* Masthead                                                           */
/* ---------------------------------------------------------------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.masthead-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.wordmark:hover { text-decoration: none; color: var(--accent); }

.masthead-nav { display: flex; gap: 1.5rem; }
.masthead-nav a {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}
.masthead-nav a:hover { color: var(--ink); text-decoration: none; }

/* ---------------------------------------------------------------- */
/* Homepage: hero                                                     */
/* ---------------------------------------------------------------- */
main { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

.hero { padding: 3.5rem 0 3rem; max-width: 640px; }
.hero h1 { font-size: 2.75rem; }
.hero-tagline { font-size: 1.2rem; font-style: italic; color: var(--muted); margin: 0 0 1.5rem; }
.hero-lede { color: var(--ink); margin: 0 0 1rem; }
.hero-cta { font-weight: 700; }

/* ---------------------------------------------------------------- */
/* Homepage: essay card grid                                          */
/* ---------------------------------------------------------------- */
.section-head { padding: 1.5rem 0 2rem; max-width: 640px; }
.section-head h2 { font-size: 1.9rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.75rem;
  padding-bottom: 3rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); }

.card-link { color: inherit; display: block; }
.card-link:hover { text-decoration: none; }

.card-cover {
  position: relative;
  height: 160px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem;
  overflow: hidden;
}

.card-number {
  font-weight: 800;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

.card-body { padding: 1.25rem 1.4rem 1.5rem; }
.card-body h3 { font-size: 1.2rem; margin: 0.6rem 0 0.5rem; }
.card-excerpt { color: var(--muted); font-size: 0.95rem; margin: 0 0 0.75rem; }
.card-meta { color: var(--muted); font-size: 0.82rem; font-weight: 600; margin: 0; }

/* ---------------------------------------------------------------- */
/* Homepage: epilogue + social                                        */
/* ---------------------------------------------------------------- */
.epilogue { padding: 1rem 0 3rem; }
.epilogue-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 2.25rem;
  max-width: 720px;
}
.epilogue-card p { margin: 0 0 1rem; color: var(--ink); }
.epilogue-card p:last-child { margin-bottom: 0; }

.social { padding: 1rem 0 4rem; }
.social-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0;
  margin: 1rem 0 0;
}
.social-links a {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
}
.social-links a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------------- */
/* Site footer                                                        */
/* ---------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}
.site-footer a { color: var(--muted); font-weight: 600; }
.site-footer a:hover { color: var(--accent); }

/* ---------------------------------------------------------------- */
/* Article page                                                       */
/* ---------------------------------------------------------------- */
.essay-hero {
  position: relative;
  border-radius: 20px;
  padding: 3rem 2rem;
  margin: 2rem 0 1.5rem;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  min-height: 220px;
  background-position: right center;
}

.essay-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.35) 55%, rgba(0, 0, 0, 0) 90%);
}

.essay-hero-content { position: relative; max-width: 700px; }
.essay-hero-content .tag { margin-bottom: 0.75rem; }
.essay-hero-content h1 { color: #fff; font-size: 2.1rem; margin: 0; text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7), 0 1px 4px rgba(0, 0, 0, 0.9); }

.essay-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0 0.25rem 1rem;
}
.essay-meta .dot { opacity: 0.6; }

.essay-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 0.5rem 0.25rem 2rem;
}
.essay-body p { margin: 0 0 1.3rem; }

.essay-body figure { margin: 2rem 0; }
.essay-body figure img { border-radius: 12px; box-shadow: var(--shadow); }

.iframe-wrapper {
  position: relative;
  padding-bottom: 56.25%;
  padding-top: 25px;
  height: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.iframe-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.essay-footer {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 0.25rem 4rem;
  border-top: 1px solid var(--border);
}
.essay-footer p { margin: 0 0 1rem; color: var(--muted); }
.back-home { font-weight: 700; }

/* ---------------------------------------------------------------- */
/* Citations: re-skinned Tufte margin-notes / sidenotes                */
/* Kept as a click-to-reveal chip (was desktop-margin / mobile-toggle */
/* in the original Tufte layout) since the new column has no margin.  */
/* ---------------------------------------------------------------- */
input.margin-toggle { display: none; }

label.margin-toggle:not(.sidenote-number) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  vertical-align: middle;
}
label.margin-toggle:not(.sidenote-number):hover { color: var(--accent); border-color: var(--accent); }

label.sidenote-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  vertical-align: text-top;
  margin: 0 0.15rem;
}
label.sidenote-number { counter-increment: sidenote-counter; }
label.sidenote-number:after { content: counter(sidenote-counter); }

.sidenote, .marginnote {
  display: none;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--muted);
  background: var(--surface);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  padding: 0.75rem 1rem;
  margin: 0.6rem 0 1.2rem;
}

.margin-toggle:checked + .sidenote,
.margin-toggle:checked + .marginnote {
  display: block;
}

/* ---------------------------------------------------------------- */
/* Responsive                                                          */
/* ---------------------------------------------------------------- */
@media (max-width: 760px) {
  .masthead-nav { gap: 1rem; }
  .hero h1 { font-size: 2.1rem; }
  .card-grid { grid-template-columns: 1fr; }
  .essay-hero { padding: 2rem 1.25rem; min-height: 180px; }
  .essay-hero-content h1 { font-size: 1.6rem; }
}
