/* ==========================================================
   mayanknagpal.com — one stylesheet, no build step.
   Inspired by the honest, heavy style of draplin.com.
   Two moods: dark (default) and light. One accent color.
   ========================================================== */

/* Dark mood — the default. */
:root {
  --bg: #232323;
  --ink: #d6d6d6;      /* body text */
  --bright: #ffffff;   /* headings, active links */
  --dim: #8f8f8f;      /* inactive nav, captions */
  --rule: #444444;     /* horizontal rules */
  --panel: #1a1a1a;    /* media placeholders */
  --hairline: #2e2e2e; /* list separators */
  --accent: #ff6631;   /* the orange */
}

/* Light mood — warm paper, same bones. */
:root[data-theme="light"] {
  --bg: #f2efe7;
  --ink: #3d3a34;
  --bright: #1c1c1c;
  --dim: #79736a;
  --rule: #d5cfc0;
  --panel: #e9e4d7;
  --hairline: #ded8c9;
  --accent: #e04e1c;   /* orange, darkened for paper */
}

/* Want a different accent? Change the two --accent lines above.
   Pairs that hold up on both charcoal and paper (dark / light):
     Orange   #ff6631 / #e04e1c   (default)
     Yellow   #f5c518 / #a87900
     Green    #37b24d / #21813a
     Red      #f03e3e / #c92a2a
     Cobalt   #5c7cfa / #3b5bdb
     Teal     #12b886 / #087f5b
   One accent at a time. That's the rule. */

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

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

/* ---------- Lights switch (Lucide sun/moon, animated on hover) ---------- */

.lights {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--dim);
  font-family: inherit;
  font-weight: 700;
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
}

.lights:hover { color: var(--bright); border-color: var(--bright); }

.lights .ic {
  width: 15px;
  height: 15px;
  transition: transform 0.4s ease;
}

/* In the dark, offer the sun; in the light, offer the moon. */
:root[data-theme="dark"] .ic-moon { display: none; }
:root[data-theme="light"] .ic-sun { display: none; }

.lights:hover .ic-sun { transform: rotate(90deg); }
.lights:hover .ic-moon { transform: rotate(-24deg) scale(1.12); }

@media (prefers-reduced-motion: reduce) {
  .lights .ic { transition: none; }
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 16px;
}

.site-title {
  color: var(--bright);
  text-decoration: none;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* ---------- Nav ---------- */

.site-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 24px;
  padding: 16px 0;
}

.site-nav ul { list-style: none; }

.site-nav a {
  display: inline-block;
  color: var(--dim);
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
  padding: 2px 0;
}

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

.site-nav a.active { color: var(--bright); }

/* ---------- Page title ---------- */

.page-title {
  color: var(--bright);
  font-size: clamp(48px, 11vw, 120px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.95;
  padding: 34px 0 40px;
}

/* ---------- Content ---------- */

main section { padding: 30px 0; }

main section + section { border-top: 1px solid var(--rule); }

.kicker {
  display: block;
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

h2 {
  color: var(--bright);
  font-size: clamp(20px, 2.8vw, 27px);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
}

p { max-width: 70ch; margin-bottom: 18px; }

p:last-child { margin-bottom: 0; }

.lede {
  color: var(--bright);
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700;
  line-height: 1.4;
}

main a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  font-weight: 700;
}

main a:hover { text-decoration-thickness: 2px; }

strong { color: var(--bright); }

/* ---------- Dense lists (love / hate / things) ---------- */

.dense {
  list-style: none;
  columns: 2;
  column-gap: 48px;
  max-width: 100%;
}

.dense li {
  break-inside: avoid;
  padding: 6px 0;
  border-bottom: 1px solid var(--hairline);
  font-weight: 700;
  color: var(--bright);
}

.dense li small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--dim);
}

/* ---------- Plain lists (love / hate, Draplin style) ---------- */

.plain { list-style: none; }

.plain li {
  padding: 2px 0;
  color: var(--ink);
  font-weight: 400;
}

