/* ==========================================================================
   Md Badrul Hasan — site styles
   Single stylesheet for all pages. Edit here, every page updates.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  /* Surfaces — original palette */
  --bg:            #121212;
  --surface:       #1f1f1f;
  --surface-head:  #1e1e1e;
  --nav-bg:        #1c1c1c;

  /* Rules */
  --line:          #333;
  --line-soft:     #292929;

  /* Ink */
  --ink:           #e0e0e0;
  --ink-dim:       #9a9a9a;
  --ink-faint:     #8a8a8a;

  /* Accent — #007bff for fills/indicators, lighter tint for text (6.7:1) */
  --accent:        #007bff;
  --accent-text:   #5aa9ff;
  --accent-wash:   rgba(0, 123, 255, 0.10);
  --accent-edge:   rgba(0, 123, 255, 0.40);

  /* Metrics */
  --radius:        6px;
  --radius-lg:     10px;
  --shell:         1180px;
  --measure:       68ch;
  --bar-h:         58px;

  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* keep anchored headings clear of the sticky bar */
  scroll-padding-top: calc(var(--bar-h) + 24px);
  -webkit-text-size-adjust: 100%;
}

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

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

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

/* Keyboard focus is visible everywhere */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

::selection { background: var(--accent-edge); color: #fff; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 500;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

.shell {
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 24px;
}

/* --------------------------------------------------------------------------
   3. Sticky top bar
   -------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(28, 28, 28, 0.94);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--bar-h);
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 24px;
}

/* Wordmark */
.brand {
  display: flex;
  align-items: baseline;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav a {
  position: relative;
  display: block;
  padding: 8px 10px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 500;
  border-radius: var(--radius);
  transition: color .15s ease, background-color .15s ease;
}
.nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.045); }

/* Current page: accent underline + brighter ink */
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px 2px 0 0;
}

.nav__cv {
  margin-left: 8px;
  padding: 6px 14px !important;
  color: var(--accent-text) !important;
  border: 1px solid var(--accent-edge);
  background: var(--accent-wash);
}
.nav__cv:hover { background: rgba(0, 123, 255, 0.18) !important; }

/* Hamburger — a real button */
.nav-toggle {
  display: none;
  margin-left: auto;
  width: 42px;
  height: 38px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-direction: column;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform .22s ease, opacity .18s ease;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }

  .nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.45);
    display: none;
  }
  .nav.is-open { display: flex; }

  .nav a { padding: 12px 14px; font-size: 1rem; border-radius: var(--radius); }
  .nav a[aria-current="page"] { background: var(--accent-wash); }
  .nav a[aria-current="page"]::after { left: 0; width: 3px; right: auto; top: 10px; bottom: 10px; height: auto; }
  .nav__cv { margin: 6px 0 0; text-align: center; }
}

/* --------------------------------------------------------------------------
   4. Home hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  overflow: hidden;
  background: var(--surface-head);
  border-bottom: 1px solid var(--line);
}

/* Streamline field — a vortex, drawn once, static.
   The edge fade is a CSS mask rather than an SVG <mask>: Chromium maps the
   SVG mask attribute onto the CSS mask shorthand and drops the group. */
.hero__flow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(58% 128% at 78% 46%, #000 0%, rgba(0,0,0,.62) 52%, transparent 92%);
          mask-image: radial-gradient(58% 128% at 78% 46%, #000 0%, rgba(0,0,0,.62) 52%, transparent 92%);
}

/* Nothing but text on narrow screens — the art has no room to read */
@media (max-width: 700px) { .hero__flow { display: none; } }
.hero__flow path,
.hero__flow ellipse { fill: none; stroke: var(--accent); }

.hero__inner {
  position: relative;
  max-width: var(--shell);
  margin-inline: auto;
  padding: 56px 24px 44px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 5vw, 3.1rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}

.hero__role {
  margin: 0 0 6px;
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--ink);
  font-weight: 400;
}

