/* ============================================
   Demghart — bento portfolio
   ============================================ */

:root {
  --bg: #efece7;
  --card: #faf9f7;
  --card-alt: #ffffff;
  --text: #1d1c1a;
  --text-soft: #6f6c66;
  --border: rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 2px rgba(20, 18, 14, 0.04), 0 8px 24px rgba(20, 18, 14, 0.05);
  --shadow-hover: 0 2px 4px rgba(20, 18, 14, 0.06), 0 16px 40px rgba(20, 18, 14, 0.10);
  --pill-bg: #faf9f7;
  --accent-blue: #3f6df4;
  --accent-orange: #f47a3f;
  --accent-purple: #8a5cf5;
  --radius: 24px;
}

html[data-theme="dark"] {
  --bg: #141414;
  --card: #1e1e1e;
  --card-alt: #242424;
  --text: #f2f0ec;
  --text-soft: #9c9892;
  --border: rgba(255, 255, 255, 0.07);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.4), 0 16px 40px rgba(0, 0, 0, 0.5);
  --pill-bg: #1e1e1e;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

body {
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.4s ease, color 0.4s ease;
  min-height: 100vh;
}

h1, h2, h3, .filter-btn, .logo, .stat-number, .quote-text {
  font-family: "Poppins", "Inter", system-ui, sans-serif;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.logo {
  text-decoration: none;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1;
}
.logo-dot { color: var(--accent-purple); }

.filter-nav {
  position: relative;
  display: flex;
  gap: 4px;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow);
}

.filter-btn {
  position: relative;
  z-index: 1;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease;
  white-space: nowrap;
}
.filter-btn.is-active { color: var(--text); }

.filter-pill {
  position: absolute;
  z-index: 0;
  top: 6px;
  bottom: 6px;
  left: 0;
  width: 0;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: left 0.35s cubic-bezier(0.4, 0, 0.2, 1), width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggles { display: flex; gap: 8px; }

.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: var(--pill-bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 9px 14px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.3s ease, color 0.3s ease, opacity 0.3s ease;
}
.toggle-btn:not(.is-on):not(#theme-toggle) { opacity: 0.55; }
.toggle-icon { display: block; flex-shrink: 0; }
.icon-moon { display: none; }
html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  max-width: 1240px;
  margin: 10px auto 60px;
  padding: 0 28px;
}

.span-2 { grid-column: span 2; }

.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.35s ease,
              background 0.4s ease,
              opacity 0.4s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card.is-hidden { display: none; }
.card.is-entering { animation: cardIn 0.45s cubic-bezier(0.3, 0.9, 0.4, 1) both; }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ---------- Intro ---------- */
.card-intro {
  flex-direction: row;
  align-items: center;
  gap: 26px;
}
.avatar {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 28px;
  flex-shrink: 0;
}
.intro-text {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text-soft);
}
.intro-text strong { color: var(--text); }

