/* =========================================================
   Natalie Rice — Mechanical Engineer
   Apple-inspired: grey canvas, white cards, big type, calm motion.
   No build step. Tokens live in :root.
   ========================================================= */

:root {
  color-scheme: light;

  /* Surfaces */
  --bg:          #f5f5f7;   /* grey page canvas — Apple "grouped background" */
  --surface:     #ffffff;   /* white cards that float on the canvas */
  --well:        #ededf0;   /* recessed area inside a card (image wells) */

  /* Ink */
  --ink:         #1d1d1f;
  --ink-2:       #6e6e73;
  --ink-3:       #86868b;
  --line:        #d2d2d7;

  /* Accent — Apple blue (links, buttons) */
  --accent:      #0071e3;
  --accent-link: #0066cc;
  --accent-ink:  #ffffff;

  /* Accent — Apple orange (eyebrow labels, marks) */
  --orange:      #bf4800;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
          "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --maxw: 980px;
  --wide: 1200px;
  --sheet: 72rem;          /* main content width */
  --read: 58rem;           /* reading measure for long body text */
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --radius: 28px;
  --ease: cubic-bezier(0.28, 0.11, 0.32, 1);
}

/* Dark palette is opt-in only: add data-theme="dark" to <html> to use it.
   (Was auto-following the OS theme, which is why the site went dark.) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:          #000000;
  --surface:     #1d1d1f;
  --well:        #161617;
  --ink:         #f5f5f7;
  --ink-2:       #a1a1a6;
  --ink-3:       #86868b;
  --line:        #38383a;
  --accent:      #0a84ff;
  --accent-link: #2997ff;
  --accent-ink:  #ffffff;
  --orange:      #ff7a26;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3 { font-weight: 600; letter-spacing: -0.025em; line-height: 1.07; margin: 0; }
a { color: inherit; }

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

.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;
}
.skip-link {
  position: fixed; left: 50%; top: -4rem; transform: translateX(-50%); z-index: 200;
  background: var(--ink); color: var(--bg); padding: 0.6rem 1rem; border-radius: 10px;
  transition: top 0.2s;
}
.skip-link:focus { top: 0.6rem; }

.link { color: var(--accent-link); text-decoration: none; white-space: nowrap; }
.link:hover { text-decoration: underline; }
.link::after { content: " \203A"; }

/* ---------- Centered reading column (content sits on the canvas) ---------- */
.sheet {
  max-width: var(--sheet);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 3.5rem) var(--gutter) clamp(3rem, 9vw, 5.5rem);
}
.panel {  /* legacy — kept so nothing breaks if reused */
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(2rem, 6vw, 4.5rem);
}

/* ---------- Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}
.nav { display: flex; align-items: center; gap: clamp(1.25rem, 4vw, 3rem); height: 3rem; max-width: var(--sheet); }
.nav__brand { font-size: 1.1rem; font-weight: 600; letter-spacing: -0.02em; text-decoration: none; color: var(--ink); white-space: nowrap; }
.nav__right { display: flex; align-items: center; gap: clamp(0.75rem, 2.5vw, 1.5rem); margin-left: auto; }
.nav__menu { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 1.9rem); list-style: none; margin: 0; padding: 0; }
.nav__menu a { text-decoration: none; color: var(--ink-2); font-size: 0.95rem; font-weight: 500; letter-spacing: -0.01em; transition: color 0.2s; white-space: nowrap; }
.nav__menu a:hover { color: var(--ink); }
.nav__resume {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0.4rem 0.85rem; font-size: 0.9rem; font-weight: 500;
  color: var(--ink); text-decoration: none; white-space: nowrap;
  transition: border-color 0.2s, background 0.2s;
}
.nav__resume:hover { border-color: var(--ink-3); background: color-mix(in srgb, var(--ink) 5%, transparent); }

.nav__theme {
  border: 0; background: transparent; cursor: pointer; padding: 0;
  width: 2rem; height: 2rem; display: grid; place-items: center;
  color: var(--ink-2); border-radius: 50%; overflow: hidden;
  transition: color 0.2s, background 0.2s;
}
.nav__theme:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
/* Both icons stack (grid) centred in the button. Each rotates about a pivot
   BELOW its centre (like the horizon), so at rest (rotation = a multiple of
   360deg) the visible icon sits dead-centre and upright, and when it "sets" it
   swings down past the horizon. --turn (set by JS) only ever counts up, so every
   toggle adds another 180deg the SAME way — the sweep is always clockwise. The
   inactive icon is faded out. */
