/* ==========================================================================
   Swapneel Wagholikar — portfolio
   Single page, no JS. Light/dark via prefers-color-scheme.
   ========================================================================== */

/* ---------------------------------------------------------------- Tokens -- */

:root {
  --bg: #fbfbfa;
  --bg-raised: #ffffff;
  --bg-sunken: #f2f2f0;
  --ink: #1c1d1f;
  --ink-soft: #4a4d52;
  --ink-faint: #74787e;
  --rule: #e2e2df;
  --rule-strong: #cfcfcb;
  --accent: #1f5f8b;
  --accent-hover: #2d7fb8;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --measure: 68ch;
  --page: 62rem;
  --gap: clamp(1rem, 3vw, 2rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181b;
    --bg-raised: #1d2024;
    --bg-sunken: #121417;
    --ink: #e8e9ea;
    --ink-soft: #b3b7bd;
    --ink-faint: #888d94;
    --rule: #2b2f34;
    --rule-strong: #3a3f45;
    --accent: #6fb3e0;
    --accent-hover: #96cbee;
  }
}

/* ----------------------------------------------------------------- Reset -- */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

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

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.011em;
}

p {
  margin: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--rule-strong);
  border-radius: 6px;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}

.site-nav {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0.7rem var(--gap);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.site-nav__brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  border: 1.5px solid var(--rule-strong);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
  font-size: 0.85rem;
  flex: none;
}

.site-nav__brand:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: var(--accent);
}

.site-nav__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.15rem;
  margin: 0;
  padding: 0;
  font-size: 0.925rem;
}

.site-nav__list a {
  color: var(--ink-soft);
}

.site-nav__list a:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav__cta {
  margin-left: auto;
  flex: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
}

.site-nav__cta:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

/* Nav collapses to brand + résumé on very small screens. */
@media (max-width: 34rem) {
  .site-nav__list {
    display: none;
  }
}

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

.hero {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 4.5rem) var(--gap) clamp(1.5rem, 4vw, 2.5rem);
  display: flex;
  gap: clamp(1.5rem, 5vw, 3.5rem);
  align-items: center;
  flex-wrap: wrap-reverse;
}

.hero__body {
  flex: 1 1 22rem;
  min-width: 0;
}

.hero__name {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.1rem);
  letter-spacing: -0.025em;
  font-weight: 700;
}

.hero__intro {
  margin-top: 1.15rem;
  max-width: var(--measure);
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: justify;
  hyphens: auto;
  hyphenate-limit-chars: 12 5 5;
}

.hero__links {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.65rem;
  font-size: 0.925rem;
  font-weight: 550;
}

.hero__links a {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--ink-soft);
}

.hero__links a:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.hero__portrait {
  flex: 0 0 auto;
}

/* Portrait is 275x372. A circle with object-fit:cover cropped it hard, so this
   frames the whole image at its native aspect instead. */
.hero__portrait img {
  width: clamp(12rem, 30vw, 20rem);
  height: auto;
  aspect-ratio: 275 / 372;
  object-fit: contain;
  border-radius: 14px;
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
}

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

.section {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(2.25rem, 5vw, 3.5rem) var(--gap);
  border-top: 1px solid var(--rule);
}

.section__title {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 1.75rem;
}

.section__title--small {
  margin-bottom: 1rem;
}

.section__lede {
  margin-top: -1rem;
  margin-bottom: 1.75rem;
  color: var(--ink-faint);
  font-size: 0.95rem;
}

.section--quiet {
  color: var(--ink-soft);
}

/* --------------------------------------------------------------- Tracks -- */

/* 21rem basis keeps this at a balanced 2x2 on desktop rather than
   stranding the fourth card alone on a second row. */
.tracks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 21rem), 1fr));
  gap: 1rem;
}

.track {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1.25rem 1.35rem 1.35rem;
}

.track__name {
  font-size: 1.02rem;
  margin-bottom: 0.5rem;
}

.track p {
  color: var(--ink-soft);
  font-size: 0.945rem;
}

