/* ============================================================
   Swayam Desai — portfolio
   Editorial light. Newsreader display / Inter text / JetBrains Mono data.
   Hierarchy comes from type and rules. No gradients, no glow.
   ============================================================ */

:root {
  /* Surfaces — warm paper, one step of elevation */
  --paper:     #EDEAE3;
  --paper-2:   #E4E0D7;
  --card:      #FCFCFB;
  --card-2:    #F7F5F0;

  /* Ink */
  --ink:       #16181B;
  --ink-2:     #3A3F45;
  --ink-3:     #5F666E;
  --muted:     #838A92;

  /* Rules */
  --rule:      rgba(22, 24, 27, 0.14);
  --rule-soft: rgba(22, 24, 27, 0.09);
  --rule-hard: rgba(22, 24, 27, 0.26);

  /* elevation — two layers, both tuned warm so cards read as paper */
  --lift-1: 0 1px 1px rgba(28, 24, 16, 0.05), 0 2px 6px -2px rgba(28, 24, 16, 0.07);
  --lift-2: 0 2px 3px rgba(28, 24, 16, 0.06), 0 14px 28px -12px rgba(28, 24, 16, 0.16);

  /* One accent — deep ink blue. Links, marks, hover. Nothing decorative. */
  --accent:      #1D3F73;
  --accent-2:    #2C5794;
  --accent-wash: rgba(29, 63, 115, 0.06);
  --accent-line: rgba(29, 63, 115, 0.28);
  --pos:         #1C5F45;   /* a passing gate, a win row */

  /* Type */
  --display: "Newsreader", Iowan Old Style, Georgia, "Times New Roman", serif;
  --sans:    "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Measure & rhythm */
  --maxw:   1080px;
  --prose:  68ch;
  --gutter: clamp(22px, 5vw, 56px);
  --sp-section: clamp(64px, 9vh, 116px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  font-feature-settings: "kern" 1, "liga" 1, "cv11" 1;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
::selection { background: rgba(29, 63, 115, 0.14); }

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

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

.section { padding: var(--sp-section) 0; }

/* ---------- Type ---------- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 400;
  font-optical-sizing: auto;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.012em;
}

h1 {
  font-size: clamp(38px, 5.6vw, 66px);
  line-height: 1.04;
  letter-spacing: -0.022em;
}

h2 {
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.16;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
}

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

strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--paper-2);
  border: 1px solid var(--rule-soft);
  border-radius: 3px;
  padding: 0.1em 0.34em;
}

.lede {
  font-family: var(--display);
  font-size: clamp(19px, 2vw, 23px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 62ch;
}

.muted { color: var(--muted); }

.accent-text {
  color: var(--ink);
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 1px;
}

/* Small mono label — the only "chrome" in the system */
.eyebrow,
.label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.25s var(--ease);
}
.nav.scrolled { border-bottom-color: var(--rule); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 68px;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--display);
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand .mark {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 3px 5px;
  line-height: 1;
}
.brand .dot { color: var(--accent); }
.brand > span:last-child { white-space: nowrap; }

@media (max-width: 560px) {
  .brand > span:last-child { display: none; }
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
  flex: none;
  font-size: 14.5px;
  color: var(--ink-2);
}
.nav-links a { position: relative; padding: 4px 0; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s var(--ease);
}
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.nav-cta {
  color: var(--paper);
  background: var(--ink);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13.5px;
}
.nav-links a.nav-cta::after { display: none; }
.nav-links a.nav-cta:hover { background: var(--accent); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 7px;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle svg { width: 20px; height: 20px; }

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 68px; left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px var(--gutter) 20px;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 8px 0; font-size: 16px; }
}

/* ---------- Track switcher ----------
   Two portfolios, one design. Reads as deliberate specialisation, so it is a
   segmented control rather than a stray link.
   ------------------------------------ */

.track-switch {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  margin-right: auto;
  margin-left: 8px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 999px;
}
.track-opt {
  display: inline-flex;
  align-items: center;
  padding: 6px 13px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.track-opt:hover { color: var(--ink); }
.track-opt.is-on {
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--lift-1);
}

.track-switch.in-menu { display: none; }

@media (max-width: 720px) {
  /* the control moves into the menu panel, where there is room for it */
  .nav-inner > .track-switch { display: none; }
  .track-switch.in-menu {
    display: inline-flex;
    margin: 4px 0 14px;
    padding: 3px;
    gap: 3px;
    max-width: 100%;
  }
  .track-opt {
    font-size: 10px;
    letter-spacing: 0.06em;
    padding: 8px 12px;
  }
}

