/* ==========================================================================
   Rahul Rajesh — portfolio styles  (Layer 3: WebGL landing)
   --------------------------------------------------------------------------
   1. Tokens + dark theme      6. WebGL stage + reflection + View button
   2. Base / reset             7. Dock + spin button
   3. Layout helpers           8. Section pages (top bar + placeholder)
   4. Preloader + loading ring 9. Footer
   5. Giant backdrop word     10. Motion / responsive
   ========================================================================== */

/* ============================ 1. TOKENS ============================ */
:root {
  --bg:       #f0ebe1;
  --bg-2:     #e7dfd0;
  --ink:      #14243a;
  --ink-soft: #5b6a7c;
  --line:     #d5cab8;
  --accent:   #2a4d7a;

  --serif:   "Instrument Serif", Georgia, "Times New Roman", serif;
  --grotesk: "Schibsted Grotesk", system-ui, -apple-system, sans-serif;

  --space-1: 0.5rem; --space-2: 1rem;   --space-3: 1.5rem;
  --space-4: 2.5rem; --space-5: 4rem;   --space-6: 6rem;

  /* Text that sits ON the navy band (band is theme-independent, so this is too) */
  --panel-text: #f4efe6;

  /* Landing composition (the name + hanging bulb stack above the drum).
     scene.js sets --drum-top/--drum-bottom (px) once the drum is measured. */
  --name-size: clamp(2.6rem, min(8.5vw, 11vh), 6rem);  /* size of "Rahul Rajesh" */
  --name-gap: 14px;            /* space between the name and the drum's top */
  --bulb-w: 30px;              /* width of the hanging bulb */
  --bulb-gap: 12px;            /* space between the bulb and the name */
  --ring: 104px;               /* loading ring diameter */
  --load-gap: 28px;            /* space between the name and the ring while loading */
  /* where the name sits: resting (above the drum) and loading (name + ring centered) */
  --rest-top: calc(var(--drum-top, 25vh) - var(--name-gap) - var(--name-size));
  --load-top: calc(50vh - (var(--name-size) + var(--load-gap) + var(--ring)) / 2);

  --radius: 3px;
  --max-width: 1160px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --theme-fade: 480ms;
}
:root[data-theme="dark"] {
  --bg:       #0d1b2a;
  --bg-2:     #16283b;
  --ink:      #ede6d8;
  --ink-soft: #9fb0c2;
  --line:     #274056;
  --accent:   #7aa7e0;
}

/* ============================ 2. BASE ============================ */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--grotesk);
  font-size: 1.05rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background var(--theme-fade) var(--ease), color var(--theme-fade) var(--ease);
}
img, video, canvas { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.0; margin: 0; }

/* ============================ 3. LAYOUT ============================ */
.container {
  width: 100%; max-width: var(--max-width);
  margin-inline: auto; padding-inline: var(--space-4);
}

/* ==================== 4. PRELOADER + LOADING RING ==================== */
/* A full-screen veil with the progress ring. The name (section 5) sits
   centered just above the ring while loading, as one group. */
.preloader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
}
/* Arriving from a section page (#home): no loader, no intro glide — the home
   appears already settled. */
html.skip-loader .preloader { display: none; }
html.skip-loader .wordmark { transition: none; }

#theme-transition{
    position:fixed;
    inset:0;

    background:#08131F;

    opacity:0;
    pointer-events:none;

    z-index:9999;

    transition:opacity 250ms ease;
}

#theme-transition.active{
    opacity:1;
}

.loader-ring {
  position: fixed; left: 50%; z-index: 101;
  top: calc(var(--load-top) + var(--name-size) + var(--load-gap));   /* right under the name */
  width: var(--ring); height: var(--ring); transform: translateX(-50%);
}
.loader-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); } /* start the fill at 12 o'clock */
.loader-ring__track { fill: none; stroke: var(--line); stroke-width: 2; }
.loader-ring__bar {
  fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 339.292;      /* 2 * PI * r(54) */
  stroke-dashoffset: 339.292;     /* fully "empty"; JS reduces this as % rises */
  transition: stroke-dashoffset 120ms linear;
}
.loader-ring__pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--grotesk); font-size: 0.95rem; letter-spacing: 0.06em; color: var(--ink-soft);
}

