/* =========================================================
   Yohan Hmaiti: personal website
   Palette follows hyunsungcho.com: warm off-white page,
   white cards, olive green (#436c00) and sage (#b1ca80),
   yellow award chips and green recognition chips.
   All colors are tokens at the top.
   ========================================================= */

:root {
  --bg: #f8f7f5;
  --paper: #ffffff;
  --text: #000000;
  --body: rgba(0, 0, 0, 0.87);
  --muted: rgba(0, 0, 0, 0.6);
  --divider: rgba(0, 0, 0, 0.12);
  --outline: rgba(0, 0, 0, 0.23);

  --primary: #436c00;          /* olive: links, venues, bullets, buttons */
  --primary-dark: #2f4c00;
  --primary-line: rgba(67, 108, 0, 0.5);
  --on-primary: #ffffff;
  --brand: #b1ca80;            /* sage: underlines, title bars */
  --brand-soft: rgba(177, 202, 128, 0.6);
  --year: rgba(177, 202, 128, 0.55);
  --tint: #f3f6ed;             /* pale green: callouts, hovers */
  --award: #ebca23;            /* yellow: best paper chips */
  --recognition: #b4db75;      /* green: highlight chips */
  --link: #4d7a2e;             /* pistachio: link text (deep shade, readable on white) */
  --link-line: #93c572;        /* pistachio: link underline */
  --link-hover: #365a1c;

  --shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14), 0 1px 3px 0 rgba(0, 0, 0, 0.12);
  --font: "Schibsted Grotesk", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

/* Optional dark theme (the moon button). Light is always the default. */
:root[data-theme="dark"] {
  --bg: #12140f;
  --paper: #1b1e17;
  --text: #f2f4ec;
  --body: rgba(242, 244, 236, 0.9);
  --muted: rgba(242, 244, 236, 0.62);
  --divider: rgba(255, 255, 255, 0.12);
  --outline: rgba(255, 255, 255, 0.28);
  --primary: #b1ca80;
  --primary-dark: #c9dca3;
  --primary-line: rgba(177, 202, 128, 0.55);
  --on-primary: #12140f;
  --brand: #8fa863;
  --brand-soft: rgba(177, 202, 128, 0.4);
  --year: rgba(177, 202, 128, 0.45);
  --tint: #252c1b;
  --link: #b5dc94;
  --link-line: #93c572;
  --link-hover: #d3ecbf;
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 20px; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--tint); }
a {
  color: var(--link);
  text-decoration: none;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover, a:focus-visible { color: var(--link-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3, h4, p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
sup { line-height: 0; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.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: 16px; top: -48px; z-index: 50;
  padding: 8px 14px; border-radius: 4px;
  background: var(--primary); color: var(--on-primary); text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Header ---------- */
.site-header { display: flex; align-items: center; gap: 28px; padding-top: 40px; padding-bottom: 28px; }
.wordmark {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  margin-right: auto;
  font-size: 28px; font-weight: 700; line-height: 1.2; color: var(--text);
}
.wordmark-name { letter-spacing: 0.02em; }
.wordmark-bar { font-size: 20px; font-weight: 200; color: var(--brand); }
.wordmark-say { font-size: 18px; font-weight: 500; letter-spacing: 0.01em; color: var(--muted); }
.pronouns {
  align-self: center;
  padding: 2px 10px; border-radius: 999px;
  background: var(--tint); color: var(--primary);
  font-size: 13.5px; font-weight: 700; line-height: 1.5;
}
.site-nav { display: flex; gap: 24px; }
.site-nav a { font-size: 15px; font-weight: 600; color: var(--text); text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--primary); }
.theme-toggle {
  display: grid; place-items: center; width: 36px; height: 36px; margin-right: -6px;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { background: var(--tint); color: var(--primary); }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: inline-block; }
:root[data-theme="dark"] .icon-moon { display: none; }

/* ---------- Layout and cards ---------- */
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px 20px;
  align-items: start;
}
.content { display: grid; gap: 16px; min-width: 0; }
.card { background: var(--paper); border-radius: 4px; box-shadow: var(--shadow); padding: 32px; }

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 20px; padding: 24px; }
.avatar { position: relative; aspect-ratio: 1; border-radius: 50%; overflow: hidden; background: var(--tint); }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-fallback {
  display: none; position: absolute; inset: 0; place-items: center;
  font-size: 64px; font-weight: 700; letter-spacing: 0.02em; color: var(--primary);
}
.avatar.is-fallback .avatar-fallback { display: grid; }

.side-actions { display: grid; gap: 8px; margin-top: 20px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 4px;
  font-size: 14.5px; font-weight: 600; text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.btn-contained {
  background: var(--primary); color: var(--on-primary);
  box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2), 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12);
}
.btn-contained:hover { background: var(--primary-dark); color: var(--on-primary); }
.btn-outlined { border: 1px solid var(--primary-line); color: var(--primary); }
.btn-outlined:hover { background: var(--tint); border-color: var(--primary); }

.email-line { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 14px; font-size: 14px; color: var(--text); }
.email-text { overflow-wrap: anywhere; }
.copy-email {
  display: grid; place-items: center; flex: none; width: 28px; height: 28px;
  border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer;
}
.copy-email:hover { background: var(--tint); color: var(--primary); }
.copy-status { font-size: 12.5px; font-weight: 600; color: var(--primary); }
.copy-status:empty { display: none; }

.profile-links {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px;
  margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--divider);
  font-size: 14px;
}
.profile-links a { display: inline-flex; align-items: center; gap: 6px; color: var(--text); text-decoration: none; }
.profile-links a:hover { color: var(--primary); }
.profile-links i { width: 15px; text-align: center; font-size: 14px; }
.where { margin-top: 12px; text-align: center; font-size: 14px; color: var(--muted); }
.where i { margin-right: 6px; color: var(--primary); }

/* ---------- About ---------- */
.about p { line-height: 1.7; }
.about > p { margin-bottom: 16px; }
.about > p:last-child { margin-bottom: 0; }
.about strong, .about b { font-weight: 700; color: var(--text); }
.about a strong, .about a b { color: inherit; }
.callout {
  display: flex; align-items: center; justify-content: space-between; gap: 8px 20px;
  margin-bottom: 16px; padding: 12px 16px;
  background: var(--tint); border-radius: 4px;
}
.callout p { font-size: 14.5px; line-height: 1.5; }
.callout .callout-title { font-size: 16px; font-weight: 600; color: var(--text); }
.callout-links { flex: none; white-space: nowrap; }
.research-box {
  padding: 18px 20px 20px;
  border: 1px solid var(--brand-soft); border-radius: 4px;
}
.research-box .box-lead { margin-bottom: 14px; }
.topics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.topic {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 9px 14px;
  border-radius: 4px; background: var(--bg);
  font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--text);
}
.topic .emoji { flex: none; font-size: 18px; }
.topic-text { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.topic-tag {
  padding: 0 8px; border-radius: 999px;
  background: var(--paper); color: var(--primary);
  font-size: 11.5px; font-weight: 700; line-height: 1.7; white-space: nowrap;
}
.topic.is-focus { background: var(--tint); box-shadow: inset 0 0 0 1px var(--brand-soft); }

/* ---------- Section titles ---------- */
.section-title { margin-bottom: 24px; font-size: 28px; font-weight: 700; line-height: 1.25; color: var(--text); }
.section-title::after {
  content: ""; display: block;
  width: 48px; height: 4px; margin-top: 8px; border-radius: 2px;
  background: var(--brand);
}
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.section-head .section-title { margin-bottom: 20px; }
.section-aside {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px;
  font-size: 14.5px; font-weight: 600; color: var(--link); text-decoration: none;
}
.section-aside:hover { color: var(--link-hover); text-decoration: underline; }

/* ---------- News ---------- */
.news { display: grid; gap: 12px; }
.news li { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 16px; font-size: 15px; line-height: 1.55; }
.news li[hidden] { display: none; }
.news time { font-weight: 600; color: var(--text); white-space: nowrap; }
.emoji, .rec-title > span { font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; font-weight: 400; }
.news .emoji { margin-right: 6px; }
.more-row { display: flex; justify-content: center; margin-top: 14px; }
.btn-text {
  padding: 6px 12px; border: 0; border-radius: 4px; background: none; cursor: pointer;
  font-size: 14.5px; font-weight: 600; color: var(--primary);
}
.btn-text:hover { background: var(--tint); }

/* ---------- Publications ---------- */
.pub-year { display: grid; grid-template-columns: 110px minmax(0, 1fr); }
.pub-year + .pub-year { margin-top: 8px; }
.pub-year[hidden] { display: none; }
.pub-year-label { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -0.5px; color: var(--year); }
.pub-entries { display: grid; gap: 22px; padding-bottom: 26px; }

.pub {
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px;
  border-radius: 4px;
  transition: background-color 0.6s ease, box-shadow 0.6s ease;
}
.pub[hidden] { display: none; }
.pub-bullet { color: var(--primary); line-height: 1.5; }
.pub.has-image { grid-template-columns: 200px minmax(0, 1fr); column-gap: 22px; }
.pub-thumb img { width: 100%; height: auto; border-radius: 2px; }
.pub.is-target { background: var(--tint); box-shadow: 0 0 0 10px var(--tint); }

.pub-title { font-size: 16.5px; font-weight: 700; line-height: 1.45; color: var(--text); }
.pub-title a { color: var(--text); text-decoration: none; }
.pub-title a:hover { color: var(--primary); }
.pub-authors { margin-top: 3px; max-width: 700px; font-size: 15px; line-height: 1.5; }
.pub-authors strong { font-weight: 700; color: var(--text); }
.pub-venue { margin-top: 2px; font-size: 15px; line-height: 1.5; color: var(--primary); }
.pub-venue b { font-weight: 700; }

.pub-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.pub-btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 30px; padding: 0 11px;
  border: 1px solid var(--outline); border-radius: 4px;
  font-size: 13.5px; font-weight: 500; color: var(--body); text-decoration: none;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}
.pub-btn i { font-size: 13px; color: var(--primary); }
.pub-btn:hover { background: var(--tint); border-color: var(--primary); color: var(--primary); }
.pub-kw { margin-left: auto; font-size: 13px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 32px; padding: 0 14px 0 12px; border-radius: 16px;
  font-size: 13.5px; font-weight: 600; color: #000000; text-decoration: none;
}
.chip i { font-size: 14px; color: #000000; }
.chip-award { background: var(--award); }
.chip-recognition { background: var(--recognition); }
a.chip:hover { color: #000000; filter: brightness(0.95); }

.sub-title { margin: 12px 0 18px; font-size: 22px; font-weight: 700; color: var(--text); }
.other-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 32px; }
.other-list .pub-title { font-size: 15.5px; }
.pub-note { color: var(--muted); }
.pub-note sup { font-weight: 700; }

/* ---------- Awards, service, teaching ---------- */
.rec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px 40px; align-items: start; }
.rec-title {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px; padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-soft);
  font-size: 20px; font-weight: 700; color: var(--primary);
}
.rec-group + .rec-group, .rec-intro + .rec-group { margin-top: 18px; }
.rec-intro { font-size: 14.5px; line-height: 1.6; }
.rec-label {
  display: inline-block; margin-bottom: 8px; padding: 2px 10px;
  border-radius: 4px; background: var(--tint);
  font-size: 13px; font-weight: 700; color: var(--primary);
}
.rec-list li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 10px;
  margin-bottom: 7px; font-size: 14.5px; line-height: 1.5;
}
.rec-list li::before { content: "•"; color: var(--primary); }
.rec-list .is-major { font-weight: 700; color: var(--text); }
.rec-when { font-size: 13.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.company {
  display: inline-flex; align-items: center; gap: 5px; vertical-align: bottom;
  font-weight: 700; color: var(--company, var(--text)); white-space: nowrap;
}
.company-logo { width: 16px; height: 16px; flex: none; }
i.company-logo { width: auto; font-size: 15px; }
:root[data-theme="dark"] .company { color: var(--text); }

/* ---------- Recent collaborators ---------- */
.collab-intro { margin-bottom: 16px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; }
.person {
  display: inline-block; padding: 6px 14px; border-radius: 999px;
  background: var(--tint); color: var(--text);
  font-size: 14.5px; font-weight: 600; line-height: 1.4;
}
a.person:hover { color: var(--primary); text-decoration: none; box-shadow: inset 0 0 0 1px var(--brand-soft); }

/* ---------- Footer ---------- */
.site-footer {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding-top: 28px; padding-bottom: 40px;
  font-size: 14px; color: var(--muted); text-align: center;
}
.privacy-note {
  display: inline-flex; align-items: flex-start; gap: 8px;
  max-width: 640px; margin-top: 10px;
  font-size: 13px; line-height: 1.5;
}
.privacy-note i { margin-top: 3px; color: var(--primary); }
.noscript { padding: 16px; text-align: center; background: var(--tint); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 250px minmax(0, 1fr); }
  .pub-year { grid-template-columns: 92px minmax(0, 1fr); }
  .pub-year-label { font-size: 34px; }
}

@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 160px minmax(0, 1fr);
    grid-template-areas: "photo actions" "photo email" "photo links" "photo where";
    column-gap: 24px;
    align-content: start;
  }
  .avatar { grid-area: photo; }
  .side-actions { grid-area: actions; margin-top: 0; grid-template-columns: repeat(2, max-content); }
  .email-line { grid-area: email; justify-content: flex-start; }
  .profile-links { grid-area: links; justify-content: flex-start; }
  .where { grid-area: where; text-align: left; }
}

@media (max-width: 760px) {
  .site-nav { display: none; }
  .rec-grid, .other-list { grid-template-columns: minmax(0, 1fr); }
  .callout { flex-direction: column; align-items: flex-start; }
  .topics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .wrap { padding: 0 12px; }
  .site-header { padding-top: 24px; padding-bottom: 18px; }
  .wordmark { gap: 4px 10px; font-size: 22px; }
  .wordmark-name { flex-basis: 100%; }
  .wordmark-bar { display: none; }
  .wordmark-say { font-size: 15px; }
  .research-box { padding: 14px 12px; }
  .topics { gap: 8px; }
  .topic { gap: 8px; min-height: 48px; padding: 8px 10px; font-size: 13.5px; }
  .topic .emoji { font-size: 16px; }
  .topics { grid-auto-flow: row dense; }
  .topic.is-focus { grid-column: span 2; }
  .topic:last-child:nth-child(even) { grid-column: span 2; }
  .card { padding: 20px; }
  .sidebar { grid-template-columns: 104px minmax(0, 1fr); column-gap: 16px; padding: 16px; }
  .side-actions { grid-template-columns: minmax(0, 1fr); }
  .news li { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .pub-year { grid-template-columns: minmax(0, 1fr); }
  .pub-year-label { margin-bottom: 12px; font-size: 28px; }
  .pub.has-image { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
  .pub-kw { margin-left: 0; width: 100%; }
  .section-title { font-size: 24px; }
  .rec-list li { grid-template-columns: auto minmax(0, 1fr); }
  .rec-when { grid-column: 2; }
}

/* ---------- Print ---------- */
@media print {
  .site-nav, .theme-toggle, .side-actions, .copy-email, .more-row, .skip-link { display: none !important; }
  body { background: #fff; }
  .layout { display: block; }
  .card { box-shadow: none; padding: 0; margin-bottom: 24px; }
  .sidebar { position: static; }
  .news li[hidden], .pub[hidden] { display: grid !important; }
  .pub-year[hidden] { display: grid !important; }
}
