/* ==========================================================================
   Venkatesh Patil — monochrome, mobile-first
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin-var.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* Black background, warm ivory text — same for every visitor */
  --bg: #000000;
  --fg: #f0eee6;
  --muted: #b0aea5;
  --line: #2e2d2b;
  --card: #141413;
  --btn-fg: #000000;

  --radius: 14px;
  --gutter: 16px;
  --max: 1080px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

/* Light theme (opt-in via the top-right toggle) — warm ivory */
:root[data-theme="light"] {
  --bg: #f0eee6;
  --fg: #1f1e1d;
  --muted: #5e5d59;
  --line: #d1cfc5;
  --card: #faf9f5;
  --btn-fg: #faf9f5;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none; /* no page bounce (iOS) while swiping between sections */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Exactly one screen tall: sections scroll inside themselves if they're taller */
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ---------- Deck: full-width sections side by side, swipe/scroll right ---------- */
.deck-wrap {
  position: relative;
  flex: 1;
  display: flex;
  min-height: 0;
  padding-top: 64px; /* clear the floating top bar */
}

.deck {
  position: relative; /* offsetLeft of sections is measured from here */
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory; /* no-JS fallback: native swipe + snap */
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.deck::-webkit-scrollbar { display: none; }
/* With JS, swipes are handled in main.js: a short swipe moves exactly one section */
.js .deck {
  overflow-x: hidden;
  scroll-snap-type: none;
  touch-action: pan-y pinch-zoom; /* vertical scroll + zoom stay native */
}
.view {
  flex: 0 0 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.view > .container { margin-block: auto; } /* centre vertically, but stay scrollable if tall */


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

a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.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;
  user-select: none;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--fg);
  color: var(--bg);
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Top-right theme toggle (no nav bar; takes no layout space) ---------- */
.top-actions {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 10;
  pointer-events: none; /* only the button itself is clickable */
}
.top-actions-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding-top: 16px;
}
.top-actions .view-nav { grid-column: 2; pointer-events: auto; }
.top-actions .theme-toggle { grid-column: 3; justify-self: end; pointer-events: auto; }

/* Home | Contact | Experience — segmented pill */
.view-nav {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.view-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.view-tab:hover { color: var(--fg); }
.view-tab[aria-current="page"] { background: var(--fg); color: var(--btn-fg); }

/* ---------- Card contents ---------- */
.section {
  width: 100%;
  padding-block: clamp(16px, 4vw, 32px);
  text-align: center;
}
.section-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.section-title {
  margin: 0 0 8px;
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}
.section-title:focus { outline: none; }

/* Experience timeline — newest at the top, read bottom → up.
   Filled node = ongoing (tl-item--current); hollow node = ended. */
.timeline {
  position: relative;
  max-width: 560px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}
.tl-item {
  position: relative;
  padding-left: 30px;
}
.tl-item + .tl-item { margin-top: 18px; }

/* Rail segment from this item's node down to the next (older) item's node */
.tl-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 12px;
  bottom: -30px; /* 18px gap + 12px to the next node's centre */
  width: 2px;
  background: var(--line);
  transform-origin: bottom; /* draws upward */
}
/* Segments draw one after another from the oldest (bottom) up */
.view.is-active .tl-item:not(:last-child)::before { animation: rail-draw 0.45s ease-out both; }
.view.is-active .tl-item:nth-last-child(2)::before { animation-delay: 0.1s; }
.view.is-active .tl-item:nth-last-child(3)::before { animation-delay: 0.4s; }
.view.is-active .tl-item:nth-last-child(4)::before { animation-delay: 0.7s; }
.view.is-active .tl-item:nth-last-child(5)::before { animation-delay: 1s; }
.view.is-active .tl-item:nth-last-child(6)::before { animation-delay: 1.3s; }
@keyframes rail-draw { from { transform: scaleY(0); } }

.tl-date {
  position: relative;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 24px;
  color: var(--muted);
}
.tl-date::before {
  content: "";
  position: absolute;
  left: -30px;
  top: 50%;
  translate: 0 -50%;
  width: 16px;
  height: 16px;
  border: 2px solid var(--fg);
  border-radius: 50%;
  background: var(--bg);
  box-sizing: border-box;
}
.tl-item--current .tl-date::before { background: var(--fg); }

.tl-card {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
}
/* Scales with screen width so each line stays on one line on phones */
.tl-title { margin: 0; font-size: clamp(0.75rem, 3.45vw, 1.05rem); font-weight: 600; line-height: 1.35; }
.tl-sub { margin: 2px 0 0; font-size: clamp(0.72rem, 3.3vw, 0.95rem); color: var(--muted); }
.tl-meta { margin: 2px 0 0; font-size: clamp(0.68rem, 3.1vw, 0.85rem); color: var(--muted); opacity: 0.8; }

/* ---------- Hero ---------- */
.hero {
  width: 100%;
  padding-block: clamp(28px, 6vw, 56px);
  text-align: center;
}

/* Profile photo */
.portrait-wrap {
  width: clamp(168px, 46vw, 240px);
  margin: 0 auto clamp(24px, 5vw, 36px);
}

.portrait {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1); /* keeps it monochrome even if the source is swapped */
}