/* ==================== 5. WORDMARK ==================== */
/* One name for both states. Resting: its bottom sits --name-gap above the
   drum's top edge. While loading it's shifted down to sit just above the ring;
   removing body.is-loading glides it up into place as the drum fades in. */
.wordmark {
  position: fixed; left: 0; right: 0; z-index: 102; margin: 0;
  top: var(--rest-top);
  font-family: var(--serif); font-weight: 400;
  font-size: var(--name-size); line-height: 1;
  letter-spacing: 0.02em; white-space: nowrap; text-align: center;
  color: var(--ink);
  -webkit-text-stroke: 1.5px currentColor;   /* fuller weight (Instrument Serif has no bold) */
  pointer-events: none; user-select: none;
  transition: transform 1100ms var(--ease), color var(--theme-fade) var(--ease);
  will-change: transform;
}
body.is-loading .wordmark { transform: translateY(calc(var(--load-top) - var(--rest-top))); }

/* ==================== 6. WEBGL STAGE ==================== */
/* Fixed + full-viewport: the drum stays put while the .scroll-track scrolls
   underneath it and drives the rotation. */
.stage { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100vh; }
.scene-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* A soft contact shadow just under the band, to ground the drum in space
   (replaces the old readable mirror) */
.floor-sheen {
  position: absolute; left: 50%; top: var(--drum-bottom, 76vh); z-index: 3;
  width: min(780px, 80vw); height: 100px; transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(8, 15, 26, 0.30), transparent 72%);
  filter: blur(18px);
}

/* Active section name (crisp HTML, never warped by the curve) + View pill,
   stacked and centered over the band. The name cross-fades on rotation. */
.section-name {
  position: fixed; left: 50%; top: 50%; z-index: 5;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: var(--space-3);
  text-align: center; pointer-events: none;
}
.section-name__label {
  font-family: var(--serif); font-weight: 400; line-height: 1;
  font-size: clamp(2.6rem, 8vw, 5.5rem); letter-spacing: -0.01em; color: var(--panel-text);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease);
}
.section-name__label.is-swapping { opacity: 0; transform: translateY(10px); }

.view-btn {
  pointer-events: auto;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--grotesk); font-size: 0.9rem; letter-spacing: 0.08em; text-transform: uppercase;
  border-radius: 999px; padding: 0.55rem 1.4rem; cursor: pointer;
}
.view-btn:hover { border-color: var(--accent); color: var(--accent); }

/* While loading, hide the stage + name + dock; JS reveals them after 100% */
body.is-loading .stage,
body.is-loading .section-name,
body.is-loading .floor-sheen,
body.is-loading .scroll-hint,
body.is-loading .dock { opacity: 0; }
.stage, .section-name, .floor-sheen, .scroll-hint, .dock { transition: opacity 800ms var(--ease); }

/* ==================== 6c. SCROLL HINT ==================== */
/* Spin is driven by wheel/drag now (no scroll track). The hint just tells the
   visitor the drum responds to scroll, then retires on first input. */
.scroll-hint {
  position: fixed; left: 50%; z-index: 9;
  /* just under the drum, but never down into the dock */
  top: min(calc(var(--drum-bottom, 76vh) + 30px), calc(100vh - var(--space-4) - 104px));
  transform: translateX(-50%);
  font-family: var(--grotesk); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-soft); pointer-events: none;
  transition: opacity 500ms var(--ease);
}
body:not(.motion-ok) .scroll-hint { display: none; }
@media (max-height: 600px) { .scroll-hint { display: none; } }   /* no room under the drum */
.scroll-hint.is-hidden { opacity: 0; }

