/* ==========================================================
   Talukder Makiduddin Moulin — Portfolio (SPA)
   ========================================================== */

:root {
  --bg: #0c0d0f;
  --bg-elev: #121418;
  --surface: #15181d;
  --surface-hover: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #ece9e3;
  --muted: #a3a29d;
  --faint: #8b8d91; /* 5.8:1 on --bg (WCAG AA) */
  --accent: #e2b46c;
  --accent-ink: #1a1408;
  --accent-soft: rgba(226, 180, 108, 0.12);
  --ok: #6fcf97;
  --danger: #f08a7e;
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);

  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --radius: 14px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f6f4ef;
  --bg-elev: #ffffff;
  --surface: #ffffff;
  --surface-hover: rgba(20, 18, 12, 0.035);
  --line: rgba(20, 18, 12, 0.09);
  --line-strong: rgba(20, 18, 12, 0.18);
  --text: #17171a;
  --muted: #55565b;
  --faint: #6b6c70; /* 4.8:1 on --bg (WCAG AA) */
  --accent: #9a5f12;
  --accent-ink: #ffffff;
  --accent-soft: rgba(154, 95, 18, 0.1);
  --ok: #1f8a4c;
  --danger: #b4382a;
  --shadow: 0 24px 60px -24px rgba(40, 30, 10, 0.25);
  color-scheme: light;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

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

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

/* Inline SVG icons (sprite in index.html). The <i class="bi"> wrapper keeps the exact box the
   Bootstrap Icons font produced; the <svg> takes the place of the font's ::before glyph. */
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.bi > svg {
  display: inline-block;
  /* +.015px: layout rounds a 1em box down to 1/64px, but rounded a font glyph's advance up;
     this makes them equal so text next to an icon doesn't shift by a sub-pixel. */
  width: calc(1em + .015px);
  height: 1em;
  vertical-align: -.125em;
  fill: currentColor;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { color: var(--text); margin: 0; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
strong { color: var(--text); font-weight: 500; }
::selection { background: var(--accent); color: var(--accent-ink); }

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

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 8px;
  font-weight: 500;
}
.skip-link:focus { top: 16px; }

/* Cursor follower: a ring that trails the pointer and grows over interactive elements */
.cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  /* Thin halo keeps the ring readable over photos and both themes */
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 4px 14px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  opacity: 0;
  transform: translate3d(var(--rx, -100px), var(--ry, -100px), 0) scale(var(--rs, 1));
  transition: opacity .25s ease, width .25s var(--ease), height .25s var(--ease), margin .25s var(--ease), background-color .25s ease, border-color .25s ease;
  will-change: transform;
}
.cursor-ring.visible { opacity: 1; }
.cursor-ring.hover {
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}
.cursor-ring.visible.over-field { opacity: 0; }

/* ---------- Layout ---------- */
.shell {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

@media (min-width: 1024px) {
  .shell {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 72px;
    padding: 0 48px;
  }
}

/* ---------- Mobile top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { color: var(--text); font-weight: 600; font-size: 1.1rem; letter-spacing: -0.02em; }
.topbar-brand span { color: var(--accent); }
.topbar-actions { display: flex; gap: 4px; }

/* Site nav: one <nav> in the markup. Below 1024px it is the topbar dropdown;
   from 1024px it is the sidebar list (styled further down with the panel). */
@media (max-width: 1023.98px) {
  .site-nav {
    position: fixed;
    inset: 60px 0 auto 0;
    z-index: 39;
    display: grid;
    padding: 8px 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, transform .25s var(--ease), visibility .2s;
  }
  .site-nav.open { opacity: 1; transform: none; visibility: visible; }
  .site-nav a {
    display: flex;
    gap: 14px;
    align-items: baseline;
    padding: 14px 4px;
    color: var(--text);
    font-size: 1.15rem;
    font-weight: 500;
    border-bottom: 1px solid var(--line);
  }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav .idx { font-family: var(--mono); font-size: .75rem; color: var(--accent); }
  .site-nav .bar { display: none; }
}

@media (min-width: 1024px) {
  .topbar { display: none; }
}

/* ---------- Icon button ---------- */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: color .2s ease, background-color .2s ease;
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); }