/* ---------- Social ---------- */
.card-social {
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  position: absolute;
}
.social-icon { transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.card-social:hover .social-icon { transform: scale(1.15) rotate(-4deg); }

.copied-badge {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translate(-50%, 8px);
  background: var(--text);
  color: var(--bg);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.card-email.show-copied .copied-badge {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Stat ---------- */
.card-stat {
  container-type: inline-size;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  background: linear-gradient(145deg, var(--card), var(--card-alt));
}
.stat-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.stat-fire {
  width: 34px;
  height: 45px;
  flex-shrink: 0;
}
.stat-fire svg { display: block; }
.fire-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.3rem;
  animation: flicker 1.6s ease-in-out infinite;
  transform-origin: 50% 85%;
}
@keyframes flicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  30%      { transform: scale(1.08) rotate(-2deg); }
  55%      { transform: scale(0.96) rotate(2deg); }
  75%      { transform: scale(1.05) rotate(-1deg); }
}
.stat-number {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 1.9rem;
  font-size: clamp(1.3rem, 11.5cqw, 2.3rem);
  font-weight: 700;
  background: linear-gradient(90deg, var(--accent-orange), #f4b03f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat-label {
  color: var(--text-soft);
  font-size: 0.85rem;
  max-width: 180px;
}

/* ---------- Quotes ---------- */
.card-quote {
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
}
.quote-mark {
  font-size: 3rem;
  line-height: 0.5;
  color: var(--accent-blue);
  opacity: 0.7;
}
.quote-text {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.55;
}
.hl-blue   { color: var(--accent-blue); }
.hl-orange { color: var(--accent-orange); }
.hl-purple { color: var(--accent-purple); }
.quote-caption {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-soft);
}

/* ---------- Skills / About ---------- */
.card-heading {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chips li {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.chips li:hover {
  color: var(--text);
  border-color: var(--accent-purple);
  transform: translateY(-2px);
}
.card-about p {
  color: var(--text-soft);
  line-height: 1.7;
  font-size: 0.95rem;
}

/* ---------- Projects ---------- */
.card-project { padding: 0; }
.card-project.tall { min-height: 340px; }

.project-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  text-decoration: none;
  color: inherit;
}

.project-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 26px 16px;
}
.project-title { font-size: 1.25rem; font-weight: 600; }
.project-sub {
  color: var(--text-soft);
  font-size: 0.85rem;
  margin-top: 4px;
}
.project-tag {
  flex-shrink: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.project-img {
  width: calc(100% - 32px);
  margin: auto 16px 16px;
  flex: 1;
  object-fit: cover;
  object-position: top;
  border-radius: 16px;
  min-height: 0;
  transition: transform 0.5s cubic-bezier(0.3, 0.9, 0.4, 1);
}
.card-project:hover .project-img { transform: scale(1.03); }

/* ---------- Footer & misc ---------- */
.footer {
  position: relative;
  overflow: hidden;
  margin-top: 60px;
  background: var(--text);
  color: var(--bg);
  padding: 90px 28px 0;
}
.footer-inner {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding-bottom: 90px;
}
.status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.92rem;
  opacity: 0.75;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #2ec97e;
  animation: status-pulse 2.2s ease-in-out infinite;
}
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(46, 201, 126, 0.55); }
  55%      { box-shadow: 0 0 0 7px rgba(46, 201, 126, 0); }
}
.footer-headline {
  font-family: "Poppins", "Inter", system-ui, sans-serif;
  font-size: clamp(2.4rem, 6.5vw, 4.8rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 22px 0 40px;
}
.footer-copy {
  font-size: 0.82rem;
  opacity: 0.5;
}

.pixel-me {
  position: absolute;
  left: min(490px, 64%);
  bottom: -12px;
  width: 290px;
  height: 300px;
  background: url("../assets/img/pixel-rachid.png") 0 0 / 1740px 300px no-repeat;
  animation: pixel-type 0.9s steps(6) infinite;
  image-rendering: pixelated;
  pointer-events: none;
}
@keyframes pixel-type {
  to { background-position-x: -1740px; }
}
@media (prefers-reduced-motion: reduce) {
  .pixel-me { animation: none; }
  .status-dot { animation: none; }
}
@media (max-width: 720px) {
  .footer { padding-top: 60px; }
  .footer-inner { padding-bottom: 290px; }
  .pixel-me { right: 50%; transform: translateX(50%); }
}

.to-top {
  position: fixed;
  right: 26px;
  bottom: 26px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(8px);
}
.to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.to-top:hover { transform: translateY(-3px); }

/* ---------- Cross-page view transitions ---------- */
@view-transition {
  navigation: auto;
}
@media (prefers-reduced-motion: reduce) {
  @view-transition {
    navigation: none;
  }
}
@keyframes vt-page-out {
  to { opacity: 0; filter: blur(8px); }
}
@keyframes vt-page-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
/* drop the old page fast (with a blur) so its images never linger
   behind the morphing cover; ease the new page in just after */
::view-transition-old(root) {
  animation: vt-page-out 0.18s ease-out both;
}
::view-transition-new(root) {
  animation: vt-page-in 0.26s ease 0.1s both;
}
/* the clicked card cover morphs into the case-study cover */
::view-transition-group(*) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.3, 0.9, 0.4, 1);
}
::view-transition-old(cover-wanaut),
::view-transition-old(cover-buildify),
::view-transition-old(cover-goaluin),
::view-transition-old(cover-goride),
::view-transition-old(cover-pinch),
::view-transition-old(cover-mobileapps),
::view-transition-old(cover-zelvo),
::view-transition-old(cover-glowupgirl),
::view-transition-new(cover-wanaut),
::view-transition-new(cover-buildify),
::view-transition-new(cover-goaluin),
::view-transition-new(cover-goride),
::view-transition-new(cover-pinch),
::view-transition-new(cover-mobileapps),
::view-transition-new(cover-zelvo),
::view-transition-new(cover-glowupgirl) {
  animation: none;
  mix-blend-mode: normal;
  /* fill the morphing box by cropping, never by stretching */
  height: 100%;
  width: 100%;
  overflow: clip;
  object-fit: cover;
  border-radius: 18px;
}
/* the app icons must stay whole rather than crop */
::view-transition-old(cover-zelvo),
::view-transition-old(cover-glowupgirl),
::view-transition-new(cover-zelvo),
::view-transition-new(cover-glowupgirl) {
  object-fit: contain;
  border-radius: 0;
}

