/* ============================================================
   sections.css — per-section styling: sidebar profile (hero),
   about, news, publication, projects, experience, skills,
   contact.
   ============================================================ */

/* ---------- Sidebar profile (academic — no card, no shadow) ---------- */
.profile {
  text-align: center;
  padding-top: 0.4rem;
}

.avatar-wrap {
  width: 150px;
  height: 150px;
  margin: 0 auto 1.25rem;
}

.avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 30%;
  border: 1px solid var(--border);
  display: block;
}

/* Monogram fallback shows only if the headshot fails to load */
.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.avatar-wrap .avatar-fallback {
  display: none;
}

.avatar-wrap.img-failed .avatar-fallback {
  display: grid;
}

.profile-name {
  font-size: 1.65rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.profile-affiliation {
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 400;
  margin-bottom: 1.5rem;
}

/* Vertically stacked info list, academic-sidebar style */
.profile-info {
  list-style: none;
  text-align: left;
  width: fit-content;
  margin: 0 auto;
  display: grid;
  gap: 0.6rem;
}

.profile-info li,
.profile-info a,
.profile-info button {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 400;
}

.profile-info a:hover {
  color: var(--accent);
  text-decoration: none;
}

.profile-info svg {
  flex-shrink: 0;
  opacity: 0.75;
}

/* Page Views counter: the ONE sidebar element with a border; hidden unless
   the API responds */
.views-box {
  margin-top: 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
}

/* Desktop: stretch the profile to the sticky column's height and float the
   views box mid-way through the empty space below the info list */
@media (min-width: 901px) {
  .profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 7rem);
  }

  .views-box {
    margin: auto 0;
  }
}

/* Button items in the info list look identical to the link items */
.profile-info button {
  font-family: var(--font-body);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.profile-info button:hover {
  color: var(--accent);
}

/* ---------- Section scaffolding ---------- */
.section {
  padding: 2.2rem 0 2.6rem;
  border-bottom: 1px solid var(--border);
}

.section:first-child {
  padding-top: 0.4rem;
}

.section:last-of-type {
  border-bottom: none;
}

/* Quiet, editorial headings — the sidebar name is the only large element */
.section h2 {
  font-size: 1.22rem;
  font-weight: 600;
  margin-bottom: 1.2rem;
}

.section-index {
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  margin-right: 0.35rem;
}

.section-sub {
  color: var(--text-muted);
  margin: -0.6rem 0 1.4rem;
  font-size: 0.95rem;
}

/* Prose blocks: plain first-person paragraphs (About).
   Width is governed by the shared content column (see .layout). */

.prose p {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.75;
}

.prose p + p {
  margin-top: 1rem;
}

.lead {
  color: var(--text-muted);
  font-size: 1.02rem;
}

.lead strong {
  color: var(--text);
}

/* ---------- Highlights (one-line rows) ---------- */
.hl-list {
  list-style: none;
  display: grid;
  gap: 0.5rem;
}

.hl-row {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hl-date {
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 600;
  color: var(--accent);
}

/* Only organization / paper names are links; roles are bold plain text */
.hl-row a {
  color: var(--accent);
}

.hl-row a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hl-role {
  font-weight: 600;
  color: var(--text);
}

/* ---------- Publication ---------- */
.pub {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.6rem 1.7rem;
  box-shadow: var(--shadow);
}

.pub-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.pub-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--venue);
  border: 1px solid color-mix(in srgb, var(--venue) 35%, transparent);
  background: color-mix(in srgb, var(--venue) 7%, transparent);
  padding: 0.18rem 0.6rem;
  border-radius: var(--radius-full);
}

/* Title sized to fit on ONE line within the content column on desktop;
   natural wrapping only on mobile */
.pub h3 {
  font-size: 1rem;
  letter-spacing: -0.03em;
  white-space: nowrap;
  margin-bottom: 0.6rem;
}

@media (max-width: 900px) {
  .pub h3 {
    white-space: normal;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
  }
}

.pub-authors {
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.6;
  margin-bottom: 0.35rem;
}

.pub-authors strong {
  color: var(--text);
}

.pub-venue {
  color: var(--venue);
  font-size: 0.88rem;
  font-style: italic;
  margin-bottom: 0.7rem;
}

.pub-summary {
  color: var(--text-muted);
  font-size: 0.93rem;
  margin-bottom: 1rem;
}

.pub-links {
  display: flex;
  gap: 0.55rem;
}