/* ==================== 7. DOCK ==================== */
.dock {
  position: fixed; left: 50%; bottom: var(--space-4); transform: translateX(-50%); z-index: 10;
  display: flex; align-items: stretch; gap: var(--space-2);
}
.dock__main {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0.5rem 0.75rem 0.5rem 0.5rem;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px;
}
.dock__thumb {
  width: 52px; height: 52px; flex: none; border-radius: 50%;
  background: var(--bg); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 1.25rem; color: var(--ink); cursor: pointer;
}
.dock__meta { display: flex; flex-direction: column; line-height: 1.15; padding-right: var(--space-2); cursor: pointer; }
.dock__hint { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-soft); }
.dock__label { font-family: var(--serif); font-size: 1.5rem; color: var(--ink); transition: opacity 220ms var(--ease); }
.dock__label.is-swapping { opacity: 0; }
.dock__arrow {
  width: 34px; height: 34px; flex: none; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink); font-size: 1.1rem; line-height: 1; cursor: pointer; font-family: var(--grotesk);
}
.dock__arrow:hover { border-color: var(--accent); color: var(--accent); }

.dock__enter {
  position: relative; flex: none; width: 64px; height: 64px;
  display: grid; place-items: center;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink); cursor: pointer;
}
.dock__enter:hover { border-color: var(--accent); color: var(--accent); }
.dock__ring { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); animation: spin 9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dock__enter-mark { font-size: 1.2rem; line-height: 1; }

/* ==================== 8. SECTION PAGES ==================== */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line);
}
.topbar__brand { font-family: var(--serif); font-size: 1.4rem; color: var(--ink); white-space: nowrap; }
.topbar__brand:hover { text-decoration: none; }
.topbar__right { display: flex; align-items: center; gap: var(--space-2); }
.topbar__home { color: var(--ink-soft); font-size: 0.95rem; }
.topbar__home:hover { color: var(--ink); text-decoration: none; }
.topbar .mode-toggle { position: static; }

/* Social icon cluster in the top bar (email reveals its address on hover) */
.socials { display: inline-flex; align-items: center; gap: 0.35rem; }
.social {
  display: inline-grid; place-items: center; width: 34px; height: 34px;
  color: var(--ink-soft); border-radius: 50%; cursor: pointer; text-decoration: none;
  transition: color 200ms var(--ease), background 200ms var(--ease), transform 200ms var(--ease);
}
.social:hover { color: var(--ink); background: var(--bg-2); text-decoration: none; transform: translateY(-1px); }
.social svg { width: 18px; height: 18px; display: block; }

.social--email { position: relative; }
.social__reveal {
  position: absolute; top: calc(100% + 6px); right: 0;
  white-space: nowrap; font-size: 0.82rem; color: var(--ink);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.3rem 0.55rem;
  opacity: 0; visibility: hidden; transform: translateY(-4px); pointer-events: none; z-index: 70;
  transition: opacity 180ms var(--ease), transform 180ms var(--ease), visibility 180ms;
}
.social--email:hover .social__reveal,
.social--email:focus .social__reveal,
.social--email:focus-within .social__reveal {
  opacity: 1; visibility: visible; transform: translateY(0); pointer-events: auto;
}

.section-page {
  min-height: 70vh; display: flex; flex-direction: column; justify-content: center;
  align-items: flex-start; padding-block: var(--space-6);
}
.eyebrow { font-family: var(--grotesk); font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); margin: 0 0 var(--space-2); }
.section-title { font-size: clamp(3rem, 10vw, 7rem); letter-spacing: -0.02em; color: var(--ink); margin-bottom: var(--space-3); }
.section-desc { max-width: 48ch; color: var(--ink-soft); font-size: 1.15rem; margin-bottom: var(--space-3); }
.section-status { display: inline-block; font-size: 0.85rem; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; padding: 0.35rem 0.9rem; margin-bottom: var(--space-4); }
.back-link { font-family: var(--grotesk); color: var(--ink); }

