/* kanavmor.com — stylesheet
   Typography: Newsreader (headings, names, paper titles) + Inter (body, UI).
   Colour: warm paper background, near-black text, one restrained red accent.  */

:root {
  --bg: #fbfaf8;
  --bg-elev: #ffffff;
  --fg: #1c1c1f;
  --fg-soft: #4b4d52;
  --fg-muted: #6f7177;
  --rule: #e6e2db;
  --rule-strong: #d2cdc4;
  --accent: #a4161f;
  --accent-hover: #7e1017;
  --accent-soft: #f6e9e8;
  --chip-bg: #f1eee8;
  --chip-fg: #3a3c41;
  --focus: #1f4fd8;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --measure: 42rem;
  --wrap: 68rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151517;
    --bg-elev: #1d1d20;
    --fg: #e9e6e0;
    --fg-soft: #c0bdb6;
    --fg-muted: #918e87;
    --rule: #2b2b2f;
    --rule-strong: #3a3a40;
    --accent: #e4737a;
    --accent-hover: #f09aa0;
    --accent-soft: #2a1b1c;
    --chip-bg: #232326;
    --chip-fg: #d4d1ca;
    --focus: #8fb0ff;
  }
}
:root[data-theme="dark"] {
  --bg: #151517; --bg-elev: #1d1d20; --fg: #e9e6e0; --fg-soft: #c0bdb6; --fg-muted: #918e87;
  --rule: #2b2b2f; --rule-strong: #3a3a40; --accent: #e4737a; --accent-hover: #f09aa0;
  --accent-soft: #2a1b1c; --chip-bg: #232326; --chip-fg: #d4d1ca; --focus: #8fb0ff;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-feature-settings: "kern", "liga", "calt";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, .brand, .name, .paper-title {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.15;
  color: var(--fg);
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2rem, 1.4rem + 2vw, 2.75rem); font-weight: 500; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.16em; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); transition: color .15s ease, text-decoration-color .15s ease; }
a:hover { color: var(--accent-hover); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 2px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wrap)); margin-inline: auto; }
.muted { color: var(--fg-muted); }
.nowrap { white-space: nowrap; }
.meta-sep { margin-inline: .45em; color: var(--fg-muted); }

.skip { position: absolute; left: -999px; top: 0; background: var(--bg-elev); color: var(--fg); padding: .5rem .75rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }

/* ---------- Top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--rule); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3.75rem; }
.brand { font-size: 1.25rem; text-decoration: none; color: var(--fg); white-space: nowrap; }
.brand:hover { color: var(--accent); }
.topbar nav { display: flex; gap: clamp(.9rem, 2.5vw, 1.75rem); }
.topbar nav a { font-size: .95rem; font-weight: 500; color: var(--fg-soft); text-decoration: none; padding: .35rem 0; border-bottom: 2px solid transparent; }
.topbar nav a:hover { color: var(--fg); }
.topbar nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--accent); }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: clamp(1.5rem, 5vw, 4rem); align-items: start; padding: clamp(2.5rem, 7vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem); }
.kicker { font-size: .85rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .75rem; }
.name { font-size: clamp(2.6rem, 2rem + 3vw, 4rem); font-weight: 500; letter-spacing: -0.015em; margin-bottom: 1rem; }
.lede { font-family: var(--serif); font-size: clamp(1.25rem, 1.05rem + .8vw, 1.5rem); line-height: 1.4; color: var(--fg-soft); max-width: 36rem; margin-bottom: 1rem; text-wrap: pretty; }
.affil { color: var(--fg-muted); font-size: .95rem; margin-bottom: 1.5rem; }
.affil a { color: inherit; text-decoration-color: var(--rule-strong); }
.affil a:hover { color: var(--accent); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.5rem; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1.05rem; border-radius: 999px; border: 1px solid var(--rule-strong); background: var(--bg-elev); color: var(--fg); font-weight: 500; font-size: .95rem; text-decoration: none; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.btn:hover { border-color: var(--fg-muted); color: var(--fg); }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-note { font-size: .72rem; font-weight: 600; letter-spacing: .06em; color: var(--fg-muted); }
.profile-links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.25rem; }
.profile-links a { display: inline-flex; align-items: center; gap: .45rem; font-size: .92rem; font-weight: 500; color: var(--fg-soft); text-decoration: none; }
.profile-links a:hover { color: var(--accent); }
.profile-links svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.profile-links svg.filled { fill: currentColor; stroke: none; }

.portrait { margin: .35rem 0 0; }
.portrait img { display: block; width: clamp(9.5rem, 22vw, 14rem); height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 12px 32px -12px rgba(0,0,0,.25); }

/* ---------- Sections ---------- */
.section { padding: clamp(1.75rem, 4vw, 2.75rem) 0; border-top: 1px solid var(--rule); }
.section > h2, .section-head { margin-bottom: 1.25rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.more { font-size: .95rem; font-weight: 500; text-decoration: none; }
.more:hover { text-decoration: underline; }
.prose { max-width: var(--measure); }
.prose p { text-wrap: pretty; }
.prose p:last-child { margin-bottom: 0; }

.interests { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.interests li { font-size: .85rem; font-weight: 500; color: var(--chip-fg); background: var(--chip-bg); border-radius: 999px; padding: .3rem .8rem; }

/* ---------- Papers ---------- */
.paper-list { display: grid; gap: 1.75rem; max-width: 48rem; }
.paper-full + .paper-full { padding-top: 1.75rem; border-top: 1px dashed var(--rule-strong); }
.paper-title { font-size: 1.3rem; line-height: 1.3; margin-bottom: .35rem; text-wrap: pretty; }
.paper-title a { color: inherit; text-decoration: none; }
.paper-title a:hover { color: var(--accent); }
.paper-authors { color: var(--fg-soft); font-size: .97rem; margin-bottom: .3rem; }
.paper-authors .me { color: var(--fg); font-weight: 600; }
.paper-authors a { color: inherit; text-decoration-color: var(--rule-strong); }
.paper-authors a:hover { color: var(--accent); }
.paper-meta { font-size: .85rem; color: var(--fg-muted); margin-bottom: .75rem; display: flex; flex-wrap: wrap; align-items: center; }
.status { display: inline-block; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: .72rem; padding: .18rem .55rem; border-radius: 4px; background: var(--chip-bg); color: var(--chip-fg); }
.status-working-paper, .status-under-review, .status-published { background: var(--accent-soft); color: var(--accent); }
.paper-summary { color: var(--fg-soft); margin-bottom: .75rem; text-wrap: pretty; }
.abstract { margin: 0 0 .9rem; }
.abstract summary { cursor: pointer; font-weight: 600; font-size: .9rem; color: var(--fg); list-style: none; display: inline-flex; align-items: center; gap: .45rem; padding: .25rem 0; }
.abstract summary::-webkit-details-marker { display: none; }
.abstract summary::before { content: ""; width: .5rem; height: .5rem; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); transition: transform .15s ease; margin-right: .1rem; }
.abstract[open] summary::before { transform: rotate(45deg); }
.abstract p { margin: .6rem 0 0; color: var(--fg-soft); max-width: var(--measure); text-wrap: pretty; }
.paper-presentations { font-size: .9rem; color: var(--fg-soft); margin-bottom: .75rem; }
.paper-presentations .label { font-weight: 600; color: var(--fg); }
.paper-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px; border: 1px solid var(--rule-strong); text-decoration: none; color: var(--fg); background: var(--bg-elev); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip::after { content: "↗"; font-size: .8em; color: var(--fg-muted); }

/* ---------- News ---------- */
.news { list-style: none; margin: 0; padding: 0; max-width: 48rem; }
.news li { display: grid; grid-template-columns: 8.5rem 1fr; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--rule); }
.news li:first-child { border-top: 0; padding-top: 0; }
.news-date { color: var(--fg-muted); font-size: .9rem; font-weight: 500; padding-top: .1rem; }
.news-text { color: var(--fg-soft); }