.pub-links a {
  display: inline-block;
  padding: 0.28rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.84rem;
  font-weight: 500;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.pub-links a:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* ---------- Projects grid: 2×2 on desktop, single column on mobile;
   grid stretch keeps cards equal height per row ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.more-link-row {
  margin-top: 1.3rem;
}

.more-link {
  font-size: 0.95rem;
  font-weight: 500;
}

/* ---------- Experience timeline ---------- */
.timeline-group {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 1.8rem 0 0.6rem;
}

.timeline-group:first-of-type {
  margin-top: 0.4rem;
}

.timeline {
  list-style: none;
  position: relative;
  padding-left: 1.15rem;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--border);
  border-radius: 2px;
}

/* Two-column rows: fixed right-aligned date column + content. The date and
   the role heading use different font sizes, so baseline alignment alone
   left them visually offset — instead both first lines get the SAME fixed
   line-height (1.4rem) and the row top-aligns, making the line boxes
   coincide exactly. */
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 1.1rem;
  align-items: start;
  padding: 0.7rem 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.15rem;
  top: 1.28rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Date cell justified on BOTH edges: start date flush left, dash centered,
   end date flush right — every row shares identical left AND right edges */
.timeline-when {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  line-height: 1.4rem; /* fixed: must match .timeline-what h4 */
}

.timeline-when span:first-child {
  justify-self: start;
}

.timeline-when .when-dash {
  justify-self: center;
  padding: 0 0.3rem;
}

.timeline-when span:last-child {
  justify-self: end;
}

.timeline-what h4 {
  font-size: 0.99rem;
  line-height: 1.4rem; /* fixed: must match .timeline-when */
  margin-bottom: 0.25rem;
}

/* Education rows: bold program flush left, institution flush right on the
   same line; on narrow screens the institution wraps below instead */
.edu-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.1rem 1rem;
}

.edu-inst {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.timeline-what .org {
  color: var(--text-muted);
  font-weight: 500;
}

/* Organization links: accent color, subtle hover underline */
.timeline-what .org a {
  color: var(--accent);
  font-weight: 500;
}

.timeline-what .org a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.timeline-what p {
  color: var(--text-muted);
  font-size: 0.91rem;
  line-height: 1.6;
}

/* ---------- Skills ---------- */
.skills-grid {
  display: grid;
  gap: 1.4rem;
}

.skill-group h3 {
  font-size: 0.95rem;
  margin-bottom: 0.6rem;
}

/* ---------- Misc. page ---------- */
.page-single {
  max-width: 1100px;
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.back-row {
  margin: 0.6rem 0 0.2rem;
}

.misc-head {
  margin: 1.4rem 0 1.6rem;
}

.misc-title {
  font-size: 1.55rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.misc-tagline {
  color: var(--text-muted);
  font-size: 0.98rem;
}

/* Hobby grid: original line icons + labels */
.hobby-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.8rem;
  margin-top: 0.4rem;
}

@media (max-width: 900px) {
  .hobby-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .hobby-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.hobby-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  padding: 1rem 0.4rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: color 0.15s ease, border-color 0.15s ease;
}

.hobby-item svg {
  color: var(--accent);
}

.hobby-item span {
  font-size: 0.88rem;
}

.hobby-item:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}



/* ---------- Footprints map (composite, GPU camera) ---------- */
.fp-wrap {
  position: relative;
  margin-top: 0.5rem;
}

/* container owns the aspect (matches the composite viewBox 1000x520) */
.fp-map {
  aspect-ratio: 1000 / 520;
  overflow: hidden;
  cursor: grab;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  touch-action: pan-y; /* one-finger scrolls the page; two fingers pan/zoom */
}

.fp-map:active {
  cursor: grabbing;
}

/* the camera: the ONLY element written to during pan/zoom. No will-change —
   the settle bake re-renders vectors, and a pinned texture would go stale. */
.fp-cam {
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
}

.fp-cam svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* --fp-sw counter-scales stroke width (set from JS in coarse buckets) so
   borders stay hairline while zoomed */
.fp-map path {
  fill: #ececec;
  stroke: #ffffff;
  stroke-width: calc(var(--fp-sw, 0.5) * 1px);
}

.fp-map #countries path.visited {
  fill: #274c72;
  fill-opacity: 0.85;
  cursor: pointer;
  transition: filter 0.12s ease;
}

.fp-map #countries path.visited:hover {
  filter: brightness(1.35);
}

/* Semantic zoom: past the threshold the CN/US country fills crossfade to
   their admin-1 groups. Prebuilt nodes; class toggles only. */
.fp-map #countries path,
.fp-map g[id^="admin1-"] {
  transition: opacity 0.25s ease;
}

.fp-map g[id^="admin1-"] {
  opacity: 0;
  pointer-events: none;
}

.fp-map .fp-zoomed g[id^="admin1-"] {
  opacity: 1;
  pointer-events: auto;
}

