/*===================================*\
  Home — Suman Pathak, portfolio
  Literata throughout, navy on white, one tangerine accent.
\*===================================*/

:root {
  --bg: #ffffff;
  --surface: #f5f5f3;
  --ink: #1f2b4d;
  --muted: #5d6479;
  --line: rgba(31, 43, 77, 0.12);
  --accent: #f7941d;
  --accent-hover: #ffa83f;
  --accent-ink: #1f2b4d;
  --navy: #1f2b4d;
  --navy-cell: #2b3a63;
  --navy-cell-focus: #3d4f80;
  --on-navy: #ffffff;
  --on-navy-muted: #c3c9d8;

  --font: 'Literata', Georgia, serif;
  --step-small: clamp(0.875rem, 0.85rem + 0.1vw, 0.9375rem);
  --step-body: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem);
  --step-lead: clamp(1.1875rem, 1.05rem + 0.5vw, 1.4375rem);
  --step-head: clamp(2rem, 1.5rem + 1.8vw, 2.875rem);
  --step-display: clamp(3rem, 2rem + 4.2vw, 5.5rem);

  --container: 1160px;
  --gutter: clamp(20px, 4vw, 40px);
  --nav-h: 72px;
  --radius: 6px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d1220;
  --surface: #141a2d;
  --ink: #e9ecf3;
  --muted: #a4abbf;
  --line: rgba(233, 236, 243, 0.12);
  --navy: #1b2647;
  color-scheme: dark;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-body);
  line-height: 1.6;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul, ol, dl { margin: 0; padding: 0; list-style: none; }
dd { margin: 0; }

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a, button { touch-action: manipulation; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.skip-link {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus-visible { transform: none; }

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

.text-link {
  text-decoration: underline;
  transition: color 0.2s var(--ease);
}
.text-link:hover { color: var(--muted); }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  text-decoration: none;
}
.arrow-link span { transition: transform 0.2s var(--ease); }
.arrow-link:hover span { transform: translateX(4px); }

/* ——— Buttons ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-ink);
  font: 600 var(--step-small)/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.15s var(--ease);
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }
.btn-quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn-quiet:hover { background: var(--surface); border-color: var(--muted); }

/* ===================================
   NAVIGATION
   =================================== */
.top-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  transition: box-shadow 0.25s var(--ease), background-color 0.3s var(--ease);
}
.top-nav.scrolled { box-shadow: 0 1px 0 var(--line); }
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--nav-h);
}
.nav-brand {
  font-size: 1.1875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.nav-actions { display: flex; align-items: center; gap: 28px; }
.nav-links { display: flex; align-items: center; gap: 26px; font-size: var(--step-small); }
.nav-link {
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.nav-links .nav-link:hover { color: var(--muted); }
.nav-link.active { text-decoration: underline; }
.nav-cv { padding: 9px 16px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.theme-toggle:hover { border-color: var(--muted); background: var(--surface); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.hamburger {
  display: none;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: 600 var(--step-small)/1.2 var(--font);
  cursor: pointer;
}
.mobile-drawer { display: none; }

/* ===================================
   HERO
   =================================== */
.hero { padding: 72px 0 104px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: clamp(40px, 6vw, 88px);
  align-items: center;
}
.hero-role {
  font-size: var(--step-lead);
  font-style: italic;
  color: var(--muted);
}
.hero-name {
  margin-top: 10px;
  font-size: var(--step-display);
  line-height: 1;
  letter-spacing: -0.03em;
}
.hero-lead {
  margin-top: 28px;
  max-width: 34em;
  font-size: var(--step-lead);
  line-height: 1.5;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 36px;
}
.copy-email {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--step-small);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}
.hero-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.hero-facts dt { font-size: var(--step-small); color: var(--muted); }
.hero-facts dd { margin-top: 4px; font-size: var(--step-small); font-weight: 500; line-height: 1.4; }
.hero-portrait img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 22%;
  border-radius: var(--radius);
  background: var(--surface);
}

/* ===================================
   SECTIONS
   =================================== */
.section { padding: 112px 0; }
.section-alt { background: var(--surface); }
.section-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px 32px;
  margin-bottom: 56px;
}
.section-head h2 { font-size: var(--step-head); }
.section-intro { margin-top: 14px; max-width: 40em; color: var(--muted); }

/* ——— Currently ——— */
.now-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 96px);
}
.now-grid .section-head { margin-bottom: 0; display: block; }
.now-items { display: grid; gap: 40px; }
.now-item { padding-top: 24px; border-top: 1px solid var(--line); }
.now-item h3 { font-size: var(--step-lead); }
.now-meta { margin-top: 4px; font-size: var(--step-small); color: var(--muted); }
.now-item p:last-child { margin-top: 14px; }