/* ---------- Left panel ---------- */
.panel {
  padding: 48px 0 24px;
}

@media (min-width: 1024px) {
  .panel {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 88px 0 56px;
  }
}

.identity { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 28px; }

.avatar {
  flex: none;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  /* Gap ring + accent ring + soft drop shadow */
  box-shadow:
    0 0 0 5px var(--bg),
    0 0 0 6px color-mix(in srgb, var(--accent) 55%, transparent),
    var(--shadow);
  margin: 6px;
}
:root[data-theme="light"] .avatar {
  box-shadow:
    0 0 0 6px #fff,
    0 0 0 7px color-mix(in srgb, var(--accent) 45%, transparent),
    0 18px 40px -16px rgba(40, 30, 10, 0.35);
}
:root[data-theme="light"] .avatar img { filter: brightness(1.12) contrast(1.04); }
/* Zoom in on the face (the source photo includes hand and watch) */
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.15);
  transform-origin: 50% 32%;
  transition: transform .6s var(--ease);
}
.avatar:hover img { transform: scale(1.1); }

@media (min-width: 1024px) {
  .avatar { width: 176px; height: 176px; }
}
/* Short desktop screens: keep the sticky panel from overflowing */
@media (min-width: 1024px) and (max-height: 860px) {
  .avatar { width: 136px; height: 136px; }
  .panel { padding-top: 64px; padding-bottom: 40px; }
  .site-nav { margin-top: 32px !important; }
  .hero-actions { margin-top: 18px; }
}

.status {
  flex: 1 1 210px;
  max-width: 300px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--muted);
  background: var(--bg-elev);
}
.status strong { font-weight: 600; }
.status-note { display: block; margin-top: 4px; color: var(--faint); }
.status-dot {
  flex: none;
  margin-top: .42em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.name {
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
  max-width: 14ch;
}

.role {
  margin-top: 14px;
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 500;
}
.role .sep { color: var(--accent); margin: 0 4px; }

.tagline {
  margin-top: 14px;
  max-width: 36ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}
.hero-actions .btn { padding: 10px 18px; font-size: .9rem; }

/* Placeholder for real data still to be filled in (list them with tools/list-todos.ps1) */
.todo {
  padding: 0 5px;
  border-radius: 4px;
  outline: 1px dashed #d9a400;
  background: rgba(255, 200, 0, 0.22);
  color: var(--text);
  font-family: var(--mono);
  font-size: .85em;
}

@media (min-width: 1024px) {
  .site-nav {
    display: grid;
    gap: 2px;
    margin-top: 56px;
    width: max-content;
  }
  .site-nav a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 0;
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--faint);
    transition: color .2s ease;
  }
  .site-nav .idx { font-family: var(--mono); font-size: .72rem; letter-spacing: 0; }
  .site-nav .bar {
    width: 32px;
    height: 1px;
    background: currentColor;
    transition: width .3s var(--ease), background-color .2s ease;
  }
  .site-nav a:hover,
  .site-nav a.active { color: var(--text); }
  .site-nav a:hover .bar,
  .site-nav a.active .bar { width: 64px; }
  .site-nav a.active .idx { color: var(--accent); }
  .site-nav a.active .bar { background: var(--accent); }
}

.panel-bottom { margin-top: 28px; }

.socials { display: flex; align-items: center; gap: 4px; margin-left: -10px; }
.socials a {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  font-size: 1.15rem;
  color: var(--muted);
  transition: color .2s ease, transform .2s ease;
}
.socials a:hover { color: var(--accent); transform: translateY(-2px); }
.socials .divider { width: 1px; height: 20px; background: var(--line-strong); margin: 0 6px; }
.panel .theme-toggle,
.socials .divider { display: none; }
@media (min-width: 1024px) {
  .panel .theme-toggle { display: inline-grid; }
  .socials .divider { display: block; }
}