/* ==================== 6b. DARK-MODE TOGGLE ==================== */
.mode-toggle {
  position: fixed; top: var(--space-3); right: var(--space-4); z-index: 60;
  width: 40px; height: 40px; display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: 50%;
  color: var(--ink); cursor: pointer;
}
.mode-toggle:hover { border-color: var(--accent); }
.mode-toggle svg { width: 18px; height: 18px; display: block; }

/* Corner moon button: only triggers the very first light->dark, then hides
   (the hanging bulb becomes the toggle). */
.mode-toggle .icon-bulb { display: none; }
body.has-toggled .mode-toggle { display: none; }

/* The hanging lightbulb: drops in once, then STAYS as the persistent toggle.
   It hangs centered over the name, and the rope auto-sizes so the bulb always
   stops --bulb-gap above "Rahul Rajesh" on any screen.
   ---- EDIT THESE ----
   size          -> --bulb-w (in :root)
   gap above name-> --bulb-gap (in :root)
   drop distance -> js/main.js dropBulbToDark() y value */
#lightbulb {
  position: fixed; left: 50%; top: 0; z-index: 10000;
  transform: translateX(-50%);
  display: none; flex-direction: column; align-items: center;
  color: var(--ink); pointer-events: none;
}
#lightbulb.dropped { display: flex; pointer-events: auto; cursor: pointer; }
#lightbulb { transition: opacity 600ms var(--ease); }
body.is-loading #lightbulb { opacity: 0; }   /* appears with the home, not over the loader */
#lightbulb.dropping { color: rgba(255, 255, 255, 0.5); } /* faint unlit outline while it hangs in the dark */
.bulb-rope {
  width: 2px; background: currentColor; opacity: 0.5;
  /* name top - gap - bulb height (glass is 1.5x as tall as it is wide) */
  height: max(0.6rem, calc(var(--rest-top) - var(--bulb-gap) - var(--bulb-w) * 1.5));
}
.bulb-glass { width: var(--bulb-w); height: auto; margin-top: -1px; transform: rotate(180deg); } /* base up (hanging) */

/* A soft pool of light spilling from the bulb onto the name (dark mode only) */
#lightbulb::after {
  content: ""; position: absolute; left: 50%; top: 100%;
  width: min(820px, 92vw); height: 380px;
  transform: translate(-50%, -38%);                  /* centered just below the glass */
  /* closest-side keeps the glow fully faded inside the box, so no hard edges */
  background: radial-gradient(closest-side, rgba(255, 243, 220, 0.14), rgba(255, 243, 220, 0.05) 55%, transparent);
  pointer-events: none; opacity: 0;
  transition: opacity 900ms var(--ease);
}
:root[data-theme="dark"] #lightbulb.dropped:not(.dropping)::after { opacity: 1; }
/* Glows in dark mode, dim in light — follows the theme automatically */
:root[data-theme="dark"] #lightbulb { color: #fff7ec; }   /* whiter light */
:root[data-theme="dark"] #lightbulb .bulb-glass {
  filter: drop-shadow(0 0 10px rgba(255, 250, 240, 0.95))
          drop-shadow(0 0 26px rgba(255, 245, 225, 0.55));
  animation: bulb-radiate 3.6s var(--ease) infinite;   /* ever-so-slight breathing */
}
@keyframes bulb-radiate {
  0%, 100% { filter: drop-shadow(0 0 9px rgba(255, 250, 240, 0.9))
                     drop-shadow(0 0 22px rgba(255, 245, 225, 0.45)); }
  50%      { filter: drop-shadow(0 0 14px rgba(255, 252, 245, 1))
                     drop-shadow(0 0 34px rgba(255, 246, 228, 0.65)); }
}