.fp-map .fp-zoomed #countries path#c-CN,
.fp-map .fp-zoomed #countries path#c-US {
  opacity: 0;
  pointer-events: none;
}

.fp-map g[id^="admin1-"] path.visited {
  fill: #274c72;
  fill-opacity: 0.85;
}

.fp-map g[id^="admin1-"] path.visited:hover {
  filter: brightness(1.35);
}

/* City dots: appear past the deep-zoom threshold; sizes counter-scaled so
   they stay readable at any zoom */
.fp-map .fp-cities {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.fp-map .fp-cities-on .fp-cities {
  opacity: 1;
  pointer-events: auto; /* dots become clickable once visible */
}

.fp-map .fp-cities-on .fp-city {
  cursor: pointer;
}

.fp-city circle {
  r: calc(var(--fp-inv, 1) * 4px);
  fill: #274c72;
  stroke: #ffffff;
  stroke-width: calc(var(--fp-inv, 1) * 1px);
}

/* ONE label typography for the whole marker family (city dots and
   tiny-region markers) — the declutter pass may override anchor/transform
   inline to resolve collisions */
.fp-city text,
.fp-tiny text {
  font-family: var(--font-body);
  font-size: calc(var(--fp-inv, 1) * 9px);
  font-weight: 600;
  fill: #17202c;
  text-anchor: middle;
  transform: translateY(calc(var(--fp-inv, 1) * -7px));
  paint-order: stroke;
  stroke: #ffffff;
  stroke-width: calc(var(--fp-inv, 1) * 2px);
}

/* 1px leader line drawn by the declutter pass for far-displaced labels */
.fp-leader {
  stroke: #274c72;
  stroke-width: calc(var(--fp-inv, 1) * 1px);
}

/* Tiny-region markers (e.g. District of Columbia): a ring/dot + label at
   the region centroid, revealed together with the admin1 layer and
   counter-scaled so they hold a constant screen size at any zoom */
.fp-map .fp-tiny-marks {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.fp-map .fp-zoomed .fp-tiny-marks {
  opacity: 1;
  pointer-events: auto;
}

.fp-map .fp-zoomed .fp-tiny {
  cursor: pointer;
}

/* Unified marker family: the tiny-region core IS the city dot (same size,
   same stroke); the only distinction is the thin outer ring */
.fp-tiny .fp-tiny-core {
  r: calc(var(--fp-inv, 1) * 4px);
  fill: #274c72;
  stroke: #ffffff;
  stroke-width: calc(var(--fp-inv, 1) * 1px);
}

.fp-tiny .fp-tiny-ring {
  r: calc(var(--fp-inv, 1) * 7px);
  fill: none;
  stroke: #274c72;
  stroke-width: calc(var(--fp-inv, 1) * 1px);
  transition: filter 0.12s ease;
}

.fp-tiny:hover .fp-tiny-core,
.fp-tiny:hover .fp-tiny-ring {
  filter: brightness(1.35);
}

/* Region popover: anchored card opened by clicking a visited region */
.fp-pop {
  position: absolute;
  z-index: 8;
  min-width: 180px;
  max-width: 260px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.8rem 0.95rem;
}

.fp-pop-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.9rem;
}

.fp-pop-title {
  font-size: 0.95rem;
}

.fp-pop-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}


.fp-pop-photos {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.55rem;
}

.fp-pop-photos-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  align-self: center; /* vertically centered beside the thumbnails */
  margin-left: 0.15rem;
}

.fp-pop-thumb {
  width: 52px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: none;
  overflow: hidden;
  cursor: zoom-in;
}

.fp-pop-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.fp-pop-soon {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* HK/MO live in the CN admin-1 layer; hide their admin-0 shapes when the
   detail layer is showing so they don't double-render */
.fp-map .fp-zoomed #countries path#c-HK,
.fp-map .fp-zoomed #countries path#c-MO {
  opacity: 0;
  pointer-events: none;
}

/* single reused tooltip; positioned via transform only */
.fp-tip {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  z-index: 5;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.22rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  white-space: nowrap;
  box-shadow: var(--shadow);
  will-change: transform;
}

.fp-tip.muted {
  color: var(--text-muted);
}

@media (pointer: coarse) {
  .fp-tip {
    display: none;
  }
}

/* Zoom controls: thumb-sized, site button styling */
.fp-zoom-controls {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  z-index: 6;
}

.fp-zoom-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.fp-zoom-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Stat rings (heading row) ---------- */
.fp-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.fp-rings {
  display: flex;
  gap: 1.2rem;
}

.fp-ring {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.ring-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}

.ring-wrap svg {
  transform: rotate(-90deg); /* arc starts at 12 o'clock */
}