/* ---------- Content ---------- */
.content { padding: 8px 0 0; }

/* Section and nav numbers (01, 02, …) come from counters, so hidden sections
   (e.g. Testimonials, Writing) are skipped and the rest renumber automatically. */
.content { counter-reset: section; }
.content > .section:not([hidden]) { counter-increment: section; }
.section-label .num::before { content: counter(section, decimal-leading-zero); }
.site-nav { counter-reset: nav; }
.site-nav a { counter-increment: nav; }
.site-nav .idx::before { content: counter(nav, decimal-leading-zero); }
@media (min-width: 1024px) { .content { padding-top: 88px; } }

.section {
  scroll-margin-top: 76px;
  padding: 40px 0 72px;
}
@media (min-width: 1024px) {
  .section { scroll-margin-top: 48px; padding: 0 0 128px; }
}

.section-label {
  position: sticky;
  top: 60px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 -24px 28px;
  padding: 14px 24px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.section-label span { font-family: var(--mono); color: var(--accent); letter-spacing: 0; font-weight: 400; }

@media (min-width: 1024px) {
  .section-label {
    position: static;
    margin: 0 0 32px;
    padding: 0;
    background: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .section-label::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
    margin-left: 8px;
  }
}

.section-intro { margin-bottom: 28px; max-width: 58ch; }

/* About */
.prose { display: grid; gap: 18px; max-width: 62ch; }
.prose .lead { color: var(--text); font-size: 1.2rem; line-height: 1.55; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin: 40px 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.stats div { padding: 20px 20px 18px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats div:nth-child(2n) { border-right: 0; }
.stats div:nth-child(n+3) { border-bottom: 0; }
.stats dt { font-size: .78rem; color: var(--faint); order: 2; }
.stats dd {
  margin: 0 0 2px;
  color: var(--text);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.stats div { display: flex; flex-direction: column-reverse; }

@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(4, 1fr); }
  .stats div { border-bottom: 0; }
  .stats div:nth-child(2n) { border-right: 1px solid var(--line); }
  .stats div:last-child { border-right: 0; }
}

.stack { display: grid; gap: 18px; margin-top: 40px; }
.stack-row { display: grid; gap: 10px; }
.stack-row h3 {
  font-family: var(--mono);
  font-size: .75rem;
  font-weight: 400;
  color: var(--faint);
  letter-spacing: 0;
}
@media (min-width: 640px) {
  .stack-row { grid-template-columns: 120px 1fr; align-items: baseline; }
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* Secondary tier: same chip shape, quieter colour */
.chips.chips-muted li {
  color: var(--muted);
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.chips li,
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--accent);
  background: var(--accent-soft);
}

/* Experience */
.timeline { display: grid; gap: 8px; }

.job {
  position: relative;
  display: grid;
  gap: 8px;
  padding: 20px 0;
  border-radius: var(--radius);
  transition: background-color .25s ease, opacity .25s ease;
}
@media (min-width: 640px) {
  .job { grid-template-columns: 150px 1fr; gap: 24px; padding: 22px 20px; margin: 0 -20px; }
  .job:hover { background: var(--surface-hover); }
  .timeline:hover .job:not(:hover) { opacity: .55; }
}

.job-when {
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--faint);
  padding-top: 4px;
  text-transform: uppercase;
}
.job h3 { font-size: 1.05rem; font-weight: 600; }
.job .at { color: var(--muted); font-weight: 500; }
.job:hover h3 .at { color: var(--accent); }

.job-points { display: grid; gap: 6px; margin-top: 12px; font-size: .95rem; }
.job-points li { position: relative; padding-left: 18px; }
.job-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}

