/* =========================================================================
   NIKKI LEALI — PERSONAL SITE
   Design system: a single navy accent on a cool-white paper tone, one
   serif (Georgia) for everything — headings, body, labels, dates. No
   monospace "kicker" labels, no color-coded badges, no card shadows.
   Hairline rules and plain text do the organizing.
   ========================================================================= */

/* ---------------------------------------------------------------------
   1. DESIGN TOKENS
   --------------------------------------------------------------------- */
:root {
  /* Light theme (default) */
  --color-bg: #F5F9FC;
  --color-bg-alt: #EAF1F8;
  --color-surface: #FFFFFF;
  --color-text: #1B2A3D;
  --color-text-muted: #55677A;
  --color-border: #DCE6F0;

  --color-primary: #1F4E8C;        /* navy blue — links, nav, headings accent */
  --color-primary-ink: #FFFFFF;
  --color-secondary-ink: #2F5F8F;  /* text-safe steel blue, for hover/emphasis */

  /* Fixed (theme-invariant) solid color for the CTA button, so its white
     text stays readable in dark mode too (where --color-primary lightens
     to stay readable as body text/links, which would fail as a fill). */
  --color-cta: #1F4E8C;

  --shadow-color: 215deg 30% 30%;
  --shadow-md: 0 6px 18px -4px hsl(var(--shadow-color) / 0.18), 0 2px 6px hsl(var(--shadow-color) / 0.08);

  --font-display: Georgia, "Times New Roman", Times, serif;
  --font-body: Georgia, "Times New Roman", Times, serif;

  --radius-sm: 4px;

  --container-width: 1080px;
  --space-section: clamp(3rem, 6vw, 5rem);

  --transition-fast: 150ms ease;
  --transition-med: 300ms ease;
}

:root[data-theme="dark"] {
  --color-bg: #101B2D;
  --color-bg-alt: #16233A;
  --color-surface: #182A44;
  --color-text: #EDEAE0;
  --color-text-muted: #A9B4C4;
  --color-border: #2C3E58;

  --color-primary: #7FADDE;
  --color-primary-ink: #101B2D;
  --color-secondary-ink: #9CC0E0;

  --shadow-color: 220deg 60% 3%;
  --shadow-md: 0 6px 18px -4px hsl(var(--shadow-color) / 0.55);
}

/* ---------------------------------------------------------------------
   2. RESET & BASE
   --------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--transition-med), color var(--transition-med);
}

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

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--color-text);
}

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

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { color: var(--color-secondary-ink); }

ul, ol { margin: 0; padding: 0; list-style: none; }

button { font-family: inherit; }

.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: absolute; left: 1rem; top: -3rem;
  background: var(--color-primary); color: var(--color-primary-ink);
  padding: 0.6em 1.1em; border-radius: var(--radius-sm);
  z-index: 100; transition: top var(--transition-fast);
  font-weight: 700;
}
.skip-link:focus { top: 1rem; }

:focus-visible {
  outline: 2.5px solid var(--color-secondary-ink);
  outline-offset: 3px;
  border-radius: 4px;
}

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

/* ---------------------------------------------------------------------
   3. LAYOUT PRIMITIVES
   --------------------------------------------------------------------- */
.section {
  position: relative;
  padding: var(--space-section) 0;
  border-top: 1px solid var(--color-border);
}
.section--hero { border-top: none; }
.section--alt { background: var(--color-bg-alt); }

.section__inner {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}
.section__inner--center { text-align: center; }

.section__title {
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  margin-bottom: 1.75rem;
  position: relative;
  display: inline-block;
}
.section__title::after {
  content: "";
  display: block;
  width: 2.25rem;
  height: 2px;
  margin-top: 0.5rem;
  background: var(--color-primary);
}

/* ---------------------------------------------------------------------
   4. HEADER / NAV
   --------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--color-bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav__brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--color-text);
  text-decoration: none;
  margin-right: auto;
}
.nav__brand:hover { color: var(--color-primary); }

.nav__links {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
}
.nav__links a {
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.3rem 0.1rem;
  position: relative;
}
.nav__links a:hover,
.nav__links a:focus-visible { color: var(--color-text); }
.nav__links a.is-active { color: var(--color-primary); }
.nav__links a.is-active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 2px;
  background: var(--color-primary);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px; height: 38px;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.nav__toggle-bar {
  width: 18px; height: 2px;
  background: var(--color-text);
  margin: 0 auto;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--transition-fast);
}
.theme-toggle .icon { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }

/* ---------------------------------------------------------------------
   5. HERO / ABOUT
   --------------------------------------------------------------------- */
.section--hero { padding-top: clamp(2.5rem, 6vw, 4rem); }

.hero {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: clamp(2rem, 5vw, 3.5rem);
  align-items: start;
}