.hero-title {
  margin: 0;
  font-size: clamp(2.6rem, 9vw, 4.5rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.hero-heading {
  display: inline-grid;
  justify-items: center;
  max-width: 100%;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 12px 22px;
  border: 1.5px solid var(--fg);
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, color 0.2s ease;
}
.btn:active { transform: translateY(1px); }

/* ---------- Theme toggle: moon <-> sun morph ---------- */
/* Theme toggle: round button in the top-right corner */
.theme-toggle {
  display: none; /* needs JS */
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--fg) 35%, var(--bg)); /* ≥3:1 against the page */
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: border-color 0.2s ease, scale 0.2s ease;
}
.js .theme-toggle { display: inline-grid; }
.theme-toggle:hover { border-color: var(--fg); }
.theme-toggle:active { scale: 0.94; }

.theme-icon { width: 22px; height: 22px; overflow: visible; }

.theme-core,
.theme-moon-cut,
.theme-rays {
  transform-origin: center;
  transition: transform 0.5s cubic-bezier(0.5, 1.4, 0.5, 1), opacity 0.3s ease;
}
.theme-core,
.theme-moon-cut { transform-box: fill-box; }
.theme-rays { transform-box: view-box; }

/* Dark (default): big crescent moon, rays tucked away */
.theme-rays { opacity: 0; transform: rotate(-90deg) scale(0.5); }

/* Light: small sun core, moon shadow slides off, rays spin in */
[data-theme="light"] .theme-core { transform: scale(0.53); }
[data-theme="light"] .theme-moon-cut { transform: translate(9px, -9px); }
[data-theme="light"] .theme-rays { opacity: 1; transform: rotate(0deg) scale(1); }

/* Circular reveal when switching (View Transitions API) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

.btn-primary { background: var(--fg); color: var(--btn-fg); }
.btn-primary:hover { background: color-mix(in srgb, var(--fg) 82%, var(--bg)); }

.btn-secondary { background: transparent; color: var(--fg); }
.btn-secondary:hover { background: var(--fg); color: var(--btn-fg); }

.btn-block { width: 100%; }

/* ---------- Dialogs (Contact, Privacy) ---------- */
html:has(.modal[open]) { overflow: hidden; }

.modal {
  width: min(calc(100% - 32px), 400px);
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--fg);
  box-shadow: 0 24px 64px rgb(0 0 0 / 0.25);
  overflow: auto;
  outline: none;
}
.modal::backdrop {
  background: rgb(0 0 0 / 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal[open] { animation: dialog-in 0.22s ease-out; }
.modal[open]::backdrop { animation: fade-in 0.22s ease-out; }

.modal--wide { width: min(calc(100% - 32px), 520px); }

.modal--wide .dialog-body {
  align-items: stretch;
  text-align: left;
}
.modal--wide .dialog-header { justify-content: flex-start; }
.modal--wide .dialog-title { padding-inline: 0 44px; }

.prose { font-size: 0.95rem; color: var(--muted); }
.prose p { margin: 0 0 12px; }
.prose a { color: var(--fg); }
.prose .updated { font-size: 0.8rem; }

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
}
@keyframes fade-in { from { opacity: 0; } }

.dialog-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px 20px 28px;
  text-align: center;
}