.tags {
  list-style: none;
  margin: 0.95rem 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.tags li {
  font-size: 0.775rem;
  letter-spacing: 0.01em;
  color: var(--ink-faint);
  background: var(--bg-sunken);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- Role -- */

/* Two columns: a left rail for who/when, a right column for the work. This is
   what removes the dead gutter that a capped text measure used to leave. */
.role {
  display: grid;
  grid-template-columns: minmax(12rem, 16rem) 1fr;
  gap: 0 2.5rem;
  align-items: start;
}

.role + .role {
  margin-top: 2.25rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule);
}

.role__org {
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.role__org a {
  color: var(--ink);
}

.role__org a:hover,
.role__org a:focus-visible {
  color: var(--accent);
}

.role__title {
  margin-top: 0.3rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
}

.role__when {
  margin-top: 0.3rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.role__note {
  margin-bottom: 1.1rem;
  padding-left: 0.85rem;
  border-left: 2px solid var(--rule-strong);
  color: var(--ink-faint);
  font-size: 0.9rem;
  font-style: italic;
}

.role__plain {
  color: var(--ink-soft);
}

.role__group {
  margin-top: 1.35rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.role__group:first-child {
  margin-top: 0;
}

.bullets {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--ink-soft);
}

.bullets li {
  text-align: justify;
  hyphens: auto;
  hyphenate-limit-chars: 12 5 5;
}

/* Stack the rail above the work on narrow screens. */
@media (max-width: 48rem) {
  .role {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .role__rail {
    margin-bottom: 0.9rem;
  }

  .role__when {
    margin-top: 0.15rem;
  }
}

.bullets li {
  margin-bottom: 0.55rem;
}

.bullets li::marker {
  color: var(--rule-strong);
}

.bullets li:last-child {
  margin-bottom: 0;
}

/* ------------------------------------------------------------- Projects -- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: 1rem;
}

.project {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* contain, not cover: show every frame whole rather than cropping it.
   flex:none + min-height:0 stop a tall intrinsic video from overriding the
   aspect ratio via the flex item's automatic minimum size. */
.project__media {
  aspect-ratio: 16 / 9;
  flex: none;
  min-height: 0;
  overflow: hidden;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--rule);
}

.project__media img,
.project__media video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.project__text {
  padding: 1.1rem 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.project__name {
  font-size: 1rem;
  margin-bottom: 0.45rem;
}

.project p {
  color: var(--ink-soft);
  font-size: 0.925rem;
}

.project__links {
  margin-top: auto;
  padding-top: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  font-size: 0.855rem;
  font-weight: 600;
}

/* --------------------------------------------------------------- Skills -- */

.skills {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(11rem, 15rem) 1fr;
  gap: 0.35rem 2rem;
}

.skills dt {
  font-size: 0.85rem;
  font-weight: 680;
  letter-spacing: 0.02em;
  color: var(--ink);
  padding-top: 0.1rem;
}

.skills dd {
  margin: 0 0 1.05rem;
  color: var(--ink-soft);
  font-size: 0.945rem;
}

@media (max-width: 40rem) {
  .skills {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .skills dt {
    margin-bottom: 0.2rem;
  }

  .skills dd {
    margin-bottom: 1.15rem;
  }
}

/* --------------------------------------------------------- Publications -- */

/* Two across on desktop so the citations use the full column instead of
   leaving the right half of the section empty. auto-fit keeps it sensible if
   a third entry is ever added. */
.pubs {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--ink-faint);
  font-size: 0.89rem;
  line-height: 1.55;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 0.5rem 2.5rem;
}

.pubs li {
  margin-bottom: 0;
}

.pubs strong {
  color: var(--ink-soft);
  font-weight: 650;
}

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

.site-footer {
  max-width: var(--page);
  margin: 0 auto;
  padding: 2.5rem var(--gap) 3.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.925rem;
}

.site-footer__contact {
  font-weight: 550;
}

.site-footer__note {
  margin-top: 0.4rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------- Print -- */

@media print {
  .site-header,
  .hero__portrait,
  .hero__links {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
    font-size: 10.5pt;
  }

  .section,
  .role + .role {
    border-top: none;
  }

  .track,
  .project {
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  a {
    color: #000;
  }
}

/* --------------------------------------------------------------- Motion -- */

/* Keep anchored sections clear of the sticky header. Applies regardless of
   motion preference — it is layout, not animation. */
.section,
.hero {
  scroll-margin-top: 4.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
