/* ==========================================================================
   Vesselin Bontchev – personal site
   Plain CSS, no framework, no JavaScript. Edit the colours in :root.
   Sections:  1 tokens · 2 base · 3 header · 4 footer · 5 buttons · 6 home page · 7 papers index · 8 print
   ========================================================================== */

/* 1 ─ Tokens ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light dark;

  --bg:          #f6f4ee;   /* page */
  --surface:     #fffdf8;   /* cards */
  --ink:         #1b2229;   /* body text */
  --muted:       #566170;   /* secondary text */
  --rule:        #dcd6c8;   /* hairlines */
  --accent:      #0b5c66;   /* links, marks */
  --accent-ink:  #ffffff;   /* text on accent */
  --accent-soft: #dfecea;
  --grid:        rgb(20 30 40 / .05);
  --band:        #0d3c44;   /* dark call-out band */
  --band-ink:    #eef4f3;
  --warn:        #8a5a00;
  --warn-soft:   #f7ecd2;
  --shadow:      0 1px 2px rgb(20 30 40 / .06), 0 10px 28px rgb(20 30 40 / .07);

  --serif: "Iowan Old Style", Charter, "Sitka Text", Cambria, Georgia, "Noto Serif", "DejaVu Serif", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono:  ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: clamp(1rem, 4vw, 2rem);
  --wrap:   70rem;
  --radius: 10px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #11161a;
    --surface:     #182025;
    --ink:         #e9e5dc;
    --muted:       #9ca8b4;
    --rule:        #2a343c;
    --accent:      #72c9d2;
    --accent-ink:  #0a1417;
    --accent-soft: #1a3339;
    --grid:        rgb(255 255 255 / .04);
    --band:        #123a42;
    --band-ink:    #eef4f3;
    --warn:        #e9b955;
    --warn-soft:   #2c2615;
    --shadow:      0 1px 2px rgb(0 0 0 / .45), 0 10px 28px rgb(0 0 0 / .35);
  }
}

/* 2 ─ Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;           /* room for the sticky header when jumping to anchors */
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; }

a {
  color: var(--accent);
  text-decoration-thickness: .08em;
  text-underline-offset: .18em;
}
a:hover { text-decoration-thickness: .15em; }

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

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

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }

.skip-link {
  position: absolute; left: var(--gutter); top: -4rem; z-index: 100;
  padding: .6rem 1rem; border-radius: 6px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: .75rem; }

h1, h2, h3, h4 { text-wrap: balance; }

/* 3 ─ Header ─────────────────────────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--rule);
}
.bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .25rem 1.5rem; min-height: 3.5rem; padding-block: .35rem;
}
.brand {
  display: inline-flex; align-items: center; gap: .7rem;
  color: var(--ink); text-decoration: none;
}
.brand .mark {
  display: grid; place-items: center; width: 2rem; height: 2rem;
  border-radius: 7px; background: var(--ink); color: var(--bg);
  font: 700 .78rem/1 var(--mono); letter-spacing: .02em;
}
.brand-name { font: 600 1.08rem/1 var(--serif); letter-spacing: -.005em; }

.site-header nav ul { display: flex; flex-wrap: wrap; gap: .1rem; margin: 0; padding: 0; list-style: none; }
.site-header nav a {
  display: block; padding: .5rem .7rem; border-radius: 6px;
  color: var(--muted); font-size: .95rem; font-weight: 500; text-decoration: none;
}
.site-header nav a:hover { color: var(--ink); background: var(--accent-soft); }
.site-header nav a[aria-current] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 6px 6px 0 0; }

/* 4 ─ Footer ─────────────────────────────────────────────────────────────── */
.site-footer { margin-top: 2rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .92rem; }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: .75rem 2rem; padding-block: 1.75rem 2.25rem;
}
.site-footer p { margin: 0; }
.foot-name { font-family: var(--serif); color: var(--ink); }
.foot-name span { color: var(--muted); font-family: var(--sans); }
.site-footer ul { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0; padding: 0; list-style: none; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* 5 ─ Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .72rem 1.2rem; border-radius: 8px;
  border: 1.5px solid var(--accent);
  background: var(--accent); color: var(--accent-ink);
  font: 600 .96rem/1.2 var(--sans); text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease, background-color .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgb(0 0 0 / .18); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: var(--accent-soft); box-shadow: none; }
.btn.on-band { background: var(--band-ink); border-color: var(--band-ink); color: var(--band); }
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } .btn:hover { transform: none; } }

.eyebrow {
  margin: 0; color: var(--accent);
  font: 600 .76rem/1.2 var(--mono); letter-spacing: .15em; text-transform: uppercase;
}

