/* ==========================================================================
   Tommaso Tulkens — site styles
   A quiet, editorial system: warm paper, deep ink, one navy accent.
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */
:root {
  --paper:       #faf9f6;
  --paper-tint:  #f4f2ec;
  --surface:     #ffffff;
  --ink:         #191817;
  --ink-2:       #55524b;
  --ink-3:       #8b877e;
  --rule:        #e5e0d7;
  --rule-soft:   #efebe3;
  --accent:      #1f3d5a;
  --accent-hi:   #2f5c85;
  --accent-wash: #edf1f5;

  --shadow-sm: 0 1px 2px rgba(25, 24, 23, .05);
  --shadow-md: 0 1px 2px rgba(25, 24, 23, .04), 0 14px 32px -18px rgba(25, 24, 23, .28);

  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;

  --shell:  74rem;
  --measure: 40rem;

  --step-hero: clamp(2.6rem, 1.75rem + 3.4vw, 4.2rem);
  --step-h1:   clamp(2.1rem, 1.6rem + 2.1vw, 3.1rem);
  --step-h2:   clamp(1.3rem, 1.18rem + .5vw, 1.6rem);
  --step-h3:   clamp(1.08rem, 1.02rem + .3vw, 1.25rem);
  --step-body: 1.0625rem;
  --step-sm:   .875rem;
  --step-xs:   .78125rem;

  --ease: cubic-bezier(.4, 0, .2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:       #101113;
    --paper-tint:  #17191c;
    --surface:     #16181b;
    --ink:         #ecebe6;
    --ink-2:       #a8a59d;
    --ink-3:       #7b786f;
    --rule:        #282a2e;
    --rule-soft:   #1f2124;
    --accent:      #93bcdd;
    --accent-hi:   #b6d6f0;
    --accent-wash: #17242f;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .35), 0 14px 32px -18px rgba(0, 0, 0, .8);
  }
}

/* ---------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-body);
  line-height: 1.72;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.22; letter-spacing: -.012em; }
p, ul, ol { margin: 0 0 1.15em; }
ul, ol { padding-left: 1.15rem; }
li { margin-bottom: .35em; }
li::marker { color: var(--ink-3); }
hr { border: 0; border-top: 1px solid var(--rule); margin: 3rem 0; }

a { color: var(--accent); text-decoration: none; }
a:not([class]) {
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 100% 1px;
  background-repeat: no-repeat;
  background-position: 0 calc(100% - .08em);
  padding-bottom: .05em;
  transition: color .18s var(--ease), background-size .18s var(--ease);
}
a:not([class]):hover { color: var(--accent-hi); background-size: 100% 2px; }

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

.u-visually-hidden {
  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: -4rem; z-index: 100;
  background: var(--accent); color: #fff;
  padding: .6rem 1rem; border-radius: 6px;
  font-family: var(--sans); font-size: var(--step-sm);
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 1rem; }

/* -------------------------------------------------------------- shell ---- */
.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3.5rem);
}
.main { flex: 1 0 auto; padding-bottom: clamp(3.5rem, 7vw, 6rem); }

/* ----------------------------------------------------------- masthead ---- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.masthead.is-stuck { border-bottom-color: var(--rule); }

@supports not (backdrop-filter: blur(1px)) {
  .masthead { background: var(--paper); }
}

.masthead__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.25rem;
}

.masthead__name {
  font-family: var(--serif);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
  white-space: nowrap;
  transition: color .18s var(--ease);
}
.masthead__name:hover { color: var(--accent); }
.masthead__given { color: var(--ink-3); font-weight: 400; }

.nav { display: flex; align-items: center; gap: clamp(1rem, 2.4vw, 2rem); }

.nav__link {
  position: relative;
  font-family: var(--sans);
  font-size: var(--step-sm);
  font-weight: 500;
  letter-spacing: .005em;
  color: var(--ink-2);
  padding-block: .35rem;
  transition: color .18s var(--ease);
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .25s var(--ease);
}
.nav__link:hover { color: var(--ink); }
.nav__link:hover::after { transform: scaleX(1); }
.nav__link.is-current { color: var(--accent); }
.nav__link.is-current::after { transform: scaleX(1); }

.masthead__toggle {
  display: none;
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: .5rem .6rem;
  cursor: pointer;
  color: var(--ink);
}
.masthead__toggle-bars { display: block; width: 18px; }
.masthead__toggle-bars i {
  display: block; height: 1.5px; background: currentColor; border-radius: 2px;
  transition: transform .25s var(--ease), opacity .2s var(--ease);
}
.masthead__toggle-bars i + i { margin-top: 5px; }
.masthead__toggle[aria-expanded="true"] i:first-child { transform: translateY(3.25px) rotate(45deg); }
.masthead__toggle[aria-expanded="true"] i:last-child  { transform: translateY(-3.25px) rotate(-45deg); }

@media (max-width: 44rem) {
  .masthead__inner { flex-wrap: wrap; }
  .masthead__toggle { display: block; }
  .nav {
    flex-basis: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    overflow: hidden;
    max-height: 0;
    visibility: hidden;
    transition: max-height .3s var(--ease), visibility 0s linear .3s;
  }
  .nav.is-open {
    max-height: 16rem;
    visibility: visible;
    transition: max-height .3s var(--ease), visibility 0s;
  }
  .nav__link { width: 100%; padding-block: .7rem; border-top: 1px solid var(--rule-soft); }
  .nav__link::after { display: none; }
}

/* ------------------------------------------------------------- eyebrow --- */
.eyebrow {
  font-family: var(--sans);
  font-size: var(--step-xs);
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 .9rem;
}