.ring-track,
.ring-fill {
  fill: none;
  stroke-width: 6;
}

.ring-track {
  stroke: var(--bg-alt);
}

.ring-fill {
  stroke: #274c72;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s ease;
}

:root[data-theme="dark"] .ring-fill {
  stroke: #7fa3c9;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.1;
}

.ring-num {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
}

.ring-of {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.ring-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 640px) {
  .fp-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .fp-rings {
    width: 100%;
    justify-content: center;
  }
}

:root[data-theme="dark"] .fp-map path {
  fill: #232e42;
  stroke: #0b0f19;
}

:root[data-theme="dark"] .fp-map #countries path.visited,
:root[data-theme="dark"] .fp-map g[id^="admin1-"] path.visited {
  fill: #7fa3c9;
}

:root[data-theme="dark"] .fp-city circle {
  fill: #7fa3c9;
  stroke: #0b0f19;
}

:root[data-theme="dark"] .fp-city text,
:root[data-theme="dark"] .fp-tiny text {
  fill: #e5eaf3;
  stroke: #0b0f19;
}

:root[data-theme="dark"] .fp-tiny .fp-tiny-core {
  fill: #7fa3c9;
  stroke: #0b0f19;
}

:root[data-theme="dark"] .fp-tiny .fp-tiny-ring {
  stroke: #7fa3c9;
}

:root[data-theme="dark"] .fp-leader {
  stroke: #7fa3c9;
}


/* ---------- Featured carousel (misc.html Albums) ---------- */
.carousel {
  overflow: hidden;
  margin-top: 0.4rem;
}

/* seamless marquee: the track holds TWO copies of the featured set; sliding
   by exactly -50% loops invisibly. Gap comes from slide margins so the -50%
   point stays exact. */
.carousel-track {
  display: flex;
  width: max-content;
  animation: carousel-scroll 30s linear infinite;
}

.carousel:hover .carousel-track,
.carousel.paused .carousel-track {
  animation-play-state: paused;
}

@keyframes carousel-scroll {
  to { transform: translateX(-50%); }
}

/* reduced motion / no animation: single copy, manually scrollable */
.carousel.static {
  overflow-x: auto;
}

.carousel.static .carousel-track {
  animation: none;
}

.carousel-slide {
  flex: none;
  height: 180px;
  margin-right: 0.8rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: none;
  overflow: hidden;
  cursor: zoom-in;
}

.carousel-slide img {
  height: 100%;
  width: auto;
  display: block;
}

.album-link-row {
  text-align: center;
  margin-top: 1.1rem;
}

@media (max-width: 640px) {
  .carousel-slide {
    height: 130px;
  }
}

/* Masonry-style responsive columns; items keep natural aspect ratios.
   Explicit counts per breakpoint: 2 mobile → 3 tablet → 4 → 5 desktop */
.photo-grid {
  columns: 2;
  column-gap: 1rem;
}

@media (min-width: 700px) {
  .photo-grid {
    columns: 3;
  }
}

@media (min-width: 1024px) {
  .photo-grid {
    columns: 4;
  }
}

@media (min-width: 1200px) {
  .photo-grid {
    columns: 5;
  }
}

.photo-item {
  break-inside: avoid;
  margin: 0 0 1rem;
}

.photo-open {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.photo-open img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  transition: transform 0.2s ease;
}

.photo-open:hover img {
  transform: scale(1.015);
}

.photo-item figcaption {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-top: 0.35rem;
  line-height: 1.5;
}

/* ---------- Contact: Email / LinkedIn / GitHub on ONE row; the email
   address must never wrap, so the cards are compact and the value font is
   slightly reduced ---------- */
/* Flexible widths: the email card (first) gets proportionally more room */
.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.9rem 0.95rem;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.contact-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: var(--shadow-lg);
}

.contact-card-icon {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: var(--radius-md);
  color: var(--on-accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.contact-card-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.contact-card-value {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  overflow-wrap: anywhere; /* safety net: wrap inside the card, never spill */
}

@media (max-width: 700px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

/* ---------- Responsive sections ---------- */
@media (max-width: 900px) {
  .profile {
    max-width: 30rem;
    margin: 0 auto;
  }
}

@media (max-width: 640px) {
  .timeline {
    padding-left: 1rem;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .timeline-item::before {
    left: -1rem;
  }

  .timeline-when {
    /* stacked above the content: keep the range compact, not justified */
    display: flex;
    justify-content: flex-start;
    gap: 0.35rem;
  }

  .contact-actions .button {
    width: 100%;
    text-align: center;
  }

  .section {
    padding: 1.8rem 0 2rem;
  }
}
