/* ===========================================================
   Tigran Melkonyan — personal site
   Shared stylesheet. Edit here to change the look everywhere.
   =========================================================== */

:root {
  /* Palette: cool offprint grey, ink, one deep crimson accent */
  --ground:      #eef1f2;
  --surface:     #ffffff;
  --ink:         #15181b;
  --ink-2:       #4e565e;
  --ink-3:       #79828b;
  --rule:        #c6cdd1;
  --rule-soft:   #dfe4e6;
  --accent:      #8c1d2f;
  --accent-tint: #f4e7e9;

  --display: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --body:    "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --mono:    "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --measure: 66ch;
  --pad: clamp(1.25rem, 4vw, 2.5rem);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-feature-settings: "onum" 1;
}

/* ---------- Links ---------- */

a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  transition: border-color .15s ease, color .15s ease;
}

a:hover { color: var(--accent); border-bottom-color: var(--accent); }

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

/* ---------- Signature: the interval rule ----------
   A hairline closed by a tick at each end — an interval [a, b]
   rather than a point. Used as the divider before every section. */

.interval {
  position: relative;
  height: 1px;
  background: var(--rule);
  margin: 0;
}

.interval::before,
.interval::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--ink);
}

.interval::before { left: 0; }
.interval::after  { right: 0; }

/* ---------- Shell ---------- */

.wrap {
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(238, 241, 242, .92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule-soft);
}

.topbar .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 3.25rem;
  flex-wrap: wrap;
}

.mark {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--ink);
  border: 0;
}

.mark:hover { color: var(--accent); }

.nav {
  display: flex;
  gap: 1.35rem;
  flex-wrap: wrap;
  font-family: var(--display);
  font-size: .875rem;
}

.nav a { border: 0; color: var(--ink-2); padding: .5rem 0; }
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

/* ---------- Masthead ---------- */

.masthead { padding: clamp(2.5rem, 7vw, 4.5rem) 0 0; }

.masthead-grid {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  align-items: start;
}

.portrait {
  width: 8.5rem;
  height: 10rem;
  margin: 0;
  background: var(--rule-soft);
  overflow: hidden;
}

.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(18%) contrast(103%);
}

h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.35rem, 6.2vw, 3.85rem);
  line-height: 1.02;
  letter-spacing: -.028em;
  margin: 0 0 1.1rem;
}

.masthead .interval { max-width: 22rem; margin-bottom: 1.1rem; }

.titles {
  font-family: var(--display);
  font-size: .96rem;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 1.35rem;
}

.titles strong { color: var(--ink); font-weight: 600; }

.meta-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--mono);
  font-size: .8rem;
  line-height: 2;
  color: var(--ink-2);
}

.meta-list a { border-bottom-color: var(--rule); }

.elsewhere {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .5rem;
  margin: 1.25rem 0 0;
  padding: 0;
  list-style: none;
}

.elsewhere a {
  display: inline-block;
  font-family: var(--display);
  font-size: .8rem;
  padding: .3rem .7rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--ink-2);
  background: var(--surface);
}

.elsewhere a:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-tint);
}

/* ---------- Sections ---------- */

section { padding: clamp(2.75rem, 6vw, 4rem) 0 0; }

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .75rem;
}

section > .interval { margin-bottom: 1.75rem; }

h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -.012em;
  margin: 0 0 1.1rem;
}

h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  margin: 2rem 0 .4rem;
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.15rem; }
.prose p:last-child { margin-bottom: 0; }

.lede { font-size: 1.15rem; line-height: 1.65; }

/* ---------- Interest tags ---------- */

.interests {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: .1rem 2rem;
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 52rem;
}

.interests li {
  font-family: var(--display);
  font-size: .93rem;
  color: var(--ink-2);
  padding: .5rem 0 .5rem 1.1rem;
  border-bottom: 1px solid var(--rule-soft);
  position: relative;
}

.interests li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.15rem;
  width: .5rem;
  height: 1px;
  background: var(--accent);
}

/* ---------- Publication list ---------- */

.pubs { list-style: none; margin: 0; padding: 0; }

.pubs li {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  gap: 0 1.5rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--rule-soft);
}

.pubs li:first-child { border-top: 1px solid var(--rule-soft); }

.year {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-3);
  padding-top: .3rem;
  letter-spacing: .02em;
}

.pub-title {
  font-weight: 600;
  display: block;
  margin-bottom: .15rem;
  line-height: 1.45;
}

.pub-title a { border-bottom-color: var(--rule); }

.pub-meta {
  font-family: var(--display);
  font-size: .86rem;
  color: var(--ink-2);
  line-height: 1.55;
}

.pub-meta em { font-style: italic; color: var(--ink); }

.count {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-3);
  margin: 0 0 1.5rem;
}

/* ---------- Callout / empty state ---------- */

.note {
  max-width: var(--measure);
  background: var(--surface);
  border-left: 2px solid var(--accent);
  padding: 1.1rem 1.35rem;
  font-size: .97rem;
  color: var(--ink-2);
}

.note p { margin: 0 0 .7rem; }
.note p:last-child { margin-bottom: 0; }

/* ---------- Course entries ---------- */

.course { max-width: var(--measure); padding: 1.25rem 0; border-bottom: 1px solid var(--rule-soft); }
.course:first-of-type { border-top: 1px solid var(--rule-soft); }

.course-code {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--accent);
  letter-spacing: .06em;
}

.course h3 { margin: .15rem 0 .35rem; }
.course p { margin: 0; font-size: .97rem; color: var(--ink-2); }

/* ---------- Footer ---------- */

footer {
  margin-top: clamp(3.5rem, 8vw, 5.5rem);
  padding: 1.75rem 0 3rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--ink-3);
  letter-spacing: .02em;
}

footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

footer a { color: var(--ink-3); border-bottom-color: var(--rule-soft); }

/* ---------- 404 ---------- */

.centered {
  min-height: 60vh;
  display: grid;
  place-content: center;
  text-align: center;
  gap: 1rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 46rem) {
  .masthead-grid { grid-template-columns: 1fr; }
  .portrait { width: 7rem; height: 8.25rem; }
  .pubs li { grid-template-columns: 1fr; gap: .3rem; }
  .year { padding-top: 0; }
  .nav { gap: 1rem; font-size: .82rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

@media print {
  .topbar, footer, .elsewhere { display: none; }
  body { background: #fff; font-size: 10.5pt; }
}
