/* ============================================================
   Alaa Khamis — personal academic site
   Design system + components. Light and dark themes.
   ============================================================ */

/* ---------- 1. Tokens ---------- */

:root {
  color-scheme: light;

  --bg:            #ffffff;
  --bg-alt:        #f5f8fb;
  --surface:       #ffffff;
  --surface-2:     #eef3f9;
  --border:        #dde5ef;
  --border-strong: #c2cfe0;

  --text:          #0d1725;
  --text-2:        #2f3d4f;
  --muted:         #57677c;

  /* IEEE blue */
  --accent:        #00629b;
  --accent-hover:  #004d7c;
  --accent-contrast: #ffffff;
  --accent-soft:   rgba(0, 98, 155, 0.08);
  --accent-line:   rgba(0, 98, 155, 0.30);

  --shadow-sm: 0 1px 2px rgba(10, 27, 48, 0.05);
  --shadow-md: 0 4px 16px -4px rgba(10, 27, 48, 0.11), 0 2px 6px -2px rgba(10, 27, 48, 0.06);
  --shadow-lg: 0 18px 40px -18px rgba(10, 27, 48, 0.30);

  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 18px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-serif: "Source Serif 4", "Iowan Old Style", Georgia, "Times New Roman", serif;

  --wrap: 1120px;
  --wrap-narrow: 820px;
  --header-h: 66px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:            #0a1018;
  --bg-alt:        #0d151f;
  --surface:       #121b27;
  --surface-2:     #182333;
  --border:        #22303f;
  --border-strong: #33465d;

  --text:          #e7eef7;
  --text-2:        #c1cedd;
  --muted:         #92a3b8;

  /* IEEE blue, lifted for dark backgrounds */
  --accent:        #6db3ea;
  --accent-hover:  #96caf3;
  --accent-contrast: #04182a;
  --accent-soft:   rgba(109, 179, 234, 0.13);
  --accent-line:   rgba(109, 179, 234, 0.35);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 18px -4px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 20px 44px -20px rgba(0, 0, 0, 0.8);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg:            #0a1018;
    --bg-alt:        #0d151f;
    --surface:       #121b27;
    --surface-2:     #182333;
    --border:        #22303f;
    --border-strong: #33465d;

    --text:          #e7eef7;
    --text-2:        #c1cedd;
    --muted:         #92a3b8;

    /* IEEE blue, lifted for dark backgrounds */
    --accent:        #6db3ea;
    --accent-hover:  #96caf3;
    --accent-contrast: #04182a;
    --accent-soft:   rgba(109, 179, 234, 0.13);
    --accent-line:   rgba(109, 179, 234, 0.35);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 18px -4px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 20px 44px -20px rgba(0, 0, 0, 0.8);
  }
}

/* ---------- 2. Base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16.5px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  color: var(--text);
  line-height: 1.22;
  letter-spacing: -0.012em;
  font-weight: 600;
  margin: 0;
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 3rem 0;
}

::selection { background: var(--accent-soft); color: var(--text); }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 24px;
}
.wrap--narrow { max-width: var(--wrap-narrow); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 10px 18px;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

/* ---------- 3. Header / nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -0.01em;
  margin-right: auto;
  white-space: nowrap;
}
.brand:hover { color: var(--text); text-decoration: none; }

.brand__mark {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand__name { font-size: 15.5px; }
.brand__name span { color: var(--muted); font-weight: 500; }

.nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav a {
  position: relative;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 11px; right: 11px; bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .moon { display: block; }
}

.nav-toggle { display: none; }

@media (max-width: 940px) {
  .nav-toggle { display: grid; }
  .nav {
    position: fixed;
    inset: var(--header-h) 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 12px 20px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav a { padding: 12px 12px; font-size: 16px; }
  .nav a[aria-current="page"]::after { display: none; }
  .nav a[aria-current="page"] { background: var(--accent-soft); }
}

/* ---------- 4. Hero ---------- */

.hero {
  position: relative;
  padding: clamp(48px, 7vw, 88px) 0 clamp(40px, 5vw, 64px);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(720px 380px at 12% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(560px 320px at 92% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 72%);
  pointer-events: none;
}
.hero .wrap { position: relative; }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5.2vw, 3.35rem);
  margin-bottom: 6px;
}
.hero__credentials {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}

.hero__lead {
  font-size: 1.09rem;
  color: var(--text-2);
  max-width: 60ch;
  margin: 0 0 24px;
}