/* Brief electrical flicker right before the bulb settles to its steady glow */
:root[data-theme="dark"] #lightbulb.flickering .bulb-glass {
  animation: bulb-flicker 0.7s linear 1;
}
/* Paired stops with ~1% gaps = near-instant on/off snaps (electrical flicker) */
@keyframes bulb-flicker {
  0%, 7%    { opacity: 0.12; }
  8%, 16%   { opacity: 1; }
  17%, 24%  { opacity: 0.3; }
  25%, 40%  { opacity: 1; }
  41%, 48%  { opacity: 0.15; }
  49%, 62%  { opacity: 1; }
  63%, 70%  { opacity: 0.5; }
  71%, 100% { opacity: 1; }
}

/* ==================== 8b. ABOUT PAGE ==================== */
.about { padding-block: var(--space-5) var(--space-6); max-width: 1080px; }

/* Hero: text (eyebrow + title + intro) on the left, portrait on the right.
   The portrait's height is driven by the text column (align-items: stretch +
   an absolutely-filled image), so its top lines up with the title and its
   bottom lands at the end of the intro. */
.about-hero {
  display: grid; grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-5); align-items: stretch;
  margin-bottom: var(--space-6);
}
.about-hero__title {
  font-size: clamp(3rem, 10vw, 7rem);
  letter-spacing: -0.02em; color: var(--ink); line-height: 0.98;
  margin-bottom: var(--space-4);
}
.about-portrait { position: relative; height: 100%; justify-self: stretch; }
.about-portrait img { position: absolute; inset: 0; }

/* Text blocks */
.about-block { margin-bottom: var(--space-6); }
.about-block__head {
  font-family: var(--grotesk); font-weight: 600;
  font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--space-3);
}
.about-block .prose { max-width: 62ch; }

/* Right-now: a tall photo on the LEFT, and a right column holding the text
   (top) with a second photo (bottom). The left photo stretches to match the
   right column's height. */
.about-block--media {
  display: grid; grid-template-columns: 0.85fr 1fr;
  gap: var(--space-5); align-items: stretch;
}
.about-media__col { display: grid; gap: var(--space-4); align-content: start; }
/* Left photo fills the right column's height (image absolute so it doesn't
   drive the row) — this levels its bottom with the squad photo's bottom. */
.about-media__tall { position: relative; height: 100%; }
.about-media__tall img { position: absolute; inset: 0; }
/* Squad photo (bottom-right): a touch taller so the two photos balance. */
.about-media__col .about-figure { aspect-ratio: 3 / 2; }

/* Ideas (Spinoza / metanoia) */
.about-block--ideas { max-width: 72ch; }
.about-block--ideas .prose { max-width: none; }

/* Ideas + Off-the-clock text on the left; snowboard photo on the right,
   spanning the full height of both blocks.
   WIDTH knob -> .about-sidephoto grid-template-columns (2nd value = photo width) */
.about-sidephoto {
  display: grid; grid-template-columns: 1fr 0.55fr;
  gap: var(--space-5); align-items: stretch;
  margin-bottom: var(--space-6);
}
.about-sidephoto__col .about-block:last-child { margin-bottom: 0; }
.about-sidephoto__img { position: relative; height: 100%; }
.about-sidephoto__img img { position: absolute; inset: 0; }

/* Figures: framed, subtle hover zoom */
.about-figure {
  margin: 0; overflow: hidden; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg-2);
  box-shadow: 0 12px 30px rgba(13, 27, 42, 0.08);
}
.about-figure img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease); }
.about-figure:hover img { transform: scale(1.04); }

/* Prose: paragraphs injected from /content text files — one consistent
   body size/family everywhere (grotesk, inherited from <body>). */