.hero__where {
  margin: 0 0 26px;
  color: var(--ink-dim);
  font-size: 0.98rem;
  max-width: 54ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   5. Buttons and links
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.btn:hover { border-color: #4a4a4a; background: rgba(255, 255, 255, 0.04); }

.btn--accent {
  border-color: var(--accent-edge);
  background: var(--accent-wash);
  color: var(--accent-text);
}
.btn--accent:hover { background: rgba(0, 123, 255, 0.20); border-color: var(--accent); }

.btn i { font-size: 0.95em; }

/* Inline contact row */
.contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.contact-row a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.92rem;
  transition: color .15s ease;
}
.contact-row a:hover { color: var(--accent-text); }
.contact-row i { color: var(--accent-text); width: 1em; text-align: center; }

/* --------------------------------------------------------------------------
   6. Inner page head
   -------------------------------------------------------------------------- */
.page-head {
  background: var(--surface-head);
  border-bottom: 1px solid var(--line);
}
.page-head__inner {
  max-width: var(--shell);
  margin-inline: auto;
  padding: 40px 24px 34px;
}
.page-head h1 {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.6vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  padding-bottom: 12px;
  position: relative;
}
.page-head h1::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 46px;
  height: 2px;
  background: var(--accent);
}
.page-head p {
  margin: 14px 0 0;
  color: var(--ink-dim);
  max-width: 62ch;
  font-size: 0.98rem;
}

/* --------------------------------------------------------------------------
   7. Layout
   -------------------------------------------------------------------------- */
.layout {
  display: grid;
  gap: 32px;
  max-width: var(--shell);
  margin-inline: auto;
  padding: 36px 24px 56px;
  align-items: start;
}

/* Home: profile rail + content */
.layout--home { grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }

/* Inner pages: on-this-page rail + content */
.layout--doc { grid-template-columns: minmax(0, 210px) minmax(0, 1fr); }

/* Single column */
.layout--solo { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 940px) {
  .layout--home,
  .layout--doc { grid-template-columns: minmax(0, 1fr); }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
}

@media (max-width: 560px) {
  .panel { padding: 20px 18px; }
  .shell, .layout, .hero__inner, .page-head__inner, .topbar__inner { padding-inline: 16px; }
}

/* --------------------------------------------------------------------------
   8. Profile rail (home)
   -------------------------------------------------------------------------- */
/* Sticks on desktop regardless of window height. On short windows the rail
   scrolls internally rather than having its lower half become unreachable. */
@media (min-width: 941px) {
  .rail {
    position: sticky;
    top: calc(var(--bar-h) + 20px);
    max-height: calc(100vh - var(--bar-h) - 40px);
    overflow-y: auto;
    /* room so the scrollbar never sits on top of the text */
    padding-right: 4px;
    scrollbar-width: thin;
  }
  .rail::-webkit-scrollbar { width: 6px; }
  .rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 6px; }
  .rail::-webkit-scrollbar-track { background: transparent; }
}

.rail__photo {
  width: 100%;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  margin-bottom: 22px;
}

.rail h2 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.rail h2:not(:first-of-type) { margin-top: 26px; }

.rail ul { margin: 0; padding: 0; list-style: none; }
.rail li { position: relative; padding-left: 16px; margin-bottom: 9px; font-size: 0.92rem; color: var(--ink-dim); }
.rail li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.7;
}

.rail__links { display: flex; flex-direction: column; gap: 10px; }

/* --------------------------------------------------------------------------
   9. Content typography
   -------------------------------------------------------------------------- */
.section { scroll-margin-top: calc(var(--bar-h) + 20px); }
.section + .section { margin-top: 40px; }

.section > h2 {
  font-family: var(--serif);
  font-size: 1.42rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.section h3,
.prose h3 {
  font-family: var(--sans);
  font-size: 1.03rem;
  font-weight: 600;
  margin: 26px 0 8px;
}

.prose p { margin: 0 0 16px; max-width: var(--measure); }
.prose p:last-child { margin-bottom: 0; }
.prose a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--accent-edge); }
.prose a:hover { border-bottom-color: var(--accent-text); }
.prose strong, .prose b { font-weight: 600; color: #f0f0f0; }

/* Plain bulleted list inside content */
.list { margin: 0; padding: 0; list-style: none; max-width: var(--measure); }
.list li { position: relative; padding-left: 18px; margin-bottom: 10px; }
.list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 6px;
  height: 1px;
  background: var(--ink-faint);
}
.list a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--accent-edge); }
.list a:hover { border-bottom-color: var(--accent-text); }