/* 6 ─ Home page ──────────────────────────────────────────────────────────── */
.hero { position: relative; isolation: isolate; overflow: clip; border-bottom: 1px solid var(--rule); }
.hero::before {                                  /* faint graph-paper grid */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 34px 34px;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 30%, transparent 100%);
}
.hero-grid {
  display: grid; gap: 2.5rem; align-items: center;
  grid-template-columns: minmax(0, 1fr);
  padding-block: clamp(2.25rem, 6vw, 5rem) clamp(2.5rem, 6vw, 5rem);
}
@media (min-width: 54rem) { .hero-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, .6fr); gap: 4rem; } }

.name {
  margin: .9rem 0 1.1rem;
  font: 600 clamp(2.35rem, 1.1rem + 5.2vw, 4.4rem)/1.04 var(--serif);
  letter-spacing: -.022em;
}
.name .given { display: block; }
.lede { max-width: 34rem; margin: 0 0 1.75rem; font: 1.26rem/1.55 var(--serif); color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.portrait { margin: 0 14px 14px 0; justify-self: center; width: min(100%, 21rem); position: relative; isolation: isolate; }
.portrait img {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover;
  border-radius: var(--radius); box-shadow: var(--shadow); background: var(--surface);
  object-position: 48% 30%;          /* the photo is landscape; keep the face centred in the 4:5 crop */
}
.portrait::after {
  content: ""; position: absolute; z-index: -1; inset: 14px -14px -14px 14px;
  border: 2px solid var(--accent); border-radius: var(--radius); opacity: .55;
}

.section { padding-block: clamp(2.75rem, 6vw, 4.75rem); }
.section + .section { border-top: 1px solid var(--rule); }
.section-head { display: flex; align-items: baseline; gap: 1rem; margin-bottom: clamp(1.5rem, 3vw, 2.25rem); }
.section-head .num { font: 600 .82rem/1 var(--mono); color: var(--accent); letter-spacing: .06em; }
.section-head h2 { margin: 0; font: 600 clamp(1.65rem, 1.2rem + 1.7vw, 2.3rem)/1.15 var(--serif); letter-spacing: -.012em; }

/* About */
.about { display: grid; gap: 2.5rem 4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 54rem) { .about { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); } }
.prose { max-width: 40rem; }
.prose p { margin: 0 0 1.1rem; }
.prose p:last-child { margin-bottom: 0; }
.nb { white-space: nowrap; }
.prose strong { font-weight: 600; }

.timeline-wrap h3 { margin: 0 0 1.25rem; font: 600 .78rem/1.2 var(--mono); letter-spacing: .15em; text-transform: uppercase; color: var(--muted); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.4rem; border-left: 2px solid var(--rule); display: grid; gap: 1.2rem; }
.timeline li { position: relative; }
.timeline li::before {
  content: ""; position: absolute; top: .38rem; left: calc(-1.4rem - 7px);
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent);
}
.timeline li.now::before { background: var(--accent); }
.timeline .when { display: block; font: 600 .82rem/1.4 var(--mono); color: var(--accent); letter-spacing: .03em; }
.timeline p { margin: .1rem 0 0; font-size: .98rem; line-height: 1.5; }