.job-projects { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.job-projects a {
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: .8rem;
  color: var(--text);
  transition: border-color .2s ease, color .2s ease;
}
.job-projects a::after { content: " ↗"; color: var(--faint); }
.job-projects a:hover { border-color: var(--accent); color: var(--accent); }

.sub-label {
  margin: 56px 0 12px;
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.edu li {
  display: grid;
  gap: 4px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}
.edu li:last-child { border-bottom: 1px solid var(--line); }
@media (min-width: 640px) {
  .edu li { grid-template-columns: 150px 1fr; gap: 24px; }
}
.edu-year { font-family: var(--mono); font-size: .8rem; color: var(--faint); padding-top: 2px; }
.edu h4 { font-size: 1rem; font-weight: 500; }
.edu p { font-size: .92rem; margin-top: 2px; }
.gpa {
  display: inline-block;
  margin-left: 8px;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--accent);
  white-space: nowrap;
}

/* Projects */
.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filters::-webkit-scrollbar { display: none; }
.filters button {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s ease;
}
.filters button:hover { color: var(--text); border-color: var(--line-strong); }
.filters button.active { background: var(--text); color: var(--bg); border-color: var(--text); }

.project-grid {
  display: grid;
  gap: 20px;
}
@media (min-width: 640px) {
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.project {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  overflow: hidden;
  transition: transform .35s var(--ease), border-color .25s ease, box-shadow .35s ease;
}
.project:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}
.project[hidden] { display: none; }

/* Showcase: browser-framed screenshot on a brand-tinted backdrop */
.project-media {
  --tint: var(--accent);
  position: relative;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  padding: 26px 26px 0;
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--tint) 45%, transparent), transparent 65%),
    radial-gradient(90% 80% at 100% 100%, color-mix(in srgb, var(--tint) 25%, transparent), transparent 70%),
    color-mix(in srgb, var(--tint) 10%, var(--surface));
  border-bottom: 1px solid var(--line);
}
.project-media .browser {
  height: calc(100% + 12px);
  border-radius: 10px 10px 0 0;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.45);
  transition: transform .5s var(--ease);
}
.project:hover .project-media .browser { transform: translateY(-8px); }

.browser {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #fff;
}
.browser-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  background: #1d1f24;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
:root[data-theme="light"] .browser-bar { background: #ebe8e2; border-bottom-color: rgba(0, 0, 0, 0.06); }
:root[data-theme="light"] .browser { border-color: rgba(0, 0, 0, 0.08); }
.browser-bar i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff5f57;
}
.browser-bar i:nth-child(2) { background: #febc2e; }
.browser-bar i:nth-child(3) { background: #28c840; }
.browser-bar span {
  flex: 1;
  margin: 0 30px 0 10px;
  padding: 1px 8px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.07);
  color: #9a9ca1;
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 14px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:root[data-theme="light"] .browser-bar span { background: rgba(255, 255, 255, 0.8); color: #6f7176; }
.browser img {
  flex: 1;
  min-height: 0;
  width: 100%;
  object-fit: cover;
  object-position: top center;
}

.project-body { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px 20px; flex: 1; }
.project-meta { font-family: var(--mono); font-size: .72rem; color: var(--faint); text-transform: uppercase; }
.project h3 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 1.05rem;
}
.project h3 .bi { color: var(--faint); transition: transform .25s var(--ease), color .2s ease; }
.project:hover h3 .bi { color: var(--accent); transform: translate(2px, -2px); }
.project p { font-size: .92rem; }
.project .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }

/* Services */
.service-list { border-top: 1px solid var(--line); }
.service-list li { border-bottom: 1px solid var(--line); }
.service-list a {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 24px 4px;
  transition: background-color .25s ease, padding .3s var(--ease);
}
.service-list a:hover { background: var(--surface-hover); padding-left: 14px; padding-right: 14px; }
.svc-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.1rem;
}
.service-list h3 { font-size: 1.05rem; margin-bottom: 4px; }
.service-list p { font-size: .92rem; }
.svc-arrow {
  color: var(--faint);
  font-size: 1.1rem;
  padding-top: 8px;
  transition: transform .25s var(--ease), color .2s ease;
}
.service-list a:hover .svc-arrow { color: var(--accent); transform: translateX(4px); }