.nav__theme-icon {
  grid-area: 1 / 1;
  width: 1.05rem; height: 1.05rem;
  transform-origin: 50% 145%;
  transition: opacity 0.25s var(--ease), transform 0.7s var(--ease);
}
.nav__theme-moon { transform: rotate(calc(var(--turn, 0) * 180deg)); opacity: 1; }
.nav__theme-sun  { transform: rotate(calc(var(--turn, 0) * 180deg + 180deg)); opacity: 0; }
:root[data-theme="dark"] .nav__theme-moon { opacity: 0; }
:root[data-theme="dark"] .nav__theme-sun  { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .nav__theme-icon { transition-duration: 0.12s; } }

.nav__toggle { display: none; width: 2.25rem; height: 2.25rem; border: 0; background: transparent; cursor: pointer; position: relative; }
.nav__toggle-bar,
.nav__toggle-bar::before,
.nav__toggle-bar::after {
  content: ""; position: absolute; left: 50%; width: 1.05rem; height: 1.5px;
  background: var(--ink); transform: translateX(-50%); transition: 0.25s var(--ease);
}
.nav__toggle-bar { top: 50%; }
.nav__toggle-bar::before { top: -5px; }
.nav__toggle-bar::after  { top: 5px; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar { background: transparent; }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar::before { top: 0; transform: translateX(-50%) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__toggle-bar::after  { top: 0; transform: translateX(-50%) rotate(-45deg); }

@media (max-width: 720px) {
  .nav__toggle { display: block; }
  .nav__menu {
    position: absolute; inset: 3rem 0 auto 0; flex-direction: column; align-items: center; gap: 0;
    background: var(--surface); border-bottom: 1px solid var(--line); padding: 0.5rem 0 1.5rem;
    transform: translateY(-115%); transition: transform 0.32s var(--ease);
  }
  .nav__menu.is-open { transform: translateY(0); }
  .nav__menu li { width: 100%; text-align: center; }
  .nav__menu a { display: block; padding: 1rem 0; font-size: 1rem; border-top: 1px solid var(--line); }
}
@media (max-width: 430px) { .nav__resume { display: none; } }

/* ---------- Hero (header row: text + portrait) ---------- */
.hero {
  text-align: left;
  display: grid; grid-template-columns: minmax(0, max-content) 1fr;
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
  padding-bottom: clamp(1.5rem, 4vw, 2.25rem);
  margin-bottom: 0;
}
.hero__eyebrow { font-size: clamp(0.78rem, 1.4vw, 0.9rem); font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--orange); margin: 0 0 1.1rem; }
.hero__title { font-size: clamp(2.5rem, 7.5vw, 4.75rem); font-weight: 700; letter-spacing: -0.04em; line-height: 1.02; margin: 0 0 1.4rem; white-space: nowrap; }
.hero__lede { max-width: 58ch; }
.hero__lede p { margin: 0 0 0.85rem; font-size: 1.05rem; color: var(--ink-2); line-height: 1.65; }
.hero__lede p:last-child { margin-bottom: 0; }
.hero__photo { justify-self: center; width: 232px; height: 288px; object-fit: cover; object-position: 50% 16%; border-radius: 16px; background: var(--well); }
@media (max-width: 640px) {
  .hero { display: flex; flex-direction: column; align-items: flex-start; }
  .hero__title { white-space: normal; }
  .hero__photo { order: -1; width: 132px; height: 160px; margin-bottom: 0.75rem; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.7rem 1.4rem; border-radius: 980px;
  font-size: 1.0625rem; letter-spacing: -0.01em; text-decoration: none;
  border: 1px solid transparent; transition: background 0.2s, opacity 0.2s;
}
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: color-mix(in srgb, var(--accent) 88%, white); }
.btn--ghost { color: var(--accent-link); }
.btn--ghost::after { content: " \203A"; }
.btn--ghost:hover { text-decoration: underline; }

/* ---------- Sections ---------- */
.section { padding-block: clamp(2.5rem, 6vw, 4rem); }
#background { padding-top: clamp(0.5rem, 2vw, 1rem); }
.section__head { text-align: left; max-width: var(--read); margin: 0 0 clamp(1.75rem, 4vw, 2.5rem); }
.section__kicker {
  display: flex; align-items: center; gap: 0.9rem;
  font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.15em;
  color: var(--orange); margin: 0 0 clamp(1rem, 3vw, 1.5rem);
}
.section__kicker::before,
.section__kicker::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.section__title { font-size: clamp(1.65rem, 4vw, 2.2rem); font-weight: 600; letter-spacing: -0.03em; }
.section__intro { font-size: clamp(1rem, 2vw, 1.2rem); color: var(--ink-2); margin: 0.9rem 0 0; line-height: 1.45; max-width: var(--read); }

/* ---------- Background (prose + facts, divided) ---------- */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(13rem, 21rem); gap: clamp(2rem, 6vw, 5rem); }
.about__body { max-width: 62ch; }
.about__body p { margin: 0 0 1.2rem; color: var(--ink-2); font-size: 1.05rem; line-height: 1.65; }
.about__body p:last-child { margin-bottom: 0; }
.about__facts { margin: 0; padding: 0.25rem 0 0.25rem clamp(1.75rem, 4vw, 3rem); border-left: 1px solid var(--line); display: grid; gap: clamp(1.5rem, 3vw, 2.25rem); align-content: start; }
.about__facts .fact dt { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--orange); margin: 0 0 0.5rem; }
.about__facts .fact dd { margin: 0; font-size: 0.98rem; color: var(--ink-2); line-height: 1.55; }
@media (max-width: 780px) {
  .about { grid-template-columns: 1fr; gap: 2.5rem; }
  .about__facts { border-left: 0; padding: 2rem 0 0; border-top: 1px solid var(--line); }
}