/* --------------------------------------------------------------------------
   10. Fact rows — education, experience, skills
   Left column carries real metadata (dates / category), not decoration.
   -------------------------------------------------------------------------- */
.facts { display: grid; gap: 4px; }

.fact {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
}
.fact:first-child { border-top: 0; padding-top: 0; }

.fact__meta {
  font-size: 0.84rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
  white-space: nowrap;
}
.fact__title { font-weight: 600; margin: 0 0 2px; }
.fact__sub { color: var(--ink-dim); font-size: 0.94rem; margin: 0; }

.fact__notes { margin: 10px 0 0; padding: 0; list-style: none; }
.fact__notes li { position: relative; padding-left: 18px; margin-bottom: 9px; color: var(--ink-dim); font-size: 0.94rem; }
.fact__notes li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 6px;
  height: 1px;
  background: var(--ink-faint);
}
.fact__notes li:last-child { margin-bottom: 0; }
.fact__notes a { color: var(--accent-text); text-decoration: none; border-bottom: 1px solid var(--accent-edge); }
.fact__notes a:hover { border-bottom-color: var(--accent-text); }

@media (max-width: 620px) {
  .fact { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .fact__meta { order: 2; padding-top: 4px; }
}

/* Skills: category on the left, items on the right */
.skill-row { grid-template-columns: 210px minmax(0, 1fr); }
@media (max-width: 620px) { .skill-row { grid-template-columns: minmax(0, 1fr); } }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.tags li {
  font-size: 0.84rem;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 9px;
  background: rgba(255, 255, 255, 0.018);
}

/* --------------------------------------------------------------------------
   11. On-this-page rail with scroll-spy
   -------------------------------------------------------------------------- */
.toc { position: sticky; top: calc(var(--bar-h) + 20px); }

.toc__label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  margin: 0 0 10px;
}

.toc ol { margin: 0; padding: 0; list-style: none; border-left: 1px solid var(--line); }

.toc a {
  display: block;
  padding: 7px 0 7px 14px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.9rem;
  line-height: 1.4;
  transition: color .15s ease, border-color .15s ease;
}
.toc a:hover { color: var(--ink); }
.toc a.is-current { color: var(--accent-text); border-left-color: var(--accent); }

@media (max-width: 940px) {
  .toc {
    position: sticky;
    top: var(--bar-h);
    z-index: 40;
    margin: 0 -24px;
    padding: 10px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .toc__label { display: none; }
  .toc ol {
    display: flex;
    gap: 6px;
    border-left: 0;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .toc ol::-webkit-scrollbar { height: 3px; }
  .toc ol::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
  .toc a {
    white-space: nowrap;
    padding: 6px 12px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 100px;
    font-size: 0.86rem;
  }
  .toc a.is-current {
    border-color: var(--accent-edge);
    background: var(--accent-wash);
  }
}
@media (max-width: 560px) { .toc { margin-inline: -16px; padding-inline: 16px; } }

/* Pages whose filter chips already do the job of the rail on small screens */
@media (max-width: 940px) { .toc[data-mobile="off"] { display: none; } }

/* --------------------------------------------------------------------------
   12. Publications
   Year hangs in the left margin so the list scans chronologically.
   -------------------------------------------------------------------------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
}

.chip {
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 100px;
  background: transparent;
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all .15s ease;
}
.chip:hover { color: var(--ink); border-color: #454545; }
.chip[aria-pressed="true"] {
  color: var(--accent-text);
  border-color: var(--accent-edge);
  background: var(--accent-wash);
}

.filters__count {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 560px) { .filters__count { margin-left: 0; width: 100%; } }

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

.pub {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 20px;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
}
.pub:first-child { border-top: 0; }
.pub[hidden] { display: none; }

.pub__year {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.pub__title { margin: 0 0 6px; font-size: 1.01rem; font-weight: 500; line-height: 1.45; }
.pub__title-link { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--accent-edge); }
.pub__title-link:hover { color: var(--accent-text); border-bottom-color: var(--accent-text); }
.pub__authors { margin: 0 0 6px; font-size: 0.92rem; color: var(--ink-dim); }
.pub__authors .me { color: var(--ink); font-weight: 600; }
.pub__venue { margin: 0; font-size: 0.92rem; color: var(--ink-dim); font-style: italic; }

.pub__foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }

/* Status text. Deliberately unboxed: a box on this page means a link. */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
}
.pill--review { color: var(--ink-dim); font-style: italic; }
.pill + .pill { margin-left: 6px; }

.pub__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  padding: 2px 10px;
  border-radius: 3px;
  border: 1px solid var(--accent-edge);
  color: var(--accent-text);
  text-decoration: none;
  transition: background-color .15s ease;
}
.pub__link:hover { background: var(--accent-wash); }