.affiliations {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  gap: 9px;
  max-width: 62ch;
}
.affiliations li {
  position: relative;
  padding-left: 24px;
  font-size: 0.945rem;
  color: var(--text-2);
}
.affiliations li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.75;
}
.affiliations li strong { color: var(--text); font-weight: 600; }

.hero__portrait {
  position: relative;
  justify-self: center;
}
.hero__portrait img {
  width: 260px;
  aspect-ratio: 9 / 11;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.hero__portrait::after {
  content: "";
  position: absolute;
  inset: 16px -16px -16px 16px;
  border: 1.5px solid var(--accent-line);
  border-radius: var(--radius-lg);
  z-index: -1;
}

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__portrait { justify-self: start; order: -1; }
  .hero__portrait img { width: 172px; }
  .hero__portrait::after { inset: 12px -12px -12px 12px; }
}

/* ---------- 5. Buttons, chips, social ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; }

.btn--primary { background: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent-hover); color: var(--accent-contrast); }

.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.social {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.social a {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.social a:hover {
  color: var(--accent);
  border-color: var(--accent-line);
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.social svg { width: 18px; height: 18px; }

/* ---------- 6. Stats band ---------- */

.stats {
  border-block: 1px solid var(--border);
  background: var(--bg-alt);
}
.stats__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
}
.stat {
  background: var(--bg-alt);
  padding: 26px 20px;
  text-align: center;
}
.stat__num {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 700;
  color: var(--accent);
  line-height: 1.1;
}
.stat__label {
  margin-top: 6px;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
@media (max-width: 860px) { .stats__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 400px) { .stats__grid { grid-template-columns: 1fr; } }

/* ---------- 7. Sections & cards ---------- */

.section { padding: clamp(52px, 7vw, 84px) 0; }
.section--alt { background: var(--bg-alt); border-block: 1px solid var(--border); }

.section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 34px;
  flex-wrap: wrap;
}
.section__head h2 { font-size: clamp(1.55rem, 3vw, 2rem); }
.section__head p { margin: 8px 0 0; color: var(--muted); max-width: 62ch; }

.link-more {
  font-size: 14.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.link-more::after { content: "→"; transition: transform 0.15s ease; }
.link-more:hover { text-decoration: none; }
.link-more:hover::after { transform: translateX(3px); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.card__icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-bottom: 16px;
}
.card__icon svg { width: 20px; height: 20px; }
.card h3 { font-size: 1.2rem; margin-bottom: 9px; }
.card p { margin: 0 0 18px; color: var(--text-2); font-size: 0.955rem; }
.card .link-more { margin-top: auto; }

/* Book cards */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
}
.book {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.book:hover { border-color: var(--accent-line); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.book img {
  width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.book h3 { font-size: 1.05rem; margin-bottom: 8px; line-height: 1.35; }
.book p { margin: 0 0 14px; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 480px) { .book { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; } }

/* News preview list */
.news-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.news-list li {
  position: relative;
  padding: 16px 0 16px 30px;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.965rem;
}
.news-list li:last-child { border-bottom: 0; }
.news-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 1.55em;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

/* ---------- 8. Page header (interior pages) ---------- */

.page-header {
  position: relative;
  padding: clamp(44px, 6vw, 68px) 0 clamp(28px, 3vw, 38px);
  border-bottom: 1px solid var(--border);
  background: var(--bg-alt);
  overflow: hidden;
}
.page-header::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(620px 300px at 8% -30%, var(--accent-soft), transparent 70%);
  pointer-events: none;
}
.page-header .wrap { position: relative; }
.page-header h1 { font-size: clamp(2rem, 4.4vw, 2.85rem); }
.page-header p.page-header__sub {
  margin: 14px 0 0;
  color: var(--muted);
  max-width: 68ch;
  font-size: 1.02rem;
}
.page-meta {
  margin-top: 16px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.page-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }

/* ---------- 9. Prose (imported content) ---------- */

.prose { padding: clamp(40px, 5vw, 60px) 0 clamp(56px, 7vw, 84px); }

.prose p { margin: 0 0 1.15em; color: var(--text-2); }
.prose p:last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 600; }

.prose h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  margin: 3rem 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--header-h) + 20px);
}
.prose h2:first-child { margin-top: 0; }

.prose h3 {
  font-size: 1.18rem;
  margin: 2rem 0 0.75rem;
}