/* ---------- Research & Projects — dated list, same shape as the timeline ---------- */
.entry { max-width: var(--read); padding-bottom: clamp(1.5rem, 4vw, 2.25rem); }
.entry + .entry { padding-top: clamp(1.5rem, 4vw, 2.25rem); border-top: 1px solid var(--line); }
.entry:last-of-type { padding-bottom: 0; }
.entry__title { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.entry__org { color: var(--ink-2); font-size: 0.95rem; margin: 0.2rem 0 0; }
.entry__desc { margin: 0.9rem 0 0; color: var(--ink-2); font-size: 1rem; line-height: 1.6; }
.entry__meta { margin: 0.85rem 0 0; font-size: 0.8rem; color: var(--ink-3); line-height: 1.55; }
.entry__links { margin: 0.85rem 0 0; display: flex; flex-wrap: wrap; gap: 1.25rem; }
.entry__links a { color: var(--accent-link); text-decoration: none; font-size: 0.9rem; font-weight: 500; }
.entry__links a:hover { text-decoration: underline; }

/* ---------- Experience timeline ---------- */
.timeline { display: grid; max-width: var(--read); }
.tl-item { padding: clamp(1.5rem, 4vw, 2.25rem) 0; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: 0; padding-top: 0; }
.tl-item:last-child { padding-bottom: 0; }
.tl-when { font-size: 0.8rem; font-weight: 600; color: var(--orange); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 0.4rem; }
.tl-role { font-size: 1.2rem; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.tl-org { color: var(--ink-2); font-size: 0.95rem; margin: 0.2rem 0 0; }
.tl-desc { margin: 0.9rem 0 0; color: var(--ink-2); font-size: 1rem; line-height: 1.6; }
.tl-item ul { margin: 0.9rem 0 0; padding-left: 1.15rem; color: var(--ink-2); font-size: 1rem; line-height: 1.5; }
.tl-item li { margin-bottom: 0.4rem; }

/* ---------- Skills ---------- */
.skills { display: grid; gap: clamp(1.5rem, 4vw, 2.25rem); max-width: var(--read); }
.skills__group h3 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 0.75rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.skills__list { margin: 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.7; }
/* legacy list markup, still used elsewhere */
.skills__group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
.skills__group li { font-size: 1rem; color: var(--ink-2); }

/* ---------- For Fun photo carousel (auto-advancing) ---------- */
.funcar { position: relative; max-width: 44rem; margin-inline: auto; }
.funcar__viewport { overflow: hidden; border-radius: 14px; background: var(--bg); }
.funcar__track { display: flex; transition: transform 0.6s var(--ease); }
.funcar__slide { flex: 0 0 100%; aspect-ratio: 3 / 2; }
.funcar__slide img { width: 100%; height: 100%; object-fit: contain; object-position: center; display: block; }
.funcar__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 2.25rem; height: 2.25rem; display: grid; place-items: center;
  border: 0; border-radius: 50%; cursor: pointer;
  font: inherit; font-size: 1.2rem; line-height: 1;
  color: var(--ink); background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: 0 2px 10px -2px rgba(0, 0, 0, 0.3);
  transition: background 0.2s var(--ease);
}
.funcar__nav:hover { background: var(--surface); }
.funcar__nav--prev { left: 0.6rem; }
.funcar__nav--next { right: 0.6rem; }
.funcar__dots { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: center; margin-top: 0.9rem; }
.funcar__dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: var(--line); transition: background 0.2s var(--ease); }
.funcar__dot.is-active { background: var(--ink-2); }

