/* =========================================================
   Gabriele Cola — personal site
   Tokens: deep petrol ink, cool paper, teal links, amber "flag"
   The amber is reserved for the one thing that is flagged:
   the anomalous nodes in the hero, and the active filter.
   ========================================================= */
:root {
  --ink: #0E2830;      /* hero background, body text */
  --ink-2: #183C46;    /* raised surfaces on dark */
  --paper: #F2F5F4;    /* page background */
  --rule: #D3DEDD;     /* hairlines on paper */
  --teal: #1B6F80;     /* links on paper */
  --mist: #9DBCC2;     /* secondary text on dark */
  --muted: #4E666C;    /* secondary text on paper */
  --signal: #F0A202;   /* flagged / active */

  --sans: "Schibsted Grotesk", system-ui, sans-serif;
  --serif: "Newsreader", Georgia, serif;

  /* modular scale, ratio 1.25 */
  --s-1: 0.85rem;
  --s0: 1.0625rem;
  --s1: 1.33rem;
  --s2: 1.66rem;
  --s3: 2.07rem;

  --gutter: clamp(1.25rem, 4vw, 3rem);
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--s0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--teal); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: 1rem; top: -3rem; z-index: 50;
  background: var(--signal); color: var(--ink); padding: .5rem .9rem;
  font-family: var(--sans); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------------- NAV ---------------- */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem var(--gutter);
  font-family: var(--sans);
  color: #fff;
  transition: background-color .25s ease, color .25s ease, box-shadow .25s ease;
}
.nav.is-solid {
  background: rgba(242, 245, 244, .92);
  backdrop-filter: saturate(140%) blur(8px);
  color: var(--ink);
  box-shadow: 0 1px 0 var(--rule);
}
.nav a { color: inherit; text-decoration: none; }
.nav-name { font-weight: 800; letter-spacing: -0.01em; }
.nav ul { display: flex; gap: clamp(.9rem, 2.4vw, 1.8rem); list-style: none; margin: 0; padding: 0; font-size: .95rem; }
.nav ul a { opacity: .8; }
.nav ul a:hover { opacity: 1; }
@media (max-width: 640px) {
  .nav ul li:nth-child(n+3):not(:last-child) { display: none; }
}

/* ---------------- HERO ----------------
   Two columns: text on the left, a 3D profile card on the right.
   The card lives in a perspective "stage"; JS sets --rx/--ry from the pointer,
   and inner layers sit at different translateZ depths so they separate in 3D. */
.hero {
  position: relative;
  min-height: 100svh;
  background:
    radial-gradient(60rem 40rem at 78% 40%, rgba(27,111,128,.35), transparent 60%),
    var(--ink);
  color: #fff;
  overflow: hidden;
  display: flex; align-items: center;
  padding: 7rem var(--gutter) 4rem;
}
.hero-grid {
  position: relative; z-index: 2;
  width: 100%; max-width: var(--max); margin: 0 auto;
  display: grid; grid-template-columns: 1.05fr 1fr; gap: clamp(2rem, 5vw, 5rem); align-items: center;
}
.hero-name {
  font-family: var(--sans);
  font-weight: 800;
  font-size: clamp(3.4rem, 9vw, 8rem);
  line-height: .86;
  letter-spacing: -0.045em;
  margin: 0 0 1.75rem;
}
.hero-lede {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.9vw, 1.45rem);
  line-height: 1.45;
  max-width: 32ch;
  margin: 0 0 2rem;
  color: #E4EEEF;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-block;
  font-family: var(--sans); font-weight: 600; font-size: .98rem;
  padding: .8rem 1.3rem; border-radius: 999px; text-decoration: none;
  transition: background-color .2s ease, color .2s ease, transform .25s cubic-bezier(.2,.8,.2,1);
}
.btn-solid { background: #fff; color: var(--ink); }
.btn-solid:hover { background: var(--signal); }
.btn-line { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.55); }
.btn-line:hover { box-shadow: inset 0 0 0 1.5px #fff; background: rgba(255,255,255,.06); }
/* profile links in the hero: icon + label pills, same family as the buttons */
.hero-links { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 1.1rem 0 0; padding: 0; }
.pill {
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--sans); font-weight: 500; font-size: .92rem;
  color: #fff; text-decoration: none;
  padding: .55rem .95rem; border-radius: 999px;
  background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px rgba(255,255,255,.22);
  transition: background-color .2s ease, transform .25s cubic-bezier(.2,.8,.2,1);
}
.pill:hover { background: rgba(255,255,255,.16); }
.pill svg { width: 1rem; height: 1rem; fill: currentColor; flex: none; }
.dot { display: inline-block; width: .55rem; height: .55rem; border-radius: 50%; background: var(--signal); flex: none; }