/* Testimonials (section is hidden until filled) */
.testimonials { display: grid; gap: 16px; }
@media (min-width: 640px) { .testimonials { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.quote-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 20px;
  margin: 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.quote-card blockquote { margin: 0; color: var(--text); }
.quote-card blockquote::before {
  content: "\201C";
  display: block;
  height: .5em;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 2.6rem;
  line-height: 1;
}
.quote-card figcaption { display: flex; align-items: center; gap: 12px; font-size: .88rem; }
.quote-card figcaption img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.quote-card figcaption strong { display: block; color: var(--text); font-weight: 600; }

/* Writing (section is hidden until the first post exists) */
.posts { border-top: 1px solid var(--line); }
.posts li { border-bottom: 1px solid var(--line); }
.posts a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 16px;
  align-items: start;
  padding: 22px 4px;
  transition: background-color .25s ease, padding .3s var(--ease);
}
.posts a:hover { background: var(--surface-hover); padding-left: 14px; padding-right: 14px; }
.posts time { grid-column: 1 / -1; font-family: var(--mono); font-size: .75rem; color: var(--faint); text-transform: uppercase; }
.posts h3 { font-size: 1.05rem; margin-bottom: 4px; }
.posts p { font-size: .92rem; }
.posts .chips { margin-top: 10px; }
.posts a:hover .svc-arrow { color: var(--accent); transform: translate(2px, -2px); }
@media (min-width: 640px) {
  .posts a { grid-template-columns: 110px 1fr auto; }
  .posts time { grid-column: auto; padding-top: 4px; }
}

/* Contact */
.contact-head { max-width: 60ch; }
.display {
  font-size: clamp(1.75rem, 4.2vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.12;
}
.display em { font-style: normal; color: var(--accent); }
.contact-head p { margin-top: 16px; }
.mail-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--text);
  font-size: clamp(1rem, 3.6vw, 1.2rem);
  font-weight: 500;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 4px;
  word-break: break-all;
  transition: color .2s ease, border-color .2s ease;
}
.mail-link:hover { color: var(--accent); border-color: var(--accent); }

.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 40px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
@media (min-width: 640px) {
  .contact-form { grid-template-columns: 1fr 1fr; padding: 28px; }
  .contact-form .full { grid-column: 1 / -1; }
}

.field { display: grid; gap: 6px; }
.field label { font-size: .8rem; font-weight: 500; color: var(--text); }
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .95rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field.invalid input,
.field.invalid textarea { border-color: var(--danger); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.form-status { font-size: .9rem; min-height: 1.4em; }
.form-status.ok { color: var(--ok); }
.form-status.err { color: var(--danger); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 500;
  font-size: .95rem;
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, opacity .2s ease, border-color .2s ease;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: .6; cursor: progress; transform: none; }
.btn-ghost { border-color: var(--line-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.contact-alt {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  margin-top: 28px;
  font-size: .92rem;
}
.contact-alt li { display: flex; align-items: center; gap: 8px; }
.contact-alt .bi { color: var(--accent); }
.contact-alt a:hover { color: var(--text); }

/* Footer */
.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
  font-size: .85rem;
  color: var(--faint);
}
.to-top:hover { color: var(--accent); }

/* ---------- Detail sheet ---------- */
.sheet {
  width: min(760px, 100%);
  max-width: 100%;
  max-height: 100%;
  height: 100%;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--line);
  background: var(--bg);
  color: var(--muted);
  overflow: hidden;
}
.sheet::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sheet[open] { animation: sheet-in .4s var(--ease); }
.sheet[open]::backdrop { animation: fade-in .3s ease; }
@keyframes sheet-in { from { transform: translateX(40px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

.sheet-inner {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 64px 24px 48px;
}
@media (min-width: 640px) { .sheet-inner { padding: 72px 48px 56px; } }

.sheet-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 1px solid var(--line);
}

.sheet-kicker { font-family: var(--mono); font-size: .75rem; color: var(--accent); text-transform: uppercase; }
.case-title {
  margin-top: 10px;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.03em;
}
.sheet-lead { margin-top: 14px; color: var(--text); font-size: 1.05rem; }
.sheet-media {
  --tint: var(--accent);
  margin: 28px 0 0;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--tint) 45%, transparent), transparent 65%),
    color-mix(in srgb, var(--tint) 10%, var(--surface));
}
.sheet-media .browser { box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.45); }
.sheet-media .browser img { flex: none; height: auto; }
@media (min-width: 640px) { .sheet-media { padding: 32px; } }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.sheet-section { margin-top: 36px; }
.sheet-section > h4 {
  margin-bottom: 14px;
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--faint);
}
.case p + p { margin-top: 12px; }