/* ---------- Contact ---------- */
.contact { text-align: left; max-width: var(--read); }
.contact__lede { font-size: 1rem; margin: 0 0 clamp(1.75rem, 4vw, 2.5rem); color: var(--ink-2); line-height: 1.6; }
.contact__list { margin: 0; padding: 0; }
.contact__row { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; padding: clamp(1rem, 2.4vw, 1.4rem) 0; border-top: 1px solid var(--line); }
.contact__row:last-child { border-bottom: 1px solid var(--line); }
.contact__row dt { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.contact__row dd { margin: 0; text-align: right; }
.contact__row dd a { color: var(--ink); font-weight: 600; text-decoration: none; }
.contact__row dd a:hover { text-decoration: underline; }

/* ---------- Project gallery page (projects/gallery.html) ---------- */
.nav__back { font-size: 0.8125rem; color: var(--ink-2); text-decoration: none; }
.nav__back:hover { color: var(--ink); }
.gallery { max-width: var(--read); }
.gallery__sub { margin: 0.9rem 0 0; color: var(--ink-2); font-size: 1.05rem; line-height: 1.55; }
.gallery__files { margin: 1.4rem 0 0; display: flex; flex-wrap: wrap; gap: 1.25rem; }
.gallery__file { color: var(--accent-link); text-decoration: none; font-size: 0.95rem; font-weight: 500; }
.gallery__file:hover { text-decoration: underline; }
.gallery__grid { margin: clamp(2rem, 5vw, 3rem) 0 0; display: grid; gap: clamp(2rem, 5vw, 3rem); }
.gallery__item { margin: 0; }
.gallery__item img { width: 100%; height: auto; display: block; border-radius: 14px; background: var(--well); }
.gallery__item figcaption { margin: 0.7rem 0 0; color: var(--ink-3); font-size: 0.9rem; line-height: 1.5; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding-block: 2.25rem; margin-top: clamp(2rem, 6vw, 4rem); }
.site-footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-size: 0.8rem; color: var(--ink-3); max-width: var(--sheet); }
.contact__colophon { margin: clamp(2rem, 5vw, 3rem) 0 0; font-size: 0.8rem; color: var(--ink-3); }
.site-footer a { color: var(--ink-3); text-decoration: none; }
.site-footer a:hover { color: var(--ink-2); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Focus ---------- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