/* ——— Research spotlight: the calculator ——— */
.calc {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  padding: clamp(32px, 5vw, 64px);
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--on-navy);
}
.calc h2 { font-size: var(--step-head); }
.calc-lede { margin-top: 18px; }
.calc-note { margin-top: 24px; font-size: var(--step-small); color: var(--on-navy-muted); }
.calc-number {
  font-size: var(--step-display);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.calc-unit { display: block; margin-top: 8px; font-size: var(--step-lead); }
.calc-verdict { margin-top: 16px; }
.calc-verdict strong { color: var(--accent); font-weight: 600; }
.calc-controls { display: grid; gap: 24px; margin-top: 36px; }
.calc-control label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: var(--step-small);
}
.calc-control output { font-weight: 600; font-variant-numeric: tabular-nums; }
.calc-control input[type="range"] {
  width: 100%;
  margin: 12px 0 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ——— Work ——— */
.featured {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}
.project {
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 3vw, 40px);
  border-radius: var(--radius);
  background: var(--surface);
}
.project-tag { font-size: var(--step-small); color: var(--muted); }
.project h3 { margin-top: 12px; font-size: var(--step-lead); }
.project-desc { margin-top: 14px; flex: 1; }
.project-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.project-meta dt { font-size: var(--step-small); color: var(--muted); }
.project-meta dd { margin-top: 2px; font-size: var(--step-small); font-weight: 500; }
.project .arrow-link { margin-top: 24px; align-self: flex-start; }

.earlier { margin-top: 88px; }
.earlier-head h3 { font-size: var(--step-lead); }
.earlier-head p { margin-top: 8px; color: var(--muted); max-width: 40em; }
.earlier-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(32px, 5vw, 72px);
  margin-top: 32px;
  align-items: start;
}
.ledger li + li { border-top: 1px solid var(--line); }
.ledger .row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 9rem 7rem;
  align-items: baseline;
  gap: 16px;
  padding: 16px 0;
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
.row-kind, .row-where { font-size: var(--step-small); color: var(--muted); }
.row-where { text-align: right; }
.ledger .row:hover .row-name,
.ledger .row:focus-visible .row-name,
.ledger .row.is-current .row-name { text-decoration: underline; }
.preview {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
}
.preview-frame {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius);
  background: #ffffff;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--line);
}
.preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 6%;
  transition: opacity 0.25s var(--ease);
}
.preview-frame img.is-swapping { opacity: 0; }
.preview figcaption { margin-top: 12px; font-size: var(--step-small); color: var(--muted); }

.work-more { margin-top: 48px; }

/* ——— Experience & education ——— */
.timeline-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(40px, 6vw, 96px);
}
.timeline-grid > div > h3 { font-size: var(--step-lead); margin-bottom: 8px; }
.timeline li { padding: 24px 0; border-top: 1px solid var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.tl-date { font-size: var(--step-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.timeline h4 { margin-top: 4px; font-size: var(--step-body); font-weight: 600; letter-spacing: 0; }
.tl-org { font-size: var(--step-small); color: var(--muted); }
.timeline p:last-child { margin-top: 10px; }

/* ——— Skills ——— */
.skills-list > div {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 16px 32px;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}
.skills-list > div:last-child { border-bottom: 1px solid var(--line); }
.skills-list dt { font-weight: 600; }

/* ——— Writing ——— */
.article-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  text-decoration: none;
}
.article-feature img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: var(--radius);
}
.article-meta { font-size: var(--step-small); color: var(--muted); }
.article-feature h3 { margin-top: 10px; font-size: var(--step-head); }
.article-feature p.excerpt { margin-top: 16px; }
.article-feature .arrow-link { margin-top: 20px; }
.article-feature:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; }

.article-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(32px, 5vw, 72px);
  margin-top: 64px;
}
.article-list li { border-top: 1px solid var(--line); }
.article-list a { display: block; padding: 22px 0; text-decoration: none; }
.article-list h4 { margin-top: 6px; font-size: var(--step-body); font-weight: 600; letter-spacing: 0; }
.article-list p.desc { margin-top: 6px; font-size: var(--step-small); color: var(--muted); }
.article-list a:hover h4 { text-decoration: underline; }
.writing-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  font-size: var(--step-small);
  color: var(--muted);
}