/* Case studies live in the page markup (crawlable, readable without JS).
   With JS they are hidden and open in the detail sheet instead. */
.case-studies { margin-top: 48px; }
.case-studies > .case {
  padding: 40px 0;
  border-top: 1px solid var(--line);
  scroll-margin-top: 76px;
}
.js .case-studies { display: none; }

/* Case study parts */
.case-list { display: grid; gap: 8px; }
.case-list li { position: relative; padding-left: 18px; }
.case-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .72em;
  width: 6px;
  height: 1px;
  background: var(--accent);
}
.case-arch { margin-top: 14px; }

.challenges { display: grid; gap: 10px; margin: 0; }
.challenges > div {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.challenges dt { color: var(--text); font-weight: 500; }
.challenges dd { margin: 6px 0 0; }
.challenges dd::before { content: "→ "; color: var(--accent); }
.case code { font-family: var(--mono); font-size: .88em; color: var(--text); }

.case-diagram,
.case-gallery { margin: 18px 0 0; }
.case-diagram img { width: 100%; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }
.case-gallery { display: grid; gap: 12px; }
@media (min-width: 640px) { .case-gallery { grid-template-columns: 1fr 1fr; } }
.case-gallery img { width: 100%; border-radius: 10px; border: 1px solid var(--line); }

.facts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.facts div { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.facts div:nth-child(odd) { border-right: 1px solid var(--line); }
.facts div:nth-last-child(-n+2) { border-bottom: 0; }
.facts dt { font-size: .75rem; color: var(--faint); }
.facts dd { margin: 2px 0 0; color: var(--text); font-weight: 500; font-size: .95rem; }

.focus-grid { display: grid; gap: 10px; }
@media (min-width: 640px) { .focus-grid { grid-template-columns: 1fr 1fr; } }
.focus-grid li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font-weight: 500;
  font-size: .95rem;
}
.focus-grid .bi { color: var(--accent); }

.steps { counter-reset: step; display: grid; gap: 0; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 22px 44px;
  color: var(--text);
}
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--accent);
}
.steps li::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 34px;
  bottom: 4px;
  width: 1px;
  background: var(--line);
}
.steps li:last-child { padding-bottom: 0; }
.steps li:last-child::after { display: none; }
.steps strong { display: block; padding-top: 4px; font-weight: 500; }
.steps span { display: block; font-size: .9rem; color: var(--muted); }

.sheet-cta {
  margin-top: 40px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.sheet-cta h4 { font-size: 1.1rem; }
.sheet-cta p { margin: 6px 0 16px; }

body.sheet-open { overflow: hidden; }

/* ---------- Reveal ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .cursor-ring { display: none; }
}

@media (hover: none), (pointer: coarse) {
  .cursor-ring { display: none; }
}
