/* ==========================================================================
   nicksawhney.github.io/me
   Hand-written. No framework, no build step, no JavaScript.
   ========================================================================== */

/* fonts
   ---------------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;          /* variable axis */
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Serif";
  src: url("../fonts/ibm-plex-serif-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* settings
   ---------------------------------------------------------------------- */
:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "IBM Plex Serif", ui-serif, Georgia, "Times New Roman", serif;

  /* Fluid type scale. clamp() handles every viewport, so there are no
     type-related media queries anywhere below. */
  --step--1: clamp(0.83rem, 0.79rem + 0.20vw, 0.94rem);
  --step-0:  clamp(1.00rem, 0.95rem + 0.25vw, 1.13rem);
  --step-1:  clamp(1.20rem, 1.11rem + 0.45vw, 1.50rem);
  --step-2:  clamp(1.44rem, 1.28rem + 0.80vw, 2.00rem);
  --step-3:  clamp(1.73rem, 1.45rem + 1.40vw, 2.75rem);
  --step-4:  clamp(2.07rem, 1.55rem + 2.60vw, 4.00rem);

  --space-xs: 0.5rem;
  --space-s:  1rem;
  --space-m:  1.75rem;
  --space-l:  3rem;
  --space-xl: clamp(4rem, 3rem + 5vw, 7rem);

  --measure: 68ch;
  --wrap: 1100px;
  --radius: 10px;

  /* light theme */
  --bg: #fbfbfa;
  --bg-sunk: #f2f2f0;
  --fg: #16181d;
  --fg-muted: #5c626e;
  --rule: #e2e2de;
  --accent: #b4442e;
  --accent-fg: #ffffff;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216;
    --bg-sunk: #171a20;
    --fg: #e8e9ea;
    --fg-muted: #9aa0ab;
    --rule: #262a32;
    --accent: #ff7a5c;
    --accent-fg: #16181d;
  }
}

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;        /* replaces Jump.js */
  scroll-padding-top: 5rem;       /* clears the sticky header on anchor jumps */
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img,
picture,
iframe { display: block; max-width: 100%; }

img { height: auto; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
}

p, li { text-wrap: pretty; }

a { color: inherit; }

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

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* layout primitives
   ---------------------------------------------------------------------- */
.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

.section {
  padding-block: var(--space-xl);
  border-top: 1px solid var(--rule);
}

.section__intro {
  max-width: var(--measure);
  color: var(--fg-muted);
  margin-top: calc(var(--space-l) * -1 + var(--space-s));
  margin-bottom: var(--space-l);
}

.section__title {
  font-size: var(--step-1);
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: var(--space-l);
}

.prose { max-width: var(--measure); }
.prose + .prose { margin-top: var(--space-s); }

/* Visible to screen readers only — gives the icon links an accessible name. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* header / nav
   ---------------------------------------------------------------------- */
.header {
  position: sticky;              /* replaces the JS scroll handler */
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  min-height: 4rem;
}

.header__home {
  font-family: var(--font-serif);
  font-size: var(--step-0);
  text-decoration: none;
  white-space: nowrap;
}

.nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  list-style: none;
  padding: 0;
  justify-content: flex-end;
}

.nav a {
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--fg-muted);
  padding-block: 0.35rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav a:hover { color: var(--fg); border-bottom-color: var(--accent); }

/* On narrow screens the nav wraps under the name rather than hiding behind
   a toggle. Fewer moving parts than a menu, and no JS. */
@media (max-width: 40rem) {
  .header { position: static; }
  .header__inner {
    flex-direction: column;
    align-items: flex-start;
    padding-block: 0.75rem;
  }
  .nav ul { justify-content: flex-start; }
}

/* hero
   ---------------------------------------------------------------------- */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  align-items: center;
  min-height: min(88svh, 50rem);
  padding-block: var(--space-xl);
  color: #f4f5f6;              /* hero is dark in both colour schemes */
}

.hero__img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero::after {                 /* legibility scrim over the map */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 11, 14, 0.55) 0%, rgba(10, 11, 14, 0.78) 100%);
}

.hero h1 {
  font-size: var(--step-4);
  margin-bottom: var(--space-s);
}

.hero__tagline {
  font-size: var(--step-1);
  max-width: 34ch;
  color: #d9dce1;
  margin-bottom: var(--space-m);
}

.hero__tagline em {
  font-style: normal;
  color: #fff;
  border-bottom: 2px solid var(--accent);
}