/* ---------- Card press-to-open ---------- */
.grid .card:active {
  transform: translateY(-1px) scale(0.985);
}
.grid .card.is-opening,
.grid .card.is-opening:active {
  transform: translateY(-6px) scale(1.05);
  box-shadow: var(--shadow-hover);
  z-index: 5;
  transition: transform 0.2s cubic-bezier(0.3, 0.9, 0.4, 1);
}

/* ---------- Grid hover blur (reference-style) ---------- */
@media (hover: hover) {
  .grid:has(.card:hover) .card:not(:hover) {
    filter: blur(2px) saturate(0.92);
    opacity: 0.85;
    transform: scale(0.98);
  }
  .grid .card:hover {
    transform: translateY(-4px) scale(1.02);
    z-index: 2;
  }
  .card { transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.35s ease, background 0.4s ease,
              opacity 0.4s ease, filter 0.4s ease; }
}

/* ---------- Smooth custom cursor ---------- */
html.smooth-cursor-on, html.smooth-cursor-on * { cursor: none !important; }

.cursor-follower {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
  transform-origin: 12px 2px;
  transition: opacity 0.25s ease;
}
.cursor-follower.is-visible { opacity: 1; }

.cursor-follower svg {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  transform-origin: 12px 2px;
  transition: opacity 0.16s ease, transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.cursor-follower .cursor-arrow path {
  fill: var(--bg);
  stroke: var(--text);
}
.cursor-follower .cursor-hand {
  opacity: 0;
  transform: scale(0.72) rotate(-12deg);
}
.cursor-follower.is-hand .cursor-arrow {
  opacity: 0;
  transform: scale(0.72) rotate(12deg);
}
.cursor-follower.is-hand .cursor-hand {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Corner action badges ---------- */
.action-icon {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-alt);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  pointer-events: none;
}
@media (hover: hover) {
  .action-icon {
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.22s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .card:hover > .action-icon { opacity: 1; transform: scale(1); }
  /* the badge takes the corner, so ease the role chip out of its way */
  .card-project .project-tag { transition: opacity 0.22s ease; }
  .card-project:hover .project-tag { opacity: 0; }
}

/* ---------- Cursor-follow hover bubble ---------- */
.cursor-bubble {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  font-family: "Poppins", "Inter", system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
  white-space: nowrap;
  opacity: 0;
  scale: 0.5;
  transform-origin: top left;
  transition: opacity 0.18s ease, scale 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-hover);
}
.cursor-bubble.is-visible { opacity: 1; scale: 1; }
@media (hover: none) { .cursor-bubble { display: none; } }

/* ---------- Case-study pages (expanded-card article) ---------- */
.case-body .article { animation: caseIn 0.5s cubic-bezier(0.3, 0.9, 0.4, 1) both; }
@keyframes caseIn {
  from { opacity: 0; transform: translateY(24px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.case-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px 28px;
  pointer-events: none;
}
.case-topbar > * { pointer-events: auto; }

.mode-toggle {
  display: flex;
  gap: 4px;
  background: color-mix(in srgb, var(--pill-bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px;
  box-shadow: var(--shadow);
}
.mode-btn {
  border: 0;
  background: transparent;
  color: var(--text-soft);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 500;
  padding: 8px 20px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.mode-btn.is-active {
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.collapse-btn {
  position: absolute;
  right: 28px;
  top: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.collapse-btn:hover { transform: scale(1.08); box-shadow: var(--shadow-hover); }

.article {
  max-width: 700px;
  margin: 0 auto;
  padding: 96px 24px 120px;
}

.case-cover-card.cover-icon {
  width: 220px;
  margin-left: auto;
  margin-right: auto;
  border-radius: 0;
  box-shadow: none;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.2));
}
.project-img.cover-icon {
  object-fit: contain;
}
.case-cover-card {
  width: 100%;
  border-radius: 28px;
  display: block;
  box-shadow: var(--shadow);
  margin-bottom: 64px;
}

.statement {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 36px;
}
.statement .hl { white-space: normal; }

.article h2 {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 56px 0 18px;
}
.article p {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text);
  opacity: 0.85;
  margin-bottom: 18px;
}
.article .article-img {
  width: 100%;
  border-radius: 20px;
  display: block;
  margin: 30px 0;
  box-shadow: var(--shadow);
}

/* labeled detail rows (accordion-style) */
.detail-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin: 30px 0;
  overflow: hidden;
}
.detail-card details + details { border-top: 1px solid var(--border); }
.detail-card summary {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
}
.detail-card summary::-webkit-details-marker { display: none; }
.detail-label {
  flex-shrink: 0;
  font-family: "SF Mono", ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 10px;
}
.detail-summary {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-soft);
}
.detail-plus {
  color: var(--text-soft);
  font-size: 1rem;
  transition: transform 0.25s ease;
}
.detail-card details[open] .detail-plus { transform: rotate(45deg); }
.detail-body { padding: 0 20px 18px; }
.detail-body p { font-size: 0.9rem; margin-bottom: 10px; }

.closing-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 56px 0 32px;
}
.closing {
  font-family: "Poppins", sans-serif;
  font-style: italic;
  font-weight: 500;
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-soft);
}

/* image carousel */
.carousel {
  position: relative;
  margin: 30px 0;
}
.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  border-radius: 20px;
  box-shadow: var(--shadow);
  scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel.light-slides .carousel-track { background: #ffffff; }
.carousel-slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
}
.carousel-slide img {
  width: 100%;
  display: block;
}
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0.9;
}
.carousel-btn:hover { transform: translateY(-50%) scale(1.08); opacity: 1; }
.carousel-btn.prev { left: 14px; }
.carousel-btn.next { right: 14px; }
.carousel-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}
.carousel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--text-soft);
  opacity: 0.35;
  cursor: pointer;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.carousel-dot.is-active {
  opacity: 1;
  background: var(--text);
  transform: scale(1.25);
}

/* TL;DR mode */
.article-mode[hidden] { display: none; }
.article-mode { animation: caseIn 0.4s cubic-bezier(0.3, 0.9, 0.4, 1) both; }
.tldr-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 30px 0;
}
.tldr-list li {
  font-size: 1rem;
  line-height: 1.7;
  opacity: 0.85;
  padding-left: 28px;
  position: relative;
}
.tldr-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent-purple);
}
.tldr-list strong { opacity: 1; }

.case-link {
  color: var(--accent-blue);
  text-decoration: none;
  font-weight: 600;
}
.case-link:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .case-topbar { padding: 14px; }
  .collapse-btn { right: 14px; top: 12px; }
  .article { padding-top: 84px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; justify-content: center; }
  .toggles { order: 3; }
  .grid { grid-template-columns: 1fr; padding: 0 18px; }
  .span-2 { grid-column: span 1; }
  .card-intro { flex-direction: column; text-align: center; }
  .toggle-label { display: none; }
}