/* ---------- Buttons / links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; }

.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); }

.btn-ghost { border-color: var(--rule-hard); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.link-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  font-size: 14.5px;
  color: var(--ink-2);
}
.link-list a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}
.link-list a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.link-list svg { width: 15px; height: 15px; }

/* ---------- Hero ---------- */

.hero { padding-top: clamp(56px, 10vh, 104px); }

.hero h1 { max-width: 22ch; }

.hero-sub {
  margin-top: 26px;
  max-width: var(--prose);
  font-size: 17.5px;
  line-height: 1.7;
  color: var(--ink-2);
}

.hero-actions {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
}

.availability {
  margin-top: 38px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.availability span { padding-right: 22px; margin-right: 22px; border-right: 1px solid var(--rule); }
.availability span:last-child { border-right: 0; padding-right: 0; margin-right: 0; }
@media (max-width: 720px) {
  .availability span { border-right: 0; padding-right: 0; margin-right: 0; flex: 1 1 100%; }
}
.availability b { color: var(--ink); font-weight: 500; }

/* ---------- Section heads ---------- */

.section-head {
  display: grid;
  gap: 14px;
  padding-bottom: 34px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 8px;
}
.section-head p {
  max-width: var(--prose);
  color: var(--ink-2);
  margin: 0;
}

/* ---------- Flashcards ----------
   Front carries the claim, back carries the evidence. Both faces occupy one
   grid cell so the card keeps a fixed shape and nothing is ever clipped.
   -------------------------------- */

.fc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 44px;
}
@media (max-width: 1000px) { .fc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.flashcard {
  aspect-ratio: 3 / 4;
  perspective: 1700px;
}

.fc-inner {
  display: grid;
  grid-template-areas: "face";
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.68s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}
.flashcard.flipped .fc-inner { transform: rotateY(180deg); }

.fc-face {
  grid-area: face;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 22px 18px;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--lift-1);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: box-shadow 0.24s var(--ease), border-color 0.24s var(--ease), transform 0.24s var(--ease);
}
.fc-back {
  transform: rotateY(180deg);
  background: var(--card-2);
}

.flashcard:hover .fc-front,
.flashcard:hover .fc-back { box-shadow: var(--lift-2); border-color: var(--rule-hard); }
.flashcard:hover .fc-front { transform: translateY(-3px); }
@media (prefers-reduced-motion: reduce) { .flashcard:hover .fc-front { transform: none; } }

.flashcard.flipped .fc-front { pointer-events: none; }
.flashcard:not(.flipped) .fc-back { pointer-events: none; }

/* --- header strip: index + domain, the catalogue-card cue --- */

.fc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 20px;
  min-height: 34px;
}
.fc-index {
  flex: none;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--paper);
  background: var(--ink);
  border-radius: 3px;
  padding: 4px 6px;
  line-height: 1;
  transition: background 0.24s var(--ease);
}
.flashcard:hover .fc-index { background: var(--accent); }
.fc-kind {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1.45;
}

/* --- front --- */

.fc-body { position: relative; z-index: 1; }
.fc-front .fc-body { margin-bottom: auto; }

.flashcard h3 {
  font-size: clamp(20px, 1.65vw, 24px);
  line-height: 1.18;
  letter-spacing: -0.016em;
  transition: color 0.24s var(--ease);
}
.flashcard:hover h3 { color: var(--accent); }

.fc-short {
  margin: 12px 0 0;
  font-size: 14.5px;
  line-height: 1.56;
  color: var(--ink-3);
}

/* the big ghost numeral: index-card furniture, and it fills the dead space */
.fc-ghost {
  position: absolute;
  right: 14px;
  bottom: -8px;
  font-family: var(--display);
  font-size: 96px;
  line-height: 1;
  font-weight: 400;
  color: var(--ink);
  opacity: 0.035;
  pointer-events: none;
  user-select: none;
  letter-spacing: -0.04em;
}

.fc-flip {
  position: relative;
  z-index: 1;
  margin-top: 16px;
  padding: 0;
  background: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  width: max-content;
  transition: color 0.22s var(--ease), gap 0.22s var(--ease);
}
.fc-flip svg { width: 15px; height: 15px; }
.flashcard:hover .fc-flip { color: var(--accent); gap: 12px; }

/* --- back --- */

.fc-return {
  margin-left: auto;
  padding: 0;
  background: none;
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.22s var(--ease);
}
.fc-return:hover { color: var(--ink); }
.fc-return svg { width: 14px; height: 14px; }