/* ---------- Job blocks (work history, Draplin employment style) ---------- */

main h2.era { margin-top: 26px; }

.job { padding: 4px 0 16px; max-width: 75ch; }

.job-head {
  color: var(--bright);
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.5;
}

.job-head .role {
  display: block;
  color: var(--ink);
  font-weight: 400;
}

.job-head .dates {
  display: block;
  color: var(--dim);
  font-weight: 400;
  font-size: 12px;
}

/* ---------- Ledger lists (projects / work history) ---------- */

.ledger { list-style: none; }

.ledger li {
  padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  max-width: 80ch;
}

.ledger .year {
  color: var(--accent);
  font-weight: 700;
  margin-right: 10px;
}

/* ---------- Media ---------- */

figure { margin: 24px 0; }

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

figcaption {
  color: var(--dim);
  font-size: 12px;
  padding-top: 8px;
}

.video-frame {
  aspect-ratio: 16 / 9;
  background: var(--panel);
  border: 1px solid var(--rule);
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.photo-placeholder {
  aspect-ratio: 16 / 9;
  background: var(--panel);
  border: 1px dashed var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-weight: 700;
}

/* ---------- Ticker (home page marquee) ---------- */

.ticker {
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
  padding: 10px 0;
}

.ticker-track {
  display: flex;
  white-space: nowrap;
  width: max-content;
  animation: ticker 28s linear infinite;
}

.ticker-track span {
  color: var(--dim);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0 18px;
}

.ticker-track span::after {
  content: "·";
  color: var(--accent);
  margin-left: 36px;
}

@keyframes ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* ---------- Small photo + list icons ---------- */

.photo-small {
  width: 180px;
  aspect-ratio: 1 / 1;
}

.dense li .li-icon {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 3px;
  vertical-align: -5px;
  margin-right: 8px;
}

/* ---------- Custom video covers (no raw YouTube embeds) ---------- */

.video-cover {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 28px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: border-color 0.2s;
}

.video-cover:hover { border-color: var(--accent); }

.vc-meta {
  color: var(--accent);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.vc-title {
  color: var(--bright);
  font-weight: 700;
  font-size: clamp(18px, 2.8vw, 27px);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.vc-sub {
  color: var(--dim);
  font-size: 13px;
  max-width: 60ch;
}

.vc-play {
  position: absolute;
  top: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}

.vc-play::before {
  content: "";
  display: block;
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #ffffff;
  margin-left: 4px;
}

.video-cover:hover .vc-play { transform: scale(1.1); }

/* ---------- Pre-loader ---------- */

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  /* CSS-only fallback: if JS never runs, the loader clears itself. */
  animation: loader-out 2.4s ease forwards;
}

#loader.done {
  animation: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s 0.4s;
}

/* Repeat visits within a session skip the loader entirely
   (flag set pre-paint by theme.js). */
.no-loader #loader { display: none; }

.loader-name {
  font-weight: 700;
  font-size: clamp(24px, 4vw, 36px);
  letter-spacing: -0.02em;
  color: var(--bright);
  min-height: 1.2em;
}

.loader-name .dot { color: var(--accent); }

.loader-bar {
  width: 170px;
  height: 3px;
  background: var(--rule);
  position: relative;
  overflow: hidden;
}

.loader-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-101%);
  animation: loader-fill 1.3s ease 0.1s forwards;
}

@keyframes loader-fill { to { transform: translateX(0); } }

@keyframes loader-out {
  0%, 88% { opacity: 1; }
  100% { opacity: 0; visibility: hidden; }
}

@media (prefers-reduced-motion: reduce) {
  #loader { display: none; }
}

/* ---------- Custom cursor ---------- */

html.has-cursor,
html.has-cursor a,
html.has-cursor button {
  cursor: none;
}

#cursor-dot {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 300;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.15s, height 0.15s;
}

#cursor-ring {
  position: fixed;
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--dim);
  border-radius: 50%;
  pointer-events: none;
  z-index: 299;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: width 0.2s, height 0.2s, border-color 0.2s, opacity 0.2s;
}