.prose > ul, .prose > ol,
.prose ul, .prose ol {
  margin: 0 0 1.4em;
  padding-left: 0;
  list-style: none;
}
.prose li { position: relative; margin-bottom: 0.85em; color: var(--text-2); }
.prose li:last-child { margin-bottom: 0; }

/* unordered: square bullet */
.prose ul > li { padding-left: 24px; }
.prose ul > li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.66em;
  width: 6px; height: 6px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.7;
}

/* ordered: counters */
.prose ol { counter-reset: item; }
.prose ol > li { padding-left: 42px; counter-increment: item; }
.prose ol > li::before {
  content: counter(item);
  position: absolute;
  left: 0;
  top: 0.15em;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* nested lists */
.prose li > ul, .prose li > ol { margin: 0.7em 0 0.2em; }
.prose li > ul > li { padding-left: 20px; font-size: 0.95em; }
.prose li > ul > li::before { background: var(--muted); opacity: 0.55; width: 5px; height: 5px; }

.prose blockquote {
  margin: 1.8em 0;
  padding: 18px 24px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--accent-soft);
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 1.08rem;
  line-height: 1.6;
}
.prose blockquote p { color: inherit; margin: 0; }
.prose blockquote p + p { margin-top: 0.7em; }

.prose .pub-date {
  margin: -0.6rem 0 1.6rem;
  font-size: 13px;
  color: var(--muted);
}
.prose .pub-date em { font-style: normal; }

.prose figure { margin: 2em 0; text-align: center; }
.prose figure img {
  margin-inline: auto;
  max-width: min(100%, 440px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  background: #fff;
}
.prose figure a { display: inline-block; }
.prose figure figcaption {
  margin-top: 12px;
  font-size: 0.865rem;
  color: var(--muted);
}

.prose .video {
  position: relative;
  margin: 2em auto;
  max-width: 680px;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
}
.prose .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Course accordions */
.prose details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 2px 16px;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.prose details[open] { border-color: var(--accent-line); background: var(--surface); }
.prose details:hover { border-color: var(--border-strong); }
.prose summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 28px 12px 0;
  position: relative;
  font-weight: 500;
  color: var(--text);
}
.prose summary::-webkit-details-marker { display: none; }
.prose summary::after {
  content: "";
  position: absolute;
  right: 4px;
  top: 1.15em;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}
.prose details[open] summary::after { transform: rotate(-135deg); }
.prose details .details-body {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-left: 2px solid var(--accent-line);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--surface-2);
  font-size: 0.925rem;
  color: var(--text-2);
}
.prose li > details { margin-bottom: 0; }

/* ---------- 10. Publication toolbar / filtering ---------- */

.toolbar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  padding: 14px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.toolbar__inner { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }

.search {
  position: relative;
  flex: 1 1 260px;
  min-width: 0;
  max-width: 340px;
}
.search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  padding: 10px 14px 10px 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 14.5px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

.filter-status { font-size: 13.5px; color: var(--muted); margin-left: auto; }

.is-hidden { display: none !important; }

mark {
  background: var(--accent-soft);
  color: var(--text);
  padding: 0 2px;
  border-radius: 3px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

/* ---------- 11. Contact strip ---------- */

.contact {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
}
.contact__item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.contact__item h3 { font-size: 0.95rem; font-family: var(--font-sans); font-weight: 600; margin-bottom: 6px; }
.contact__item p { margin: 0; color: var(--muted); font-size: 0.93rem; }

/* ---------- 12. Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 46px 0 32px;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 36px;
  margin-bottom: 34px;
}
.site-footer h4 {
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 14px;
}
.site-footer p { color: var(--muted); font-size: 0.93rem; margin: 0 0 18px; max-width: 42ch; }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.footer-links a { color: var(--text-2); font-size: 0.93rem; }
.footer-links a:hover { color: var(--accent); text-decoration: none; }

.site-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
@media (max-width: 780px) {
  .site-footer__grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- 13. Back to top ---------- */

.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 50;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { color: var(--accent); border-color: var(--accent-line); }
.to-top svg { width: 17px; height: 17px; }

/* ---------- 14. Print ---------- */

@media print {
  .site-header, .site-footer, .to-top, .toolbar, .hero__portrait::after { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  a { color: #000; text-decoration: underline; }
  .prose h2 { break-after: avoid; }
  .prose li, .card { break-inside: avoid; }
}
