/* ═══════════════════════════════════════════════════════════════════
   akkarimi.com — site stylesheet (minimal)
   ───────────────────────────────────────────────────────────────────
   One serif typeface, a light grey page, a single reading column.
   To retheme, edit the tokens in section 1 (light) and 2 (dark).

   1. Tokens (light)    4. Base            7. Lists (news, papers, …)
   2. Tokens (dark)     5. Layout          8. Publications page
   3. Font              6. Header/footer   9. Page-specific bits
   ═══════════════════════════════════════════════════════════════════ */


/* ── 1. Tokens — light ───────────────────────────────────────────── */
:root {
  --bg:         #f4f4f2;   /* light warm grey page */
  --ink:        #111111;   /* text */
  --ink-2:      #3d3d3d;   /* authors, secondary text */
  --muted:      #666660;   /* dates, captions — 5.2:1 on --bg */
  --rule:       #d9d9d4;   /* hairlines */
  --title:      #191970;   /* paper titles (midnight blue) */
  --link:       #2c2c6e;   /* links in running text */
  --link-line:  rgba(44, 44, 110, .45);
  --small-link: #1f6fa8;   /* pdf · code · abstract … */
  --focus:      #1f6fa8;
  --panel:      #eaeae6;   /* abstract / BibTeX panels */

  --font: "EB Garamond", "Adobe Garamond Pro", Garamond, "Times New Roman", serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --text:  clamp(1.0625rem, 1rem + .3vw, 1.1875rem);   /* 17 → 19px */
  --small: .84em;
  --tiny:  .74em;

  --container: 60rem;
  --gutter: clamp(1rem, .5rem + 2.5vw, 3rem);          /* 16px on phones */
  --side: 14rem;                                       /* photo / left column */
  --col: 38rem;                                        /* reading column */
}

/* ── 2. Tokens — dark (follows the OS unless the toggle overrides) ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151515; --ink: #e9e7e2; --ink-2: #cbc8c1; --muted: #a29f97; --rule: #2e2e2b;
    --title: #aeb6f0; --link: #c3c9f2; --link-line: rgba(195, 201, 242, .45);
    --small-link: #7cc0ef; --focus: #7cc0ef; --panel: #1f1f1d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151515; --ink: #e9e7e2; --ink-2: #cbc8c1; --muted: #a29f97; --rule: #2e2e2b;
  --title: #aeb6f0; --link: #c3c9f2; --link-line: rgba(195, 201, 242, .45);
  --small-link: #7cc0ef; --focus: #7cc0ef; --panel: #1f1f1d;
  color-scheme: dark;
}

/* ── 3. Font (self-hosted EB Garamond, latin subset, variable weight) ── */
@font-face {
  font-family: "EB Garamond"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url("../fonts/site/ebgaramond-var.woff2") format("woff2");
}
@font-face {
  font-family: "EB Garamond"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url("../fonts/site/ebgaramond-italic-var.woff2") format("woff2");
}


/* ── 4. Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--text)/1.5 var(--font);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3 { margin: 0; font-weight: 400; line-height: 1.2; }
p { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--title); color: var(--bg); }

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1px;
  text-underline-offset: .15em;
}
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: var(--gutter); top: -100px; z-index: 10; padding: .5rem .9rem; background: var(--ink); color: var(--bg); }
.skip-link:focus { top: .5rem; }
.icon { width: 1.1em; height: 1.1em; flex: none; }
.no-js .js-only { display: none !important; }

code { font-family: var(--mono); font-size: .8em; }


/* ── 5. Layout ───────────────────────────────────────────────────────
   Phones: one column. ≥ 900px: a narrow left column (photo on the home
   page, empty elsewhere) and the reading column on the right. */
.container { max-width: calc(var(--container) + 2 * var(--gutter)); margin-inline: auto; padding-inline: var(--gutter); }
.main-col { max-width: var(--col); }
@media (min-width: 900px) {
  .split { display: grid; grid-template-columns: var(--side) minmax(0, var(--col)); column-gap: clamp(2.5rem, 4vw, 4rem); justify-content: space-between; }
  .split > .main-col { grid-column: 2; }
}
main { padding-block: clamp(2rem, 1rem + 4vw, 4.5rem) clamp(3rem, 2rem + 4vw, 6rem); }

.section { margin-top: clamp(2.5rem, 2rem + 2vw, 3.5rem); }
.section-title { font-size: 1.6em; margin-bottom: .45rem; }
.section-title a { color: inherit; text-decoration: none; }
.section-more { margin-top: .6rem; font-size: var(--small); }
.page-title { font-size: 2em; margin-bottom: 1rem; }
.page-lead { margin-bottom: 1.25rem; }
.prose > * + * { margin-top: .8em; }
.muted { color: var(--muted); }


/* ── 6. Header & footer ──────────────────────────────────────────── */
.site-header__inner {
  display: flex; align-items: center; gap: 1rem;
  padding-top: clamp(1.25rem, .75rem + 2vw, 2.25rem);
}
.brand {
  margin-right: auto;
  display: inline-flex; align-items: center; min-height: 44px;
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); letter-spacing: -.005em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.site-nav__link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding-inline: .1rem;
  font-size: 1.06em; color: var(--ink); text-decoration: none;
}
.site-nav__link:hover, .site-nav__link[aria-current="page"] { text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: .3em; }

.site-header__actions { display: flex; align-items: center; margin-right: -.6rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
  background: none; border: 0; color: var(--ink); cursor: pointer; opacity: .8;
}
.icon-btn:hover { opacity: 1; }
.icon-btn .icon { width: 20px; height: 20px; }

.theme-toggle__dark { display: none; }
:root[data-theme="dark"] .theme-toggle__light { display: none; }
:root[data-theme="dark"] .theme-toggle__dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__light { display: none; }
  :root:not([data-theme="light"]) .theme-toggle__dark { display: block; }
}
.no-js .theme-toggle { display: none; }
.nav-toggle__close { display: none; }
.nav-open .nav-toggle__open { display: none; }
.nav-open .nav-toggle__close { display: block; }

@media (max-width: 899.98px) {
  .no-js .site-header__inner { flex-wrap: wrap; }
  .no-js .site-nav { order: 3; width: 100%; }
  .no-js .site-nav__list { display: flex; flex-wrap: wrap; gap: 0 1rem; }
  .no-js .nav-toggle { display: none; }
  .js .site-nav { display: none; }
  .js .nav-open .site-nav { display: block; order: 3; width: 100%; padding-bottom: .5rem; }
  .js .site-header__inner { flex-wrap: wrap; }
  .js .site-nav__list li { border-top: 1px solid var(--rule); }
  .js .site-nav__link { display: flex; justify-content: flex-start; min-height: 48px; font-size: 1.15em; }
}
@media (min-width: 900px) {
  .site-nav__list { display: flex; gap: 1.1rem; }
  .nav-toggle { display: none; }
}

.site-footer { padding-bottom: 2.5rem; font-size: var(--small); color: var(--muted); }
.site-footer a { color: inherit; }

/* "Email / Scholar / ORCID / …" */
.text-links { margin-top: 1.1rem; }
.text-links a { display: inline-block; padding-block: .55rem; margin-block: -.55rem; }   /* taller tap target, same look */
.text-links .sep { color: var(--muted); margin-inline: .2em; }


/* ── 7. Lists ────────────────────────────────────────────────────── */