.lede {
  font-size: clamp(1.1rem, 1.03rem + .32vw, 1.28rem);
  line-height: 1.6;
  color: var(--ink-2);
  max-width: var(--measure);
  margin: 1.1rem 0 0;
  text-wrap: pretty;
}

/* ----------------------------------------------------------- page head --- */
.page-head {
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(1.75rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--rule);
  margin-bottom: clamp(2rem, 4vw, 3.25rem);
}
.page-head__title {
  font-size: var(--step-h1);
  max-width: 20ch;
  text-wrap: balance;
}
.page-body > *:first-child { margin-top: 0; }

/* ---------------------------------------------------------------- hero --- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 19rem);
  gap: clamp(2.25rem, 5.5vw, 5rem);
  align-items: start;
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2.5rem, 5vw, 4rem);
}
@media (max-width: 56rem) {
  .hero { grid-template-columns: 1fr; gap: 2.5rem; }
  .hero__figure { order: -1; max-width: 15rem; }
}

.hero__name {
  font-size: var(--step-hero);
  line-height: 1.02;
  letter-spacing: -.028em;
  margin: 0;
  text-wrap: balance;
}
.hero__rule {
  width: 3.25rem; height: 2px;
  background: var(--accent);
  margin: 1.6rem 0 1.5rem;
  border-radius: 2px;
}
.hero__body { max-width: var(--measure); }
.hero__body p { color: var(--ink-2); }
.hero__body strong { color: var(--ink); font-weight: 600; }

.hero__figure { position: relative; margin: 0; }
.hero__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 5px;
  box-shadow: var(--shadow-md);
  position: relative;
  z-index: 1;
}
.hero__figure::after {
  content: "";
  position: absolute;
  inset: .9rem -.9rem -.9rem .9rem;
  border: 1px solid var(--accent);
  border-radius: 5px;
  opacity: .28;
  pointer-events: none;
}

/* ------------------------------------------------------------- factbox --- */
.facts {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
  display: grid;
  gap: .85rem;
}
.facts li {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  margin: 0;
  font-size: var(--step-sm);
  align-items: baseline;
}
.facts dt, .facts .facts__key {
  font-family: var(--sans);
  font-size: var(--step-xs);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.facts .facts__val { color: var(--ink-2); }
@media (max-width: 30rem) {
  .facts li { grid-template-columns: 1fr; gap: .15rem; }
}

/* --------------------------------------------------------------- chips --- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: 1.25rem 0 0; list-style: none; }
.chips li { margin: 0; }
.chip {
  display: inline-block;
  font-family: var(--sans);
  font-size: var(--step-xs);
  font-weight: 500;
  letter-spacing: .02em;
  color: var(--ink-2);
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .3rem .75rem;
}

/* ------------------------------------------------------------- buttons --- */
.actions { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.actions--hero { margin-top: 2.25rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--sans);
  font-size: var(--step-sm);
  font-weight: 500;
  letter-spacing: .005em;
  line-height: 1;
  padding: .58rem .95rem;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: color .18s var(--ease), border-color .18s var(--ease),
              background-color .18s var(--ease), transform .18s var(--ease),
              box-shadow .18s var(--ease);
}
.btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--rule));
  background: var(--accent-wash);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--paper);
}
.btn--primary:hover {
  background: var(--accent-hi);
  border-color: var(--accent-hi);
  color: var(--paper);
}