.fc-back .fc-head { margin-bottom: 16px; }

.fc-detail {
  margin: 0;
  font-size: 13.6px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* results: micro-label above the number, so a long label never fights the
   value for the same line */
.fc-figs {
  display: grid;
  gap: 0;
  margin: 16px 0 0;
  border-top: 1px solid var(--rule);
}
.fc-figs .fig {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.fc-figs dt {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.4;
  color: var(--muted);
}
.fc-figs dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--ink);
}

.fc-foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}
.fc-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.6px;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--accent-line);
  padding-bottom: 3px;
  transition: color 0.2s var(--ease), gap 0.2s var(--ease);
}
.fc-cta:hover { color: var(--accent); gap: 11px; }
.fc-cta svg { width: 14px; height: 14px; }

.fc-src {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.07em;
  color: var(--muted);
  white-space: nowrap;
}
.fc-src:hover { color: var(--ink); }
.fc-src svg { width: 13px; height: 13px; }

/* reduced motion: cross-fade the faces instead of rotating */
@media (prefers-reduced-motion: reduce) {
  .fc-inner, .flashcard.flipped .fc-inner { transform: none; transition: none; }
  .fc-face { backface-visibility: visible; -webkit-backface-visibility: visible; }
  .fc-back { transform: none; opacity: 0; visibility: hidden; }
  .flashcard.flipped .fc-front { opacity: 0; visibility: hidden; }
  .flashcard.flipped .fc-back { opacity: 1; visibility: visible; }
}

/* phones: no flip, the evidence opens under the claim inside one card */
@media (max-width: 700px) {
  .fc-grid { grid-template-columns: 1fr; gap: 16px; margin-top: 32px; }
  .flashcard { aspect-ratio: auto; perspective: none; }
  .fc-inner {
    grid-template-areas: "front" "back";
    transform: none !important;
    transform-style: flat;
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: 10px;
    box-shadow: var(--lift-1);
    overflow: hidden;
  }
  .fc-face {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    transform: none !important;
    backface-visibility: visible;
    -webkit-backface-visibility: visible;
    overflow: visible;
    padding: 20px 22px;
  }
  .fc-front { grid-area: front; }
  .fc-back { grid-area: back; display: none; padding-top: 0; }
  .flashcard.flipped .fc-back { display: flex; }
  .flashcard.flipped .fc-front { pointer-events: auto; }
  .flashcard:not(.flipped) .fc-back { pointer-events: auto; }
  .flashcard:hover .fc-front { transform: none; }
  .fc-back .fc-head { display: none; }
  .fc-ghost { font-size: 92px; bottom: -10px; }
  .fc-detail { font-size: 15px; padding-top: 18px; border-top: 1px solid var(--rule); }
  .fc-figs dt, .fc-figs dd { font-size: 13.5px; }
  .fc-cta { font-size: 14.5px; }
  .fc-flip svg { transition: transform 0.25s var(--ease); }
  .flashcard.flipped .fc-flip svg { transform: rotate(180deg); }
}

/* ---------- Capabilities ---------- */

.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0 48px;
  margin-top: 34px;
}

.cap-row {
  display: grid;
  gap: 7px;
  padding: 22px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.cap-row dt {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.cap-row dd {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-2);
}

/* ---------- About ---------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 17rem;
  gap: 56px;
  align-items: start;
}
@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
}

.about-body {
  max-width: var(--prose);
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink-2);
}
.about-body p + p { margin-top: 1.05em; }

.facts { display: grid; }
.fact {
  display: grid;
  gap: 4px;
  padding: 16px 0;
  border-top: 1px solid var(--rule-soft);
}
.fact:first-child { border-top: 0; padding-top: 0; }
.fact .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.fact .v { font-size: 15px; color: var(--ink-2); }

/* ---------- Contact ---------- */

.contact-block {
  padding-top: 44px;
  border-top: 1px solid var(--rule);
}
.contact-block h2 { max-width: 24ch; }
.contact-block p {
  margin-top: 16px;
  max-width: var(--prose);
  color: var(--ink-2);
}
.contact-actions {
  margin-top: 30px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  align-items: center;
}

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

.footer {
  border-top: 1px solid var(--rule);
  padding: 26px 0 40px;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.footer-inner a:hover { color: var(--ink); }

/* ---------- Reveal (one subtle fade, nothing more) ---------- */

.reveal { opacity: 0; transform: translateY(10px); transition: opacity 0.5s var(--ease), transform 0.5s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