/* the 3D card */
.card-stage { perspective: 1100px; display: grid; justify-items: center; gap: 1rem; }
.id-card {
  --rx: 0deg; --ry: 0deg;
  position: relative;
  width: min(100%, 27rem);
  border-radius: 22px;
  background: var(--paper);
  color: var(--ink);
  transform-style: preserve-3d;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.6), 0 18px 30px -18px rgba(0,0,0,.5);
  will-change: transform;
}
.id-card.is-live { transition: transform .08s linear; }
.id-top {
  position: relative;
  height: 17rem;
  border-radius: 22px 22px 0 0;
  background: radial-gradient(circle at 70% 30%, #1d4a55, #0b2128 70%);
  overflow: hidden;
  transform: translateZ(18px);
}
#network { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
#network:active { cursor: grabbing; }
.id-badge {
  position: absolute; left: 1rem; top: 1rem;
  display: inline-flex; align-items: center; gap: .5rem;
  font-family: var(--sans); font-size: .8rem; font-weight: 500; color: #fff;
  background: rgba(255,255,255,.1); backdrop-filter: blur(6px);
  padding: .4rem .75rem; border-radius: 999px;
  transform: translateZ(30px);
  pointer-events: none;
}
.id-mono {
  position: absolute; left: 1.1rem; bottom: .2rem;
  font-family: var(--sans); font-weight: 800; font-size: 4.6rem; letter-spacing: -0.06em; line-height: 1;
  color: rgba(255,255,255,.92);
  pointer-events: none;
}
.id-rows { margin: 0; padding: .6rem 1.4rem 1.2rem; transform: translateZ(10px); }
.id-rows > div { display: grid; grid-template-columns: 6.5rem 1fr; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.id-rows > div:last-child { border-bottom: 0; }
.id-rows dt { font-family: var(--sans); font-size: .85rem; color: var(--muted); }
.id-rows dd { margin: 0; font-family: var(--sans); font-weight: 600; font-size: .92rem; }
.card-hint { font-family: var(--sans); font-size: var(--s-1); color: var(--mist); margin: 0; }

/* soft light that follows the pointer across the hero */
.glow {
  position: absolute; left: 0; top: 0; width: 34rem; height: 34rem; z-index: 1;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(157,188,194,.14), transparent 60%);
  transform: translate3d(-50%, -50%, 0);
  opacity: 0; transition: opacity .3s ease;
}
.hero:hover .glow { opacity: 1; }

@media (max-width: 900px) {
  .hero { padding-top: 6rem; }
  .hero-grid { grid-template-columns: 1fr; }
  .id-top { height: 14rem; }
}

/* ---------------- CONTENT BLOCKS ----------------
   Two-column grid: section name on the left (sticky),
   content on the right. Collapses to one column on mobile. */
main { max-width: calc(var(--max) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.block {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) 3fr;
  gap: 1.5rem clamp(1.5rem, 5vw, 4rem);
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--rule);
}
main > .block:first-child { border-top: 0; }
.block-title {
  font-family: var(--sans); font-weight: 600; font-size: var(--s1);
  letter-spacing: -0.01em; margin: 0;
  align-self: start; position: sticky; top: 5rem;
}
.block-body { min-width: 0; }
@media (max-width: 760px) {
  .block { grid-template-columns: 1fr; }
  .block-title { position: static; }
}

.prose p { margin: 0 0 1.1em; max-width: 64ch; }
.prose p:last-child { margin-bottom: 0; }

h3 { font-family: var(--sans); font-weight: 600; font-size: var(--s1); line-height: 1.25; letter-spacing: -0.01em; margin: 0; }
.note { color: var(--muted); margin: .4rem 0 0; max-width: 62ch; }

/* About */
.about { display: grid; grid-template-columns: 11rem 1fr; gap: 2rem; align-items: start; }
.portrait { width: 11rem; height: 11rem; object-fit: cover; border-radius: 50%; background: #fff; box-shadow: 0 0 0 6px #fff, 0 0 0 7px var(--rule); }
@media (max-width: 560px) { .about { grid-template-columns: 1fr; } .portrait { width: 8rem; height: 8rem; } }

/* Timeline (a real sequence, so dates lead each row) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li {
  display: grid; grid-template-columns: 9.5rem 1fr; gap: 1.5rem;
  padding: 0 0 2.25rem;
}
.timeline > li:last-child { padding-bottom: 0; }
.when { font-family: var(--sans); font-size: var(--s-1); color: var(--muted); margin: .3rem 0 0; font-variant-numeric: tabular-nums; }
.where { font-family: var(--sans); color: var(--muted); margin: .2rem 0 0; font-size: .95rem; }
.points { margin: .85rem 0 0; padding-left: 1.1rem; max-width: 64ch; }
.points li { margin-bottom: .35rem; }
.points li::marker { color: var(--teal); }
@media (max-width: 560px) { .timeline > li { grid-template-columns: 1fr; gap: .2rem; } }

/* Paper / article entries */
.paper-venue { font-family: var(--sans); font-size: var(--s-1); color: var(--muted); margin: 0 0 .35rem; }
.paper-title { font-size: var(--s2); line-height: 1.15; letter-spacing: -0.02em; max-width: 24ch; }
.paper-title a { color: var(--ink); text-decoration: none; background-image: linear-gradient(var(--signal), var(--signal)); background-size: 0 2px; background-position: 0 100%; background-repeat: no-repeat; transition: background-size .3s ease; }
.paper-title a:hover { background-size: 100% 2px; }
.links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1rem 0 0; font-family: var(--sans); font-size: .95rem; }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.chip {
  font-family: var(--sans); font-size: .9rem; font-weight: 500;
  border: 1px solid var(--rule); background: transparent; color: var(--ink);
  padding: .45rem .9rem; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: inset 0 -3px 0 var(--signal); }

.projects { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.project {
  display: flex; flex-direction: column; gap: .55rem;
  padding: 1.35rem 1.4rem 1.25rem;
  background: #fff; border: 1px solid var(--rule); border-radius: 16px;
}
.project[hidden] { display: none; }
.project h3 { font-size: 1.12rem; }
.project h3 a { color: var(--ink); text-decoration: none; }
/* whole card is clickable through the title link */
.project h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.project:hover h3 a { color: var(--teal); }
.project p { margin: 0; }
.project .tools { margin-top: auto; padding-top: .4rem; font-family: var(--sans); font-size: var(--s-1); color: var(--muted); }
@media (max-width: 760px) { .projects { grid-template-columns: 1fr; } }

/* 3D tilt for cards: JS sets --rx/--ry while the pointer is over them */
.tilt {
  --rx: 0deg; --ry: 0deg;
  position: relative;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .45s cubic-bezier(.2,.8,.2,1), box-shadow .3s ease;
  will-change: transform;
}
.tilt.is-live { transition: transform .08s linear, box-shadow .3s ease; box-shadow: 0 24px 40px -24px rgba(14,40,48,.45); }
.paper.tilt { padding: 1.5rem 1.6rem; background: #fff; border: 1px solid var(--rule); border-radius: 16px; }

/* cards rise into place in 3D the first time they scroll into view */
.reveal { opacity: 0; transform: perspective(900px) rotateX(14deg) translateY(24px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.reveal.is-in { opacity: 1; transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }

/* Toolbox */
.toolbox { margin: 0; }
.toolbox > div { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.toolbox > div:first-child { border-top: 1px solid var(--rule); }
.toolbox dt { font-family: var(--sans); font-weight: 600; }
.toolbox dd { margin: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .glow { display: none; }
  * { transition: none !important; }
}

/* Education: bold "Thesis:" / "Coursework:" labels on their own lines */
.note strong { font-family: var(--sans); font-weight: 600; color: var(--ink); }