.btn--quiet {
  background: transparent;
  box-shadow: none;
  border-style: dashed;
  color: var(--ink-3);
  cursor: default;
}
.btn--quiet:hover {
  transform: none;
  background: transparent;
  box-shadow: none;
  color: var(--ink-3);
  border-color: var(--rule);
}

.btn__icon { flex: none; width: 14px; height: 14px; stroke-width: 1.6; }
.btn__chev { transition: transform .28s var(--ease); }
.btn[aria-expanded="true"] .btn__chev { transform: rotate(180deg); }
.btn[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-wash); }
.btn[aria-expanded="true"] { border-color: color-mix(in srgb, var(--accent) 45%, var(--rule)); }

/* -------------------------------------------------------------- papers --- */
.section { padding-block: clamp(2.25rem, 4.5vw, 3.5rem) 0; }
.section + .section,
.section--ruled { border-top: 1px solid var(--rule); margin-top: clamp(2.25rem, 4.5vw, 3.5rem); }
.page-body > .section:first-child { padding-top: 0; }
.section__title {
  font-size: var(--step-h2);
  margin-bottom: .35rem;
}
.section__note {
  font-family: var(--sans);
  font-size: var(--step-sm);
  color: var(--ink-3);
  margin-bottom: 2rem;
  max-width: var(--measure);
}

.papers { list-style: none; margin: 0; padding: 0; }
.papers > li { margin: 0; }

.paper {
  padding-block: clamp(1.6rem, 3vw, 2.25rem);
  border-top: 1px solid var(--rule-soft);
}
.papers > li:first-child .paper { border-top: 0; padding-top: 0; }

.paper__status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--sans);
  font-size: var(--step-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .7rem;
}
.paper__status::before {
  content: "";
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent);
  opacity: .6;
}

.paper__title {
  font-size: var(--step-h3);
  line-height: 1.34;
  max-width: 46ch;
  text-wrap: pretty;
}
.paper__title a { color: inherit; transition: color .18s var(--ease); }
.paper__title a:hover { color: var(--accent); }

.paper__authors {
  font-family: var(--sans);
  font-size: var(--step-sm);
  color: var(--ink-3);
  margin: .5rem 0 0;
}
.paper .actions { margin-top: 1.15rem; }

/* -------------------------------------------------------- abstract fold -- */
.abstract[hidden] { display: none; }
.abstract {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .38s var(--ease);
}
.abstract.is-open { grid-template-rows: 1fr; }
.abstract__inner { overflow: hidden; }
.abstract__text {
  margin: 1.25rem 0 0;
  padding: .1rem 0 .1rem 1.15rem;
  border-left: 2px solid var(--rule);
  border-left-color: color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--ink-2);
  font-size: .9875rem;
  line-height: 1.7;
  max-width: 62ch;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s var(--ease) .06s, transform .3s var(--ease) .06s;
}
.abstract.is-open .abstract__text { opacity: 1; transform: none; }

/* ------------------------------------------------------------- courses --- */
.courses { display: grid; gap: clamp(1.25rem, 2.5vw, 1.75rem); list-style: none; padding: 0; margin: 0; }
.courses > li { margin: 0; }