.prose p { color: var(--ink); font-size: 1.15rem; line-height: 1.65; margin: 0 0 1.15em; }
.prose p:last-child { margin-bottom: 0; }
.prose { min-height: 1.6em; }   /* avoids layout jump before fetch resolves */
.prose a { color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.prose a:hover { border-color: var(--accent); text-decoration: none; }

/* Gentle scroll-reveal (JS toggles .is-in; reduced-motion reveals instantly) */
[data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity 700ms var(--ease), transform 700ms var(--ease); }
[data-reveal].is-in { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .about-hero,
  .about-block--media { grid-template-columns: 1fr; }
  /* Stacked: give the absolutely-filled photos an explicit shape/height. */
  .about-portrait { height: auto; aspect-ratio: 4 / 5; max-width: 340px; justify-self: start; }
  .about-media__tall { height: auto; aspect-ratio: 4 / 3; }
  .about-sidephoto { grid-template-columns: 1fr; }
  .about-sidephoto__img { height: auto; aspect-ratio: 4 / 5; max-width: 340px; }
}

/* ==================== 8c. ACADEMIC PAGE (accordions) ==================== */
.academic { padding-block: var(--space-5) var(--space-6); max-width: 860px; }
.academic__fields {
  font-family: var(--serif); color: var(--ink);
  font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.1; letter-spacing: 0.01em;
  margin: 0 0 var(--space-5);
}

.acc-group { margin-bottom: var(--space-5); }
.acc-group__label {
  font-family: var(--grotesk); font-weight: 600;
  font-size: 0.78rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--space-2);
}
/* The stack of dropdowns; a hairline above the first row */
.acc { border-top: 1px solid var(--line); }
.acc__item { border-bottom: 1px solid var(--line); }

/* Header row (the clickable summary) */
.acc__head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) 0; cursor: pointer; list-style: none;
  transition: color 200ms var(--ease);
}
.acc__head::-webkit-details-marker { display: none; }   /* kill native triangle */
.acc__lead { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.acc__title { font-family: var(--serif); font-size: 1.5rem; line-height: 1.1; color: var(--ink); }
.acc__sub { font-family: var(--grotesk); font-size: 0.85rem; color: var(--ink-soft); }
.acc__sub a { color: var(--ink-soft); border-bottom: 1px solid var(--line); }
.acc__sub a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.acc__date {
  margin-left: auto; flex: none; white-space: nowrap;
  font-family: var(--grotesk); font-size: 0.82rem; letter-spacing: 0.02em; color: var(--ink-soft);
}
.acc__chevron { flex: none; width: 20px; height: 20px; color: var(--ink-soft); transition: transform 260ms var(--ease); }
.acc__item[open] .acc__chevron { transform: rotate(180deg); }

/* Hover / open emphasis */
.acc__head:hover .acc__title,
.acc__item[open] .acc__title { color: var(--accent); }

/* Body: revealed on open with a soft fade-in */
.acc__body { padding: 0 0 var(--space-3); max-width: 70ch; }
.acc__body p { margin: 0; color: var(--ink); font-size: 1.05rem; line-height: 1.65; }
.acc__body a { color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.acc__body a:hover { border-color: var(--accent); text-decoration: none; }
.acc__item[open] .acc__body { animation: acc-reveal 300ms var(--ease); }
@keyframes acc-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .acc__title { font-size: 1.3rem; }
  .acc__date { display: none; }   /* dates live on the résumé; keep the row tidy on phones */
}

/* ---- Photo grid (Academic, Blog, Journey) — 1, 2, or 3 across; js/gallery.js sets data-count ---- */
.gallery {
  --cols: 3;
  display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 10px;
  margin-top: var(--space-3); max-width: 680px;
}
.gallery[data-count="2"] { --cols: 2; }
.gallery[data-count="1"] { --cols: 1; max-width: 560px; }
.gallery__item {
  display: block; padding: 0; margin: 0; cursor: zoom-in;
  aspect-ratio: 4 / 3; overflow: hidden;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px;
  transition: border-color 200ms var(--ease), transform 300ms var(--ease), box-shadow 300ms var(--ease);
}
/* a lone photo keeps its own shape, capped in height so tall portraits don't tower */
.gallery[data-count="1"] { display: block; }
.gallery[data-count="1"] .gallery__item { display: inline-block; aspect-ratio: auto; max-width: 100%; vertical-align: top; }
.gallery[data-count="1"] .gallery__item img { width: auto; height: auto; max-width: 100%; max-height: 440px; }
.gallery__item img { width: 100%; height: 100%; object-fit: cover; transition: transform 500ms var(--ease); }
.gallery__item:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 10px 24px rgba(13, 27, 42, 0.12); }
.gallery__item:hover img { transform: scale(1.03); }
.gallery__item:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 560px) {
  .gallery { --cols: 2; }
  .gallery[data-count="1"] { --cols: 1; }
  .gallery[data-count="3"] .gallery__item:first-child { grid-column: span 2; aspect-ratio: 16 / 9; }
}

