/* ==========================================================================
   Ivan Medovikov — medovikov.com
   Design tokens and styles, transcribed from the approved design reference
   (design-brief/Ivan Medovikov.dc.html). Values are final; see design-brief/README.md.
   ========================================================================== */

:root {
  /* Color */
  --accent: #24523d;          /* deep forest green — links, headings, dots, motif */
  --accent-hover: #163527;
  --paper: #faf9f5;           /* page background */
  --paper-sunk: #f4f2ea;      /* footer band */
  --ink: #1c1b18;             /* primary text */
  --body: #47443c;            /* secondary body text */
  --body-timeline: #33312b;   /* timeline descriptions */
  --muted: #6b675c;           /* metadata */
  --faint: #98937f;           /* copyright */
  --hairline: #e6e3da;        /* section rules, borders */
  --chip-border: #ddd9cf;
  --badge-border: #cfd8cf;
  --button-hover-bg: #eceee8;

  /* Type */
  --serif: 'Source Serif 4', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout */
  --column: 760px;
  --gutter: 24px;
  --nav-height: 56px;
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

img {
  max-width: 100%;
}

em {
  font-style: italic;
}

/* Shared content column */
.column {
  max-width: var(--column);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* Sticky nav must not cover section headings on anchor jumps */
:target,
[id] {
  scroll-margin-top: var(--nav-height);
}

/* ---------- Nav ---------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 249, 245, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline);
}

.nav__inner {
  padding: 14px var(--gutter);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.nav__name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

.nav__links {
  display: flex;
  gap: 18px;
  font-family: var(--mono);
  font-size: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav__links a {
  color: var(--muted);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
}

/* Decorative probability-density curve behind the hero content */
.hero__motif {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero__inner {
  padding: 96px var(--gutter) 84px;
  position: relative;
  display: flex;
  gap: 44px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.hero__text {
  flex: 1 1 420px;
  min-width: 300px;
}

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
}

.hero__title {
  font-size: clamp(34px, 6vw, 52px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  margin: 0 0 22px;
}

.hero__subtitle {
  font-size: 19px;
  line-height: 1.55;
  color: var(--body);
  margin: 0 0 32px;
  max-width: 58ch;
}

.hero__links {
  display: flex;
  gap: 22px;
  font-family: var(--mono);
  font-size: 13px;
  flex-wrap: wrap;
}

.hero__portrait {
  width: 208px;
  height: 208px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--hairline);
  margin-top: 46px;
  flex: 0 0 auto;
}

/* ---------- Main / sections ---------- */

.main {
  max-width: var(--column);
  margin: 0 auto;
  padding: 0 var(--gutter) 80px;
  display: flex;
  flex-direction: column;
  gap: 84px;
}

.section {
  border-top: 1px solid var(--hairline);
  padding-top: 44px;
}

.section__heading {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 26px;
}

/* Per-section heading rhythm from the reference */
.section__heading--about { margin-bottom: 22px; }
.section__heading--experience { margin-bottom: 30px; }
.section__heading--research { margin-bottom: 14px; }

/* Intro paragraph under a section heading */
.section__intro {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--body);
  margin: 0 0 28px;
  max-width: 62ch;
}

/* ---------- About ---------- */

.about__body {
  font-size: 18px;
  line-height: 1.6;
  max-width: 68ch;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.about__body p {
  margin: 0;
}

/* ---------- Experience timeline ---------- */

.timeline {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 0 18px;
}

.timeline__rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.timeline__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-top: 7px;
  border: 1.5px solid var(--accent);
  background: var(--paper);
}

/* Current role */
.timeline__dot--filled {
  border: 0;
  background: var(--accent);
}

.timeline__line {
  width: 1px;
  flex: 1;
  background: var(--hairline);
}

.timeline__entry {
  padding-bottom: 38px;
}

.timeline__entry--last {
  padding-bottom: 0;
}

.entry__header {
  display: flex;
  gap: 10px;
  align-items: baseline;
  flex-wrap: wrap;
}

.entry__company {
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}

.entry__meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.entry__role {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  margin: 6px 0 10px;
}

.entry__description {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--body-timeline);
  margin: 0;
  max-width: 62ch;
}

/* ---------- Badge ---------- */

.badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  border: 1px solid var(--badge-border);
  border-radius: 3px;
  padding: 1px 7px;
  white-space: nowrap;
}

/* ---------- Research ---------- */

.publications {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 66ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.publications li {
  padding-left: 22px;
  text-indent: -22px;
  font-size: 16.5px;
  line-height: 1.5;
}

.publications .coauthors {
  color: var(--muted);
}

.section__footer-link {
  font-family: var(--mono);
  font-size: 13px;
  margin: 26px 0 0;
}

/* ---------- Talks & Writing ---------- */

.talks {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 66ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

.talk {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.talk__title {
  font-size: 17px;
  font-weight: 600;
  margin: 0;
}

/* Linked talk titles stay ink-colored, gaining only an underline on hover */
.talk__title a,
.talk__title a:hover {
  color: inherit;
}

.talk__meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  margin: 0;
}

.talk__meta--wrap {
  line-height: 1.6;
}

/* ---------- Software ---------- */

.stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 36px;
}

.stack__heading {
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 14px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12.5px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  border: 1px solid var(--chip-border);
  border-radius: 3px;
  padding: 3px 9px;
  color: var(--body);
}

.software__footer {
  font-family: var(--mono);
  font-size: 13px;
  margin: 30px 0 0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.badge--vault {
  font-size: 11px;
  padding: 2px 8px;
}

/* ---------- Teaching & Recognition ---------- */

.teaching__body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 66ch;
  font-size: 16.5px;
  line-height: 1.55;
}

.teaching__body p {
  margin: 0;
}

/* ---------- Contact footer ---------- */

.footer {
  border-top: 1px solid var(--hairline);
  background: var(--paper-sunk);
}

.footer__inner {
  padding: 52px var(--gutter) 60px;
}

.footer__heading {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 12px;
}

.footer__text {
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--body);
  margin: 0 0 24px;
  max-width: 56ch;
}

.button {
  display: inline-block;
  font-family: var(--mono);
  font-size: 13px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 10px 18px;
}

.button:hover {
  background: var(--button-hover-bg);
  color: var(--accent);
  text-decoration: none;
}

.footer__copyright {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  margin: 40px 0 0;
}

/* ---------- Narrow screens ---------- */
/* The layout is single-column by default; only the hero's generous top
   padding needs easing on small viewports. */
@media (max-width: 560px) {
  .hero__inner {
    padding-top: 64px;
    padding-bottom: 56px;
    gap: 32px;
  }

  .hero__portrait {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