/* ---------- Contact ---------- */
.contact { max-width: var(--measure); }

/* ---------- Secondary pages ---------- */
.page-head { padding: clamp(2.25rem, 6vw, 4rem) 0 1.5rem; }
.page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; }
.page-intro { font-family: var(--serif); font-size: 1.2rem; line-height: 1.45; color: var(--fg-soft); max-width: 40rem; margin: .75rem 0 0; text-wrap: pretty; }

/* ---------- CV ---------- */
.cv-section { padding: 1.5rem 0; border-top: 1px solid var(--rule); }
.cv-section h2 { margin-bottom: 1rem; }
.cv { margin: 0; max-width: 52rem; }
.cv-row { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem 1.25rem; padding: .55rem 0; }
.cv-row + .cv-row { border-top: 1px solid var(--rule); }
.cv dt { color: var(--fg-muted); font-size: .92rem; font-weight: 500; padding-top: .12rem; white-space: nowrap; }
.cv dd { margin: 0; color: var(--fg-soft); }
.cv dd strong { color: var(--fg); font-weight: 600; }
.cv-notes { margin: .3rem 0 0; padding-left: 1.1rem; font-size: .95rem; }
.cv-notes li + li { margin-top: .15rem; }
.cv-papers { margin: 0; padding-left: 1.25rem; max-width: 52rem; }
.cv-papers li { padding: .35rem 0; color: var(--fg-soft); }
.cv-papers a { color: var(--fg); font-weight: 500; text-decoration-color: var(--rule-strong); }
.cv-papers a:hover { color: var(--accent); }

/* ---------- Footer ---------- */
.footer { margin-top: clamp(2.5rem, 6vw, 4rem); border-top: 1px solid var(--rule); padding: 1.5rem 0 2.5rem; font-size: .9rem; color: var(--fg-muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem 1.5rem; }
.footer p { margin: 0; }
.footer a { color: var(--fg-soft); text-decoration: none; }
.footer a:hover { color: var(--accent); text-decoration: underline; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  body { font-size: 1rem; }
  .hero { grid-template-columns: 1fr; padding-top: 2rem; }
  .portrait { order: -1; }
  .portrait img { width: 8rem; }
  .news li { grid-template-columns: 1fr; gap: .15rem; }
  .cv-row { grid-template-columns: 1fr; gap: .15rem; }
  .cv dt { white-space: normal; }
  .topbar nav { gap: .8rem; }
  .topbar nav a { font-size: .9rem; }
  .brand { font-size: 1.1rem; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .footer, .actions, .skip, .more { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; text-decoration: none; }
  .abstract { break-inside: avoid; }
  .abstract summary::before { display: none; }
  .wrap { width: 100%; }
}