/* ---- Lightbox: full-size, uncropped view ---- */
.lightbox {
  position: fixed; inset: 0; z-index: 20000;
  display: grid; place-items: center; padding: 64px 72px;
  background: rgba(8, 15, 26, 0.9); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity 220ms var(--ease);
}
.lightbox[hidden] { display: none; }
.lightbox.is-open { opacity: 1; }
.lightbox__figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.lightbox__img {
  max-width: min(1200px, calc(100vw - 144px)); max-height: calc(100vh - 150px);
  object-fit: contain; border-radius: 8px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.lightbox__count { font-family: var(--grotesk); font-size: 0.78rem; letter-spacing: 0.12em; color: rgba(244, 239, 230, 0.7); }
.lightbox__btn {
  position: absolute; width: 44px; height: 44px; display: grid; place-items: center; padding: 0;
  font-size: 1.6rem; line-height: 1; color: #f4efe6; cursor: pointer;
  background: rgba(244, 239, 230, 0.08); border: 1px solid rgba(244, 239, 230, 0.2); border-radius: 50%;
  transition: background 180ms var(--ease);
}
.lightbox__btn:hover { background: rgba(244, 239, 230, 0.18); }
.lightbox__close { top: 18px; right: 18px; }
.lightbox__nav { top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: 18px; }
.lightbox__nav--next { right: 18px; }
.lightbox.is-single .lightbox__nav { display: none; }
@media (max-width: 560px) {
  .lightbox { padding: 56px 12px; }
  .lightbox__img { max-width: calc(100vw - 24px); }
  .lightbox__nav { top: auto; bottom: 18px; transform: none; }
}

/* ==================== 8d. POSTS (blog + journey) ==================== */
.posts { padding-block: var(--space-5) var(--space-6); max-width: 820px; }
.page-lead {
  font-family: var(--serif); color: var(--ink);
  font-size: clamp(2.4rem, 7vw, 4rem); line-height: 1; letter-spacing: -0.01em;
  margin: 0 0 var(--space-5);
}
.posts__list { margin-bottom: var(--space-5); }
.posts-empty { color: var(--ink-soft); font-size: 1.05rem; }

/* Post body: headings/lists rendered from Markdown */
.post__body h3 { font-family: var(--serif); font-size: 1.5rem; margin: 1.4rem 0 0.5rem; color: var(--ink); }
.post__body h4 { font-family: var(--serif); font-size: 1.25rem; margin: 1.2rem 0 0.4rem; color: var(--ink); }
.post__body ul, .post__body ol { margin: 0 0 1.15em; padding-left: 1.3em; }
.post__body li { margin: 0.2em 0; }
.post__body blockquote {
  margin: 0 0 1.15em; padding-left: var(--space-3);
  border-left: 2px solid var(--line); color: var(--ink-soft); font-style: italic;
}
.post__body code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em;
  background: var(--bg-2); padding: 0.1em 0.35em; border-radius: 4px;
}
.post__body + .gallery { margin-top: var(--space-4); }

/* ==================== 8e. PHOTOGRAPHY (the void) ==================== */
/* Always black, whatever the site theme. One screen tall: the name, the
   pills, then the carousel fills the rest. */