.social {
  display: flex;
  gap: var(--space-s);
  list-style: none;
  padding: 0;
}

.social a {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: inherit;
  transition: background-color 0.15s, border-color 0.15s;
}

.social a:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.7);
}

.social svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }

/* about
   ---------------------------------------------------------------------- */
.about {
  display: grid;
  gap: var(--space-l);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

@media (min-width: 48rem) {
  .about { grid-template-columns: 220px minmax(0, 1fr); }
}

.about__pic {
  width: 100%;
  max-width: 220px;
  border-radius: var(--radius);
}

.about__contact {
  margin-top: var(--space-m);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-m);
  align-items: center;
  font-size: var(--step--1);
}

/* buttons / links
   ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  border-radius: var(--radius);
  transition: filter 0.15s;
}

.btn:hover { filter: brightness(1.1); }
.btn svg { width: 1rem; height: 1rem; fill: currentColor; }

.link {
  color: inherit;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.link:hover { color: var(--accent); }

/* work
   ---------------------------------------------------------------------- */
.roles {
  display: grid;
  gap: var(--space-l);
  list-style: none;
  padding: 0;
}

.role {
  display: grid;
  gap: var(--space-xs) var(--space-l);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 48rem) {
  .role { grid-template-columns: 14rem minmax(0, 1fr); }
}

.role__meta { color: var(--fg-muted); font-size: var(--step--1); }
.role__org { display: block; font-weight: 600; color: var(--fg); font-size: var(--step-0); }
.role__title { font-size: var(--step-1); margin-bottom: var(--space-xs); }
.role ul { padding-left: 1.1rem; display: grid; gap: 0.35rem; }

/* projects
   ---------------------------------------------------------------------- */
.projects { display: grid; gap: var(--space-xl); }

.project__title { font-size: var(--step-2); margin-bottom: var(--space-s); }

.project__body { margin-bottom: var(--space-m); }

.project__body p + p { margin-top: var(--space-s); }

/* Wrapper keeps embeds responsive without the template's hardcoded
   `style="width:45%; height:600px"`, which distorted the video. */
.embed {
  position: relative;
  width: 100%;
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.embed--video { aspect-ratio: 16 / 9; }

.embed--map { aspect-ratio: 4 / 3; }

@media (min-width: 48rem) {
  .embed--map { aspect-ratio: 16 / 9; }
}

.embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Stands in for a screenshot on the CLI project. Scrolls rather than wraps,
   so the commands stay copy-pasteable. */
.code {
  margin: 0;
  padding: var(--space-s) var(--space-m);
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: var(--step--1);
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

.code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.project__figure {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}

.project__figure img { width: 100%; }

/* press
   ---------------------------------------------------------------------- */
.press {
  display: grid;
  gap: var(--space-m);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  list-style: none;
  padding: 0;
}

.press__item {
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  padding: var(--space-m);
  background: var(--bg-sunk);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

/* Logos are black artwork on transparent, so they vanish on a dark card.
   A white chip works for any logo colour; an invert filter would not
   (it would turn BuzzFeed's red cyan). */
.press__logo {
  height: 1.4rem;
  width: auto;
  align-self: flex-start;
  background: #fff;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  box-sizing: content-box;
}

.press__quote {
  font-size: var(--step--1);
  color: var(--fg-muted);
  margin: 0;
  flex: 1;
}

.press__cite {
  font-size: var(--step--1);
  font-style: normal;
  font-weight: 600;
}

.press__cite span { display: block; font-weight: 400; color: var(--fg-muted); }

/* education
   ---------------------------------------------------------------------- */
.edu__degree { font-size: var(--step-1); margin-bottom: var(--space-xs); }

.edu__meta {
  color: var(--fg-muted);
  font-size: var(--step--1);
  margin-bottom: var(--space-s);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
}

/* contact
   ---------------------------------------------------------------------- */
.contact__lead {
  font-size: var(--step-2);
  font-family: var(--font-serif);
  max-width: 24ch;
  margin-bottom: var(--space-m);
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-m);
  align-items: center;
}

/* footer
   ---------------------------------------------------------------------- */
.footer {
  border-top: 1px solid var(--rule);
  padding-block: var(--space-m);
  color: var(--fg-muted);
  font-size: var(--step--1);
}

.footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-m);
  align-items: center;
  justify-content: space-between;
}