/* Cards */
.cards { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18.5rem), 1fr)); }
.card {
  position: relative;
  display: flex; flex-direction: column; gap: .8rem; padding: 1.5rem;
  background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius);
}
.card h3 { margin: 0; font: 600 1.28rem/1.25 var(--serif); letter-spacing: -.005em; }
.card .tag { margin: 0; font: 600 .72rem/1.2 var(--mono); letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.card p { margin: 0; }
.card .badge { display: flex; align-items: center; gap: 1rem; min-height: 3rem; }
.card .badge img { display: block; }
.card .more { margin-top: auto; padding-top: .25rem; font-weight: 600; }
.card .more::after { content: ""; position: absolute; inset: 0; }   /* whole card is clickable */
.card:hover { border-color: var(--accent); }
.card:focus-within { outline: 3px solid var(--accent); outline-offset: 3px; }
.card .more:focus-visible { outline: 0; }
.card.photo { padding: 0; overflow: hidden; }
.card.photo img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.card.photo .inner { display: flex; flex-direction: column; gap: .8rem; padding: 1.5rem; flex: 1; }

/* Papers band */
.band { background: var(--band); color: var(--band-ink); }
.band .wrap { display: grid; gap: 1.5rem 3rem; align-items: center; padding-block: clamp(2.5rem, 5vw, 3.75rem); }
@media (min-width: 48rem) { .band .wrap { grid-template-columns: minmax(0, 1fr) auto; } }
.band .eyebrow { color: #8fd6de; }
.band p { margin: 0; }
.band .statement { margin-top: .6rem; max-width: 40rem; font: clamp(1.3rem, 1.05rem + 1vw, 1.75rem)/1.35 var(--serif); }

/* Contact */
.contact { display: grid; gap: 2rem 4rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 54rem) { .contact { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); align-items: start; } }
.contact .lead { margin: 0; max-width: 28rem; font: 1.2rem/1.5 var(--serif); }
.contact-card { margin: 0; padding: .4rem 1.5rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.contact-card .row { display: grid; gap: .6rem 1.5rem; align-items: center; grid-template-columns: minmax(0, 1fr); padding-block: 1rem; }
.contact-card .row + .row { border-top: 1px solid var(--rule); }
@media (min-width: 34rem) { .contact-card .row { grid-template-columns: 7.5rem minmax(0, 1fr); } }
.contact-card dt { margin: 0; }
.contact-card dt img { display: block; padding: 4px; border-radius: 8px; background: #fff; }   /* the GIFs have white backgrounds */
.contact-card dd { margin: 0; overflow-wrap: anywhere; }
.contact-card address { font-style: normal; }
.contact-card .nospam { display: inline-block; vertical-align: middle; margin-left: .6rem; }

/* 7 ─ Papers index ───────────────────────────────────────────────────────── */
.page-head { padding-block: clamp(2.25rem, 5vw, 4rem) clamp(1.5rem, 3vw, 2.5rem); border-bottom: 1px solid var(--rule); }
.page-head h1 { margin: .8rem 0 1rem; font: 600 clamp(2.1rem, 1.3rem + 3.2vw, 3.3rem)/1.08 var(--serif); letter-spacing: -.02em; }
.page-head .lede { margin: 0; }

.years { padding-block: clamp(1.5rem, 4vw, 3rem) 1rem; }
.year { display: grid; gap: .5rem 3rem; grid-template-columns: minmax(0, 1fr); padding-block: 1.75rem; }
.year + .year { border-top: 1px solid var(--rule); }
@media (min-width: 46rem) { .year { grid-template-columns: 7rem minmax(0, 1fr); } }
.year h2 {
  margin: 0; align-self: start; position: sticky; top: 5rem;
  font: 600 2.1rem/1 var(--serif); letter-spacing: -.01em; color: var(--muted);
  font-variant-numeric: lining-nums tabular-nums;
}
@media (max-width: 45.99rem) { .year h2 { position: static; font-size: 1.7rem; } }

.pubs { display: grid; gap: 1.75rem; margin: 0; padding: 0; list-style: none; }
.pub { padding-left: 1.1rem; border-left: 2px solid var(--rule); }
.pub.has-text { border-left-color: var(--accent); }
.pub p { margin: 0; }
.pub-title { font: 600 1.28rem/1.3 var(--serif); letter-spacing: -.004em; }
.pub-title a { text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.pub-title a:hover { text-decoration-color: currentColor; }
.pub-meta { margin-top: .3rem; color: var(--muted); font-size: .98rem; line-height: 1.5; }
.pub-meta .authors { color: var(--ink); }
.pub-key { margin-top: .45rem; font: 500 .8rem/1.2 var(--mono); color: var(--muted); letter-spacing: .01em; }
a.ext::after { content: " \2197"; font-size: .8em; text-decoration: none; display: inline-block; }

/* 8 ─ Print ──────────────────────────────────────────────────────────────── */
@media print {
  :root { --bg: #fff; --surface: #fff; --ink: #000; --muted: #333; --rule: #bbb; --accent: #000; --accent-soft: #eee; }
  html { scroll-padding-top: 0; }
  body { font-size: 11pt; background: #fff; }
  .site-header, .site-footer, .skip-link, .actions, .hero::before, .portrait::after, .btn { display: none !important; }
  .hero, .band, .section { border: 0; }
  .band { background: none; color: #000; }
  .hero-grid { grid-template-columns: 1fr 12rem; }
  a { color: inherit; }
}

/* ── Photo gallery (hawaii/) ─────────────────────────────────────────────── */
.gallery { display: grid; gap: 1.25rem; margin: 2rem 0 0; padding: 0; list-style: none;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14.5rem), 1fr)); }
.gallery figure { margin: 0; height: 100%; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.gallery a { display: flex; flex-direction: column; height: 100%; color: var(--ink); text-decoration: none; }
.gallery img { display: block; width: 100%; height: auto; aspect-ratio: 235 / 157; object-fit: cover; background: var(--rule); }
.gallery figcaption { padding: .7rem .9rem .85rem; font: .95rem/1.4 var(--sans); }
.gallery figure:hover { border-color: var(--accent); }
.gallery a:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.gallery a:hover figcaption { color: var(--accent); }
.gallery-note { margin: 1.25rem 0 0; color: var(--muted); font: .92rem/1.5 var(--sans); }
.page-head .crumb { margin: 1.5rem 0 0; font: 500 .92rem/1.4 var(--sans); }
.page-head .crumb a { text-decoration: none; }
.page-head .crumb a:hover { text-decoration: underline; }
/* albums whose thumbnails come in mixed shapes */
.gallery.free { align-items: start; }
.gallery.free figure { height: auto; }
.gallery.free img { aspect-ratio: auto; object-fit: initial; background: none; }
.gallery .note { grid-column: 1 / -1; max-width: 42rem; margin: .5rem 0; font: 1.1rem/1.6 var(--serif); }
.gallery .bare figure { background: none; border: 0; }