body.void {
  --bg: #000; --bg-2: #161616; --ink: #f4efe6; --ink-soft: #8d8d8d; --line: #242424; --accent: #f4efe6;
  background: #000; color: var(--ink);
  height: 100vh; height: 100dvh; overflow: hidden;
  display: flex; flex-direction: column;
}
.void .topbar { border-bottom-color: transparent; }

/* Arrival: the page starts in the site's own color and dims into black */
.void-veil {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: #f0ebe1;
  animation: void-in 1.3s var(--ease) forwards;
}
:root[data-theme="dark"] .void-veil { background: #0d1b2a; }
@keyframes void-in { to { opacity: 0; visibility: hidden; } }
.photos > * { animation: void-rise 1.1s var(--ease) both; }
.photos > .photo-tabs { animation-delay: 0.45s; }
.photos > .glass-hint { animation-delay: 0.9s; }
.photos > .fluid { animation-delay: 0.35s; }
@keyframes void-rise { from { opacity: 0; transform: translateY(14px); } }

.photos { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* @rahuls__photos — the canvas draws the letters; the plain text is the
   fallback (no WebGL) and what screen readers read */
.fluid {
  position: relative; display: block; flex: none;
  font-family: var(--serif); font-weight: 400; line-height: 1.45; text-align: center;
  font-size: clamp(2.3rem, min(9vw, 10.5vh), 6rem);
  color: var(--ink); touch-action: none; -webkit-tap-highlight-color: transparent;
}
.fluid:hover { text-decoration: none; }
.fluid--on { color: transparent; }
.fluid__canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Wildlife / Other */
.photo-tabs { display: flex; justify-content: center; gap: 0.5rem; margin-bottom: var(--space-2); flex: none; }
.photo-tab {
  font: 500 0.82rem/1 var(--grotesk); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-soft); background: transparent; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.55rem 1.1rem;
  transition: color 200ms var(--ease), background 200ms var(--ease), border-color 200ms var(--ease);
}
.photo-tab:hover { color: var(--ink); border-color: #3a3a3a; }
.photo-tab[aria-selected="true"] { color: #000; background: var(--ink); border-color: var(--ink); }

/* The carousel canvas fills this box */
.glass { position: relative; flex: 1; min-height: 240px; overflow: hidden; touch-action: none; }
.glass--grid { overflow-y: auto; touch-action: auto; padding: 0 var(--space-4); }
.glass-hint {
  flex: none; margin: 0; padding: var(--space-1) var(--space-3) var(--space-3); text-align: center;
  font-size: 0.74rem; letter-spacing: 0.12em; text-transform: uppercase; color: #6f6f6f;
}
.void .lightbox { background: rgba(0, 0, 0, 0.92); }
@media (hover: none) { .glass-hint { font-size: 0.68rem; } }

/* ==================== 9. FOOTER ==================== */
.footer {
  border-top: 1px solid var(--line); padding: var(--space-4);
  color: var(--ink-soft); font-size: 0.9rem;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2);
}
.footer a { color: var(--ink-soft); }
.footer a:hover { color: var(--ink); }

/* ==================== 10. MOTION / RESPONSIVE ==================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
@media (max-width: 640px) {
  .container { padding-inline: var(--space-3); }
  :root { --name-size: clamp(2rem, 11vw, 3rem); --bulb-w: 26px; }
  /* top bar: fit name + icons on one line (the name itself links home) */
  .topbar { padding: var(--space-2) var(--space-3); }
  .topbar__brand { font-size: 1.2rem; }
  .topbar__home { display: none; }
  .topbar__right { gap: 0.25rem; }
  .social { width: 30px; height: 30px; }
  .dock { width: calc(100% - var(--space-4)); }
  .dock__main { flex: 1; }
  .dock__label { font-size: 1.2rem; }
  .dock__thumb { width: 44px; height: 44px; }
  .dock__enter { width: 56px; height: 56px; }
  .footer { flex-direction: column; }
}