/* ——— Photography ——— */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.photo-grid a {
  display: block;
  overflow: hidden;
  border-radius: var(--radius);
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.photo-grid a:hover img { transform: scale(1.03); }

/* ——— Contact ——— */
.contact {
  background: var(--navy);
  color: var(--on-navy);
}
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(40px, 6vw, 96px);
}
.contact h2 { font-size: var(--step-head); }
.contact-lede { margin-top: 16px; color: var(--on-navy-muted); }
.contact-details { margin-top: 36px; display: grid; gap: 18px; }
.contact-details dt { font-size: var(--step-small); color: var(--on-navy-muted); }
.contact-details dd { margin-top: 2px; }
.contact-details a { text-decoration: none; }
.contact-details a:hover { text-decoration: underline; }
.contact-details .copy-email { margin-top: 4px; color: var(--on-navy-muted); }
.socials { display: flex; flex-wrap: wrap; gap: 8px 20px; }

.contact-form { display: grid; gap: 12px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field label { display: block; margin-bottom: 6px; font-size: var(--step-small); color: var(--on-navy-muted); }
.form-input {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  background: var(--navy-cell);
  color: var(--on-navy);
  font: inherit;
  padding: 14px 16px;
  transition: background-color 0.2s var(--ease);
}
.form-input::placeholder { color: rgba(255, 255, 255, 0.55); }
.form-input:focus { outline: none; background: var(--navy-cell-focus); }
.form-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
textarea.form-input { min-height: 170px; resize: vertical; }
.form-btn { justify-self: start; margin-top: 8px; padding: 14px 28px; }
.form-btn:disabled { cursor: not-allowed; background: #c9b79e; }
.form-status-msg { display: none; padding: 14px 18px; border-radius: var(--radius); font-size: var(--step-small); }
.form-status-msg.success { display: block; background: #e6f4ea; color: #14532d; }
.form-status-msg.error { display: block; background: #fdecea; color: #7f1d1d; }
.form-status-msg a { color: inherit; }
.form-spinner { display: none; }

/* ——— Footer ——— */
.site-footer { padding: 40px 0; }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px 32px;
  font-size: var(--step-small);
  color: var(--muted);
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--ink); text-decoration: underline; }

/* Copy toast (floats above the page) */
.toast-notice {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 300;
  display: flex;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--bg);
  font-size: var(--step-small);
  box-shadow: 0 10px 30px rgba(5, 7, 10, 0.25);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
  pointer-events: none;
}
.toast-notice.show { opacity: 1; transform: none; }
.toast-notice ion-icon { display: none; }

/* ===================================
   ENTRANCES (only when the script runs)
   =================================== */
.js [data-enter] {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.js .is-in [data-enter] { opacity: 1; transform: none; }

/* ===================================
   TABLET
   =================================== */
@media (max-width: 1080px) {
  .nav-links { gap: 18px; }
  .nav-actions { gap: 18px; }
}

@media (max-width: 960px) {
  .nav-links, .nav-cv { display: none; }
  .hamburger { display: inline-flex; }
  .mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 150;
    flex-direction: column;
    gap: 4px;
    padding: 96px var(--gutter) 24px;
    background: var(--bg);
    color: var(--ink);
    font-size: var(--step-head);
  }
  .mobile-drawer.open { display: flex; }
  .mobile-drawer .nav-link { padding: 6px 0; }
  .drawer-close { position: absolute; top: 16px; right: var(--gutter); }

  .hero { padding: 40px 0 80px; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-portrait { order: -1; max-width: 340px; }

  .now-grid,
  .calc,
  .earlier-grid,
  .timeline-grid,
  .contact-grid,
  .article-feature { grid-template-columns: 1fr; }
  .preview { display: none; }
  .featured { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ===================================
   PHONE
   =================================== */
@media (max-width: 640px) {
  :root { --nav-h: 64px; }
  .section { padding: 80px 0; }
  .section-head { margin-bottom: 40px; }
  .hero-facts { grid-template-columns: 1fr; gap: 16px; }
  .project-meta { grid-template-columns: 1fr 1fr; }
  .ledger .row { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 16px; }
  .row-kind { grid-column: 1; grid-row: 2; }
  .row-where { grid-column: 2; grid-row: 1; }
  .skills-list > div { grid-template-columns: 1fr; gap: 6px; }
  .article-list { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .form-btn { justify-self: stretch; }
}

/* ===================================
   REDUCED MOTION
   =================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-enter] { transform: none; transition: opacity 0.3s linear; }
  .photo-grid img, .arrow-link span { transition: none; }
}