.course {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: clamp(1.4rem, 3vw, 2.1rem);
  box-shadow: var(--shadow-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.course:hover { border-color: var(--rule); box-shadow: var(--shadow-md); }
.course:hover { border-color: color-mix(in srgb, var(--accent) 28%, var(--rule)); }

.course__code {
  font-family: var(--sans);
  font-size: var(--step-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: .6rem;
}
.course__title { font-size: var(--step-h3); }
.course__meta {
  font-family: var(--sans);
  font-size: var(--step-sm);
  color: var(--ink-3);
  margin: .55rem 0 0;
}
.course__desc { margin: 1.1rem 0 0; color: var(--ink-2); max-width: 58ch; }

.materials {
  margin: 1.5rem 0 0;
  padding: 1.25rem 0 0;
  border-top: 1px solid var(--rule-soft);
}
.materials__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .15rem;
}
.materials__label {
  font-family: var(--sans);
  font-size: var(--step-xs);
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .85rem;
}
.materials li { margin: 0; }

.material {
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: .6rem .75rem;
  margin-inline: -.75rem;
  border-radius: 8px;
  color: var(--ink);
  font-size: var(--step-sm);
  transition: background-color .18s var(--ease), color .18s var(--ease);
}
.material:hover { background: var(--accent-wash); color: var(--accent); }
.material__icon { flex: none; width: 15px; height: 15px; color: var(--ink-3); transform: translateY(2px); stroke-width: 1.6; }
.material:hover .material__icon { color: var(--accent); }
.material__name { flex: 1 1 auto; }
.material__tag {
  font-family: var(--sans);
  font-size: var(--step-xs);
  color: var(--ink-3);
  white-space: nowrap;
}

.material--empty { color: var(--ink-3); cursor: default; }
.material--empty:hover { background: transparent; color: var(--ink-3); }

/* --------------------------------------------------------------- notes --- */
.note {
  background: var(--paper-tint);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 1.15rem 1.35rem;
  font-size: var(--step-sm);
  color: var(--ink-2);
  margin: 2rem 0 0;
  max-width: var(--measure);
}
.note p:last-child { margin-bottom: 0; }
.note strong { color: var(--ink); }

/* --------------------------------------------------------------- media --- */
.entries { list-style: none; margin: 0; padding: 0; }
.entries > li { margin: 0; }

.entry {
  padding-block: clamp(1.5rem, 3vw, 2rem);
  border-top: 1px solid var(--rule-soft);
}
.entries > li:first-child .entry { border-top: 0; padding-top: 0; }

.entry__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
  font-family: var(--sans);
  font-size: var(--step-xs);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: .7rem;
}
.entry__outlet { font-weight: 600; color: var(--accent); }
.entry__lang {
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: .15rem .55rem;
  letter-spacing: .05em;
  text-transform: none;
}
.entry__title { font-size: var(--step-h3); line-height: 1.34; max-width: 42ch; text-wrap: pretty; }
.entry__title a { color: inherit; transition: color .18s var(--ease); }
.entry__title a:hover { color: var(--accent); }
.entry__desc { margin: .75rem 0 0; color: var(--ink-2); max-width: var(--measure); }

/* ------------------------------------------------------- homepage list --- */
.preview { list-style: none; margin: 0; padding: 0; }
.preview > li { margin: 0; }
.preview__item {
  display: block;
  padding-block: 1.25rem;
  border-top: 1px solid var(--rule-soft);
  color: inherit;
  transition: background-color .18s var(--ease);
}
.preview > li:first-child .preview__item { border-top: 0; }
.preview__item:hover .preview__title { color: var(--accent); }
.preview__title {
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.4;
  max-width: 48ch;
  transition: color .18s var(--ease);
}
.preview__meta {
  font-family: var(--sans);
  font-size: var(--step-xs);
  color: var(--ink-3);
  margin: .4rem 0 0;
}

.more {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin-top: 1.75rem;
  font-family: var(--sans);
  font-size: var(--step-sm);
  font-weight: 500;
  color: var(--accent);
}
.more svg { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.more:hover svg { transform: translateX(3px); }

/* -------------------------------------------------------------- footer --- */
.footer {
  border-top: 1px solid var(--rule);
  padding-block: clamp(2.25rem, 4vw, 3rem) 2rem;
  margin-top: auto;
}
.footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1.5rem 2rem;
}
.footer__name { font-weight: 600; margin: 0 0 .3rem; }
.footer__meta { margin: 0; font-size: var(--step-sm); color: var(--ink-3); }
.footer__meta a { color: var(--ink-3); }
.footer__meta a:hover { color: var(--accent); }
.footer__links { display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; }
.footer__links a { font-family: var(--sans); font-size: var(--step-sm); color: var(--ink-2); }
.footer__links a:hover { color: var(--accent); }
.footer__fine {
  margin: 2.25rem 0 0;
  font-family: var(--sans);
  font-size: var(--step-xs);
  color: var(--ink-3);
}

/* ------------------------------------------------------------- motion --- */
[data-reveal] {
  opacity: 0;
  transform: translateY(10px);
  animation: reveal .65s var(--ease) forwards;
}
[data-reveal]:nth-of-type(2) { animation-delay: .07s; }
[data-reveal]:nth-of-type(3) { animation-delay: .14s; }

@keyframes reveal { to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------- print -- */
@media print {
  .masthead, .footer, .skip-link, .btn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .abstract { grid-template-rows: 1fr; }
  .abstract__text { opacity: 1; transform: none; }
}