html.cursor-hover #cursor-ring {
  width: 52px;
  height: 52px;
  border-color: var(--accent);
}

html.cursor-hover #cursor-dot {
  width: 5px;
  height: 5px;
}

/* ---------- Interactive ASCII portrait ---------- */

#portrait {
  display: block;
  width: 100%;
  max-width: 420px;
  border: 1px solid var(--rule);
  touch-action: pan-y;
}

/* ---------- Reveal-on-load / reveal-on-scroll ---------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--d, 0s);
}

.reveal.in {
  opacity: 1;
  transform: none;
}

main figure.reveal { transform: translateY(14px) scale(0.985); }

main figure.reveal.in { transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- The map (places.html) ---------- */

.map-box {
  border: 1px solid var(--rule);
  background: var(--panel);
  padding: 10px;
  margin-top: 18px;
}

#map {
  width: 100%;
  height: clamp(320px, 52vw, 560px);
}

/* ---------- Kind Words gallery wall ---------- */

.wall {
  columns: 3 260px;
  column-gap: 20px;
}

.wall-item {
  break-inside: avoid;
  margin: 0 0 20px;
  border: 1px solid var(--rule);
  background: var(--panel);
  position: relative;
}

.wall-item img { width: 100%; display: block; }

.wall-item figcaption {
  padding: 10px 14px 12px;
  font-size: 14px;
  color: var(--dim);
}

.wall-item .photo-placeholder { border: 0; }

.wall-tag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 3px 8px;
}

.quote-card {
  border-left: 4px solid var(--accent);
  padding: 6px 0 6px 24px;
  max-width: 75ch;
}

.quote-card blockquote {
  font-size: clamp(17px, 2.4vw, 23px);
  font-weight: 700;
  color: var(--bright);
  line-height: 1.35;
  margin-bottom: 10px;
}

.quote-card cite {
  font-style: normal;
  color: var(--dim);
  font-size: 13px;
}

.wall-quote {
  padding: 26px 22px 20px;
}

.wall-quote blockquote {
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700;
  color: var(--bright);
  line-height: 1.35;
  margin: 18px 0 12px;
}

.wall-quote cite {
  font-style: normal;
  color: var(--dim);
  font-size: 14px;
}

/* ---------- Country tabs + map caption (places) ---------- */

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 26px 0 6px;
}

.tab {
  background: none;
  border: 1px solid var(--rule);
  color: var(--dim);
  font-family: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
}

.tab:hover { color: var(--bright); border-color: var(--bright); }

.tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.tab.surprise { border-style: dashed; color: var(--accent); }

.tab.surprise:hover { border-color: var(--accent); }

#map-caption {
  margin-top: 18px;
  min-height: 1.4em;
}

#map-caption .year { margin-right: 10px; }

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 36px;
  padding-top: 20px;
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
}

.site-footer p { margin-bottom: 4px; }

.site-footer a {
  color: var(--dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover { color: var(--accent); }

/* ---------- Hover link previews ---------- */

#link-preview {
  position: fixed;
  z-index: 60;
  width: 320px;
  height: 200px;
  background: var(--panel);
  border: 1px solid var(--rule);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

#link-preview.show { opacity: 1; transform: none; }

#link-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
  /* Nav becomes one quiet swipeable strip. */
  .site-nav {
    display: flex;
    overflow-x: auto;
    gap: 0 20px;
    padding: 16px 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav ul { display: contents; }
  .site-nav li { flex-shrink: 0; }
  .site-nav a { font-size: 14px; white-space: nowrap; line-height: 1.4; }
  .site-nav a.active { color: var(--accent); }
  .dense { columns: 1; }
  .site-header { flex-wrap: wrap; }
  .video-cover { padding: 18px; }
  .vc-play { top: 18px; right: 18px; width: 44px; height: 44px; }
  .vc-play::before { border-width: 7px 0 7px 12px; }
  #link-preview { display: none; }
  #map { height: 320px; }
}