@media (max-width: 620px) {
  .pub { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .pub__year { font-size: 0.9rem; font-family: var(--sans); }
}

.empty {
  padding: 28px 0;
  color: var(--ink-dim);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   13. News — genuinely chronological, so a dated timeline is earned
   -------------------------------------------------------------------------- */
.timeline { margin: 0; padding: 0; list-style: none; }

.entry {
  position: relative;
  padding: 0 0 38px 30px;
  border-left: 1px solid var(--line);
}
.entry:last-child { padding-bottom: 0; border-left-color: transparent; }
.entry::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 8px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.entry__date {
  display: block;
  font-size: 0.82rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
/* beats `.section h3` — keep this selector at least as specific */
.timeline .entry__title {
  font-family: var(--serif);
  font-size: 1.18rem;
  font-weight: 600;
  margin: 0 0 10px;
  line-height: 1.35;
}
.timeline .entry__title a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--accent-edge); }
.timeline .entry__title a:hover { color: var(--accent-text); }

/* --------------------------------------------------------------------------
   14. Figures and galleries
   -------------------------------------------------------------------------- */
/* Figure shrinks to its image so the caption lines up with it instead of
   wrapping to a short stub underneath a much wider photo. */
figure {
  margin: 20px 0;
  width: fit-content;
  max-width: min(100%, 680px);
}
figure img {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  max-width: 100%;
}
figcaption {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.5;
  /* width:0 keeps the caption text out of the figure's intrinsic width, so the
     figure shrinks to the image; min-width then stretches it back to match. */
  width: 0;
  min-width: 100%;
}

.figure--narrow { max-width: min(100%, 440px); }

/* Gallery figures stay on the grid, so they must not shrink-wrap */
.gallery figure { width: auto; max-width: none; }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
  margin: 20px 0 0;
}
.gallery figure { margin: 0; }
.gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  cursor: zoom-in;
  transition: border-color .15s ease;
}
.gallery img:hover { border-color: var(--accent-edge); }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(10, 10, 10, 0.94);
}
.lightbox.is-open { display: flex; }
.lightbox img {
  max-width: min(1100px, 92vw);
  max-height: 82vh;
  width: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.lightbox figcaption { text-align: center; color: var(--ink-dim); margin-top: 14px; max-width: 70ch; }
.lightbox__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox__close:hover { border-color: var(--accent-edge); color: var(--accent-text); }

/* --------------------------------------------------------------------------
   15. Cross-page prompt at the end of content
   -------------------------------------------------------------------------- */
.next-up {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.next-up p { margin: 0; color: var(--ink-dim); font-size: 0.94rem; }

/* --------------------------------------------------------------------------
   16. Back to top
   -------------------------------------------------------------------------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent-text); border-color: var(--accent-edge); }

/* --------------------------------------------------------------------------
   17. Footer
   -------------------------------------------------------------------------- */
.site-foot {
  border-top: 1px solid var(--line);
  background: var(--surface-head);
  margin-top: 20px;
}
.site-foot__inner {
  max-width: var(--shell);
  margin-inline: auto;
  padding: 30px 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 16px 32px;
  align-items: center;
  justify-content: space-between;
}
.site-foot p { margin: 0; font-size: 0.85rem; color: var(--ink-faint); }

/* Roomier tap targets for the footer links on touch screens */
@media (max-width: 820px) {
  .site-foot .contact-row { gap: 4px 18px; }
  .site-foot .contact-row a { padding: 9px 0; }
}
@media (max-width: 560px) { .site-foot__inner { padding-inline: 16px; } }

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