/* ============================================================
   Nicholas Tokay — personal site
   ------------------------------------------------------------
   Direction: modern light, deep ink-blue accent.
   To recolour the whole site, change --accent below — links,
   underlines, highlights and the nav all key off it.
   ============================================================ */

:root {
  /* Colours */
  --bg:        #f8f9fb;   /* cool near-white background         */
  --bg-soft:   #eef2f7;   /* subtle panel / hover background    */
  --ink:       #15181d;   /* near-black text (slight cool bias) */
  --muted:     #5b6472;   /* secondary / meta text             */
  --accent:    #274690;   /* links & highlights (edit me)       */
  --accent-dk: #1c3369;   /* darker accent for hover           */
  --line:      #e3e7ee;   /* hairline borders                  */

  /* Type */
  --display: "Fraunces", Georgia, "Times New Roman", serif;      /* name & titles */
  --sans:    "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  /* Layout */
  --measure: 42rem;       /* reading column width               */
  --pad:     1.5rem;      /* page side padding                  */
}

/* ---------- Reset-ish base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.1rem;
  line-height: 1.62;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
}

::selection {
  background: var(--accent);
  color: #fff;
}

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
a:hover {
  color: var(--accent-dk);
  border-bottom-color: var(--accent);
}

/* ============================================================
   Sticky top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--pad);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
/* hairline appears once the page is scrolled (toggled in main.js) */
.topbar.is-scrolled { border-bottom-color: var(--line); }

.topbar__name {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  border-bottom: none;
  opacity: 0;                        /* hidden until scrolled past hero */
  transform: translateY(2px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}
.topbar__name.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.topbar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.35rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 500;
}
.topbar__nav a {
  color: var(--muted);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
}
.topbar__nav a:hover { color: var(--ink); border-bottom-color: var(--ink); }
.topbar__nav a.is-active { color: var(--ink); border-bottom-color: var(--accent); }
.topbar__nav .cv-link { color: var(--accent); }
.topbar__nav .cv-link:hover { color: var(--accent-dk); border-bottom-color: var(--accent); }

/* ============================================================
   Layout container
   ============================================================ */
main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ============================================================
   Hero  (text + portrait)
   ============================================================ */
.hero {
  display: flex;
  align-items: center;
  gap: 2.75rem;
  padding: clamp(3rem, 10vh, 6rem) 0 clamp(2.5rem, 7vh, 4rem);
}
.hero__text { flex: 1 1 auto; min-width: 0; }

.hero__tagline {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--muted);
  margin: 0 0 1.3rem;
  max-width: 34rem;
}
.hero__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.6rem, 8vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0 0 0.75rem;
}
.hero__role {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
}

.hero__portrait { margin: 0; flex: 0 0 auto; }
.hero__portrait img {
  display: block;
  width: 210px;
  height: 248px;
  object-fit: cover;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  box-shadow: 0 12px 30px -14px rgba(21, 24, 29, 0.35);
}

/* ============================================================
   Sections
   ============================================================ */
.section {
  padding: 2.6rem 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 4.5rem;   /* offset so the sticky bar doesn't cover headings */
}

.section__label {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.4rem;
}

.prose p { margin: 0 0 1.1rem; }
.prose p:last-child { margin-bottom: 0; }
.prose--muted { color: var(--muted); font-size: 1rem; }

.subhead {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 2.2rem 0 0.9rem;
}

/* ============================================================
   Papers  (expandable abstracts via native <details>)
   ============================================================ */
.papers { list-style: none; margin: 0; padding: 0; }
.paper { border-top: 1px solid var(--line); }
.paper:last-child { border-bottom: 1px solid var(--line); }

.paper summary {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.95rem 1.6rem 0.95rem 0;
  position: relative;
  cursor: pointer;
  list-style: none;              /* hide default triangle */
}

/* Static entries (work in progress, policy) — same look, no expand marker */
.paper__head {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.95rem 0;
}
.paper__head .paper__links { margin-top: 0.35rem; }
.paper summary::-webkit-details-marker { display: none; }

/* custom marker */
.paper summary::after {
  content: "+";
  position: absolute;
  right: 0.15rem;
  top: 0.9rem;
  font-family: var(--sans);
  font-size: 1.2rem;
  line-height: 1.4;
  color: var(--muted);
  transition: transform .2s ease, color .2s ease;
}
.paper[open] summary::after { content: "\2212"; color: var(--accent); } /* minus */

.paper summary:hover .paper__title { color: var(--accent); }
.paper summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.paper__title {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 500;
  line-height: 1.3;
  transition: color .15s ease;
}
.paper__meta {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}
.paper__body {
  padding: 0 0 1.2rem;
  color: var(--ink);
}
.paper__body p { margin: 0 0 0.8rem; }
.paper__links {
  font-family: var(--sans);
  font-size: 0.88rem;
  display: flex;
  gap: 1.2rem;
}

/* ============================================================
   Contact
   ============================================================ */
.address {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.5;
}
.social {
  font-family: var(--sans);
  font-size: 0.92rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  max-width: var(--measure);
  margin: 2rem auto 0;
  padding: 2rem var(--pad) 3rem;
  border-top: 1px solid var(--line);
  font-family: var(--sans);
  font-size: 0.82rem;
  color: var(--muted);
}
.footer p { margin: 0; }

/* ============================================================
   Small screens
   ============================================================ */
@media (max-width: 620px) {
  .hero {
    flex-direction: column-reverse;   /* photo above the name on mobile */
    align-items: flex-start;
    gap: 1.6rem;
    padding-top: clamp(2rem, 7vh, 3.5rem);
  }
  .hero__portrait img { width: 132px; height: 156px; border-radius: 12px; }
}
@media (max-width: 560px) {
  .topbar { padding: 0.75rem 1.1rem; }
  .topbar__nav { gap: 1rem; }
  .section { padding: 2.1rem 0; }
}

/* ============================================================
   Respect reduced-motion preferences
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