/* Title row: the close button is vertically centered on the title */
.dialog-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
}

.dialog-close {
  position: absolute;
  top: 50%;
  right: -8px;
  translate: 0 -50%;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.dialog-close:hover { background: var(--line); color: var(--fg); }
.dialog-close .icon { width: 20px; height: 20px; stroke-width: 2.75; }

.dialog-title {
  margin: 0;
  padding-inline: 44px; /* keep clear of the close button */
  line-height: 1.2;
  font-size: clamp(1.4rem, 5vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Segmented toggle — hidden without JS, where both panels show stacked */
.segmented {
  display: none;
  width: 100%;
  max-width: 240px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
}
.js .segmented { display: flex; }

.segment {
  flex: 1;
  min-height: 44px;
  padding: 8px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.segment:hover { color: var(--fg); }
.segment[aria-selected="true"] { background: var(--fg); color: var(--btn-fg); }

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}
.qr-panel[hidden] { display: none; }

.qr-panels { display: contents; }

/* QR always black-on-white for scan reliability, even in dark mode */
.qr-tile {
  width: 100%;
  max-width: 240px;
  padding: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.qr-tile img { width: 100%; image-rendering: pixelated; }

.qr-caption {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.qr-panel .btn-block { max-width: 240px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  font-size: 0.875rem;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0 16px;
  padding-block: 10px;
  text-align: center;
}
.footer-inner p { margin: 0; }

.footer-link {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--muted);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
}
.footer-link:hover { color: var(--fg); }

/* ---------- Reveal motion ---------- */
/* Pure CSS entrance on load — no JS needed, so content can never get stuck hidden */
.reveal { animation: rise-in 0.6s ease-out both; }
.hero-heading .reveal:nth-child(1) { animation-delay: 0.08s; }
.hero-heading .reveal:nth-child(2) { animation-delay: 0.16s; }

@keyframes rise-in {
  from { opacity: 0; transform: translateY(14px); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .view.is-active .tl-item::before { animation: none !important; }
  .btn, .segment, .view-tab, .dialog-close, .theme-toggle, .theme-core, .theme-moon-cut, .theme-rays { transition: none; }
  .modal[open], .modal[open]::backdrop { animation: none; }
}

/* ---------- Tablet & up ---------- */
@media (min-width: 720px) {
  :root { --gutter: 32px; }
  .dialog-body { padding: 28px 32px 32px; }
  .tl-card { padding: 14px 20px; }

  /* Desktop experience timeline: date | rail + node | card, one row per entry */
  .timeline { max-width: 720px; }
  .tl-item {
    display: grid;
    grid-template-columns: 170px 1fr;
    column-gap: 44px;
    align-items: start;
    padding-left: 0;
  }
  .tl-date { padding-top: 14px; text-align: right; white-space: nowrap; }
  .tl-date::before { left: auto; right: -30px; top: 26px; } /* node centred in the 44px gap */
  .tl-card { margin-top: 0; }
  .tl-item:not(:last-child)::before { left: 191px; top: 26px; bottom: -44px; } /* 18px gap + 26px */

  /* Desktop contact: both QR codes side by side, no toggle */
  .contact-view .segmented { display: none; }
  .qr-panels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    max-width: 600px;
  }
  .qr-panels .qr-panel { padding-inline: 20px; }
  .qr-panels .qr-panel + .qr-panel { border-left: 1px solid var(--line); }
  .qr-panels .qr-panel[hidden] { display: flex; }
  .top-actions-inner { padding-top: 28px; }
  .deck-wrap { padding-top: 84px; }
  .view-tab { padding: 6px 18px; font-size: 0.9rem; }

  .footer-inner { justify-content: space-between; padding-block: 16px; }
}

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  :root { --gutter: 40px; }
}