.hero__portrait {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.hero__photo {
  width: 190px;
  height: 190px;
  border-radius: 6px;
  object-fit: cover;
  object-position: 50% 15%;
  border: 3px solid var(--color-primary);
  background: var(--color-surface);
}

.hero__contact-block {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 0.9rem;
}
.hero__location {
  color: var(--color-text-muted);
  margin: 0;
  font-style: italic;
}

/* Contact links — a plain text list, not pill buttons. */
.contact-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.contact-list a {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}
.contact-list a:hover,
.contact-list a:focus-visible { color: var(--color-primary); }
.contact-list .icon { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.hero__name {
  font-size: clamp(2rem, 4.5vw, 2.9rem);
  margin-bottom: 0.35rem;
}

.hero__tagline {
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: var(--color-text-muted);
  margin-bottom: 1.6rem;
}

.hero__bio { max-width: 64ch; }
.hero__bio p { color: var(--color-text); }

/* ---------------------------------------------------------------------
   6. RESEARCH
   --------------------------------------------------------------------- */
.research-intro {
  max-width: 72ch;
  font-size: clamp(1.02rem, 0.9rem + 0.5vw, 1.2rem);
  line-height: 1.75;
}

/* ---------------------------------------------------------------------
   7. PUBLICATIONS — a flat grid of plain boxes with a figure, not
   stacked list rows and not color-coded by type.
   --------------------------------------------------------------------- */
.paper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1.1rem;
}
.paper-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
}
.paper-card__figure {
  aspect-ratio: 16 / 10;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.paper-card__figure img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 0.5rem;
}
.paper-card__body { padding: 0.85rem 0.95rem; }

.paper-card__meta {
  font-style: italic;
  font-size: 0.74rem;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}
.paper-card__title {
  font-size: 0.92rem;
  line-height: 1.3;
  margin-bottom: 0.3rem;
}
.paper-card__authors { font-size: 0.78rem; color: var(--color-text-muted); margin-bottom: 0.15rem; }
.paper-card__venue { font-style: italic; color: var(--color-text-muted); font-size: 0.78rem; }
.paper-card__note { color: var(--color-text-muted); font-size: 0.74rem; }

.paper-card__links {
  margin-top: 0.55rem;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ---------------------------------------------------------------------
   8. EXPERIENCE (timeline)
   --------------------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 1.75rem;
  border-left: 2px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}
.timeline-item { position: relative; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.75rem;
  top: 0.35rem;
  transform: translateX(-50%);
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--color-primary);
  border: 3px solid var(--color-bg-alt);
}
.timeline-item__header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin-bottom: 0.3rem;
}
.timeline-item__role { font-size: 1.05rem; font-weight: 700; }
.timeline-item__dates {
  font-style: italic;
  font-size: 0.85rem;
  color: var(--color-primary);
  margin-left: auto;
  white-space: nowrap;
}
.timeline-item__org { color: var(--color-secondary-ink); font-weight: 500; font-size: 0.95rem; margin-bottom: 0.5rem; }
.timeline-item__desc { color: var(--color-text-muted); font-size: 0.96rem; max-width: 70ch; }
.timeline-item__note { color: var(--color-text-muted); font-size: 0.88rem; font-style: italic; max-width: 70ch; }
.timeline-item__skills { color: var(--color-text-muted); font-size: 0.85rem; max-width: 70ch; margin-top: 0.4rem; }
.timeline-item__skills em { font-style: italic; color: var(--color-text); font-weight: 500; }

/* ---------------------------------------------------------------------
   9. NEWS — a compact, scrollable panel rather than an open-ended list.
   --------------------------------------------------------------------- */
.news-list {
  display: flex;
  flex-direction: column;
  max-height: 20rem;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 0 1.25rem;
}
.news-item {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1.25rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--color-border);
}
.news-item:last-child { border-bottom: none; }
.news-item__date {
  font-weight: 700;
  color: var(--color-primary);
  font-size: 0.9rem;
}
.news-item__text { color: var(--color-text); }
.news-item__link {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--color-primary);
  margin-left: 0.3em;
}
.news-item__link:hover,
.news-item__link:focus-visible { color: var(--color-secondary-ink); }

/* ---------------------------------------------------------------------
   10. CV
   --------------------------------------------------------------------- */
.section--cv { text-align: center; }
.cv-lead { color: var(--color-text-muted); max-width: 42ch; margin: 0 auto 1.75rem; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.75em 1.6em;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.button--primary {
  background: var(--color-cta);
  color: #fff;
  box-shadow: var(--shadow-md);
}
.button--primary:hover { transform: translateY(-2px); color: #fff; }
.button .icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.cv-note { margin-top: 1rem; font-size: 0.85rem; font-style: italic; color: var(--color-text-muted); }

/* ---------------------------------------------------------------------
   11. FOOTER
   --------------------------------------------------------------------- */
.site-footer {
  text-align: center;
  padding: 2.5rem 1.5rem 3rem;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--color-border);
}

/* ---------------------------------------------------------------------
   12. RESPONSIVE
   --------------------------------------------------------------------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero__portrait { flex-direction: row; align-items: center; }

  .nav__toggle { display: flex; }
  .nav__links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 1.5rem 1.5rem;
    gap: 1rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height var(--transition-med), opacity var(--transition-med);
  }
  .nav__links.is-open { max-height: 24rem; opacity: 1; }
}

@media (max-width: 600px) {
  .news-item { grid-template-columns: 1fr; gap: 0.2rem; }
  .timeline-item__dates { margin-left: 0; }
  .hero__portrait { flex-direction: column; align-items: flex-start; }
  :root { --space-section: clamp(2.5rem, 9vw, 3.5rem); }
}