/* Dated list: small date on the left, text on the right (news, selected papers, teaching) */
.dated { display: grid; gap: .45rem; }
.dated__item { display: grid; grid-template-columns: 4.6rem minmax(0, 1fr); column-gap: .8rem; align-items: baseline; }
.dated__date { font-size: var(--tiny); color: var(--muted); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.dated + .dated { margin-top: 1rem; }
@media (max-width: 379.98px) { .dated__item { grid-template-columns: 3.9rem minmax(0, 1fr); } }

/* Paper title links */
.paper-link { color: var(--title); text-decoration: none; }
.paper-link:hover { text-decoration: underline; text-decoration-color: currentColor; }
.small-link, .link-btn {
  color: var(--small-link); text-decoration: none; font-size: .92em;
}
.small-link:hover, .link-btn:hover { text-decoration: underline; }
.link-btn {
  display: inline; padding: 0; border: 0; background: none; cursor: pointer;
  font-size: .92em;
}
/* invisible hit-area padding so small links are easy to tap */
.small-link, .pub__links .link-btn { position: relative; }
.small-link::after, .pub__links .link-btn::after { content: ""; position: absolute; inset: -12px -4px; }

/* Your name in author lists */
.au-me { font-weight: 600; }

/* Full publication entry */
.pubs { display: grid; gap: 1.15rem; }
.pub__title { font-size: 1em; font-weight: 400; line-height: 1.35; }
.pub__authors { font-size: .95em; color: var(--ink-2); }
.pub__venue { font-size: .95em; font-style: italic; color: var(--ink-2); }
.pub__links { margin-top: .15rem; display: flex; flex-wrap: wrap; gap: 0 .7rem; }
.pub__links > * { white-space: nowrap; }
.pub__panel { margin-top: .5rem; padding: .8rem 1rem; background: var(--panel); font-size: .92em; line-height: 1.45; }
.pub__bib { font: .74rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* Toast ("BibTeX copied") */
.toast {
  position: fixed; left: 50%; bottom: 1.25rem; z-index: 20;
  transform: translate(-50%, .5rem); opacity: 0; pointer-events: none;
  padding: .5rem 1rem; background: var(--ink); color: var(--bg); font-size: var(--small);
  transition: opacity .2s, transform .2s;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }


/* ── 8. Publications page ────────────────────────────────────────── */
.pub-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem .9rem; margin-bottom: .6rem; }
.pub-filters__search { grid-column: 1 / -1; }
.pub-filters input, .pub-filters select {
  width: 100%; min-height: 44px; padding: 0 .1rem;
  font-size: max(16px, .95em);            /* ≥16px avoids zoom-on-focus on iOS */
  background: transparent; border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
}
.pub-filters select { padding-right: 1rem; }
.pub-filters input:focus-visible, .pub-filters select:focus-visible { outline: none; border-bottom-color: var(--ink); }
.pub-status { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; margin-bottom: 1rem; font-size: var(--tiny); color: var(--muted); }
.pub-status .link-btn { font-size: 1em; }
.pub-year + .pub-year { margin-top: 1.75rem; }
.pub-year__label { font-size: 1.25em; margin-bottom: .5rem; }
.pub-empty { padding-block: 2rem; color: var(--muted); }


/* ── 9. Page-specific bits ───────────────────────────────────────── */

/* Home: photo beside the bio */
.home-photo { margin-bottom: 1.5rem; }
.home-photo img { width: 11rem; aspect-ratio: 1; object-fit: cover; }
@media (max-width: 899.98px) { .home-photo img { margin-inline: auto; width: 9rem; } }
@media (min-width: 900px) { .home-photo { margin: .35rem 0 0; } .home-photo img { width: 100%; } }

/* Research */
.theme + .theme { margin-top: 2.25rem; }
.theme__title { font-size: 1.35em; margin-bottom: .5rem; }
.theme__figure { margin: .5rem 0 1rem; }

/* People */
.people { display: grid; gap: .9rem; }
.person { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: start; }
.person__photo { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: 50%; }
.person__name { font-size: 1em; font-weight: 500; }
.person__meta, .person__now { font-size: .95em; color: var(--ink-2); }
.person__topic { font-size: .95em; font-style: italic; color: var(--ink-2); }
.person__links { display: flex; flex-wrap: wrap; gap: 0 .7rem; }
.person--no-photo { grid-template-columns: minmax(0, 1fr); }
.notice { margin-bottom: 1.25rem; padding: .6rem .9rem; background: var(--panel); font-size: var(--small); }

/* CV */
.cv-block + .cv-block { margin-top: 2rem; }
.cv-item__title { font-size: 1em; font-weight: 500; }
.cv-item__details { color: var(--ink-2); font-size: .95em; }

/* Projects & blog */
.card + .card { margin-top: 1.5rem; }
.card__title { font-size: 1.25em; margin-bottom: .25rem; }
.card > * + * { margin-top: .4rem; }
.card__meta { font-size: .92em; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
