/* ==========================================================================
   Masud Rahman — masudrahman.org
   Design language: Nordic engineering. Cool snow ground, graphite ink,
   Baltic-blue signal, monospaced indices and figures. Sans-dominant to
   suit an engineering/product career rather than a literary one.
   ========================================================================== */

:root {
  /* Light ground */
  --paper:      #F7F8FA;
  --paper-alt:  #EDF0F5;
  --paper-card: #FFFFFF;
  --line:       #DBE1E9;
  --line-soft:  #E7ECF2;

  --ink:        #101419;
  --ink-soft:   #4C5665;
  --ink-faint:  #78838F;

  --accent:        #0F5AA8;
  --accent-strong: #0A4381;
  --accent-wash:   rgba(15, 90, 168, 0.07);

  /* Constant dark band for .section-inverted — deliberately does NOT follow
     prefers-color-scheme, so these stay a fixed graphite band in both themes. */
  --band-bg:       #0E1319;
  --band-bg-alt:   #151D26;
  --band-ink:      #E9EDF2;
  --band-ink-soft: #9BA8B8;
  --band-line:     #24303C;
  --band-accent:   #6FB3F0;

  --display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono:    "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --bn:      "Noto Sans Bengali", var(--sans);

  --max: 1180px;
  --radius: 4px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #0A0D12;
    --paper-alt:  #10161F;
    --paper-card: #131A24;
    --line:       #1F2833;
    --line-soft:  #19212B;

    --ink:        #E8ECF2;
    --ink-soft:   #A2AEBD;
    --ink-faint:  #76818F;

    --accent:        #5AA6EE;
    --accent-strong: #8CC3F5;
    --accent-wash:   rgba(90, 166, 238, 0.10);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

/* ---- Script- and language-specific typography ------------------------- */

html[lang="bn"] body { font-family: var(--bn); line-height: 1.85; }
html[lang="bn"] h1,
html[lang="bn"] h2,
html[lang="bn"] h3,
html[lang="bn"] .display { font-family: var(--bn); font-weight: 600; letter-spacing: 0; }
[lang="bn"] { font-family: var(--bn); }

/* Finnish builds long compounds — let them hyphenate rather than overflow. */
html[lang="fi"] h1,
html[lang="fi"] h2,
html[lang="fi"] h3 { hyphens: auto; }
html[lang="fi"] p,
html[lang="fi"] dd,
html[lang="fi"] li { hyphens: auto; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.022em;
  margin: 0 0 0.5em;
  overflow-wrap: break-word;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }
img { max-width: 100%; display: block; }

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

/* ---- Shared layout ---------------------------------------------------- */

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 28px;
}

.section { padding: 104px 0; border-top: 1px solid var(--line); }
.section-alt { background: var(--paper-alt); }

.section-inverted {
  background: var(--band-bg);
  color: var(--band-ink);
  border-top: none;
}
.section-inverted h1,
.section-inverted h2,
.section-inverted h3 { color: var(--band-ink); }

/* Section header: mono index + label, then display heading */
.sec-head { margin-bottom: 56px; max-width: 74ch; }

.sec-index {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
}
.sec-index::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  max-width: 220px;
}
.sec-index .num { color: var(--ink-faint); }

.section-inverted .sec-index { color: var(--band-accent); }
.section-inverted .sec-index::after { background: var(--band-line); }
.section-inverted .sec-index .num { color: var(--band-ink-soft); }

.sec-head h2 {
  font-size: clamp(1.85rem, 4.2vw, 2.9rem);
  margin: 0 0 0.45em;
}
.sec-sub {
  font-size: 1.06rem;
  color: var(--ink-soft);
  margin: 0;
  max-width: 68ch;
}
.section-inverted .sec-sub { color: var(--band-ink-soft); }

/* ---- Buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius);
  font-family: var(--sans);
  font-size: 0.94rem;
  font-weight: 550;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease),
              color 0.18s var(--ease), transform 0.18s var(--ease);
}
html[lang="bn"] .btn { font-weight: 600; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-ghost {
  border-color: var(--line);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn:active { transform: translateY(1px); }

.section-inverted .btn-ghost { border-color: var(--band-line); color: var(--band-ink); }
.section-inverted .btn-ghost:hover { border-color: var(--band-accent); color: var(--band-accent); }

/* ---- Accessibility --------------------------------------------------- */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 200;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.section-inverted :focus-visible { outline-color: var(--band-accent); }

/* ---- Header ---------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .site-header { background: var(--paper); }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
}

.brand {
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.brand::before {
  content: "";
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 1px;
  flex: none;
}

.main-nav {
  display: flex;
  gap: 26px;
  margin-left: auto;
}
.main-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 0;
  position: relative;
  white-space: nowrap;
  transition: color 0.18s var(--ease);
}
.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width 0.22s var(--ease);
}
.main-nav a:hover { color: var(--ink); }
.main-nav a:hover::after,
.main-nav a.is-current::after { width: 100%; }
.main-nav a.is-current { color: var(--accent); }

.header-tools { display: flex; align-items: center; gap: 14px; }

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.lang-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 7px 10px;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.lang-btn + .lang-btn { border-left: 1px solid var(--line); }
.lang-btn:hover { color: var(--ink); background: var(--accent-wash); }
.lang-btn.is-active { background: var(--accent); color: #fff; }
.lang-btn[data-lang="bn"] { font-family: var(--bn); font-size: 12.5px; letter-spacing: 0; }

.nav-toggle {
  display: none;
  appearance: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  width: 38px;
  height: 34px;
  padding: 0;
  cursor: pointer;
  position: relative;
}
.nav-toggle span {
  display: block;
  width: 16px;
  height: 1.5px;
  background: var(--ink);
  margin: 3px auto;
  transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(4.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-4.5px) rotate(-45deg); }

/* ---- Hero ------------------------------------------------------------ */

.hero {
  padding: 92px 0 0;
  position: relative;
  overflow: hidden;
}

/* Faint engineering grid behind the hero */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--line-soft) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line-soft) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(ellipse 80% 65% at 62% 22%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 80% 65% at 62% 22%, #000 0%, transparent 78%);
  pointer-events: none;
  opacity: 0.85;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 64px;
  align-items: start;
  padding-bottom: 72px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 22px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
/* Keep the rule on the first line's optical centre when the label wraps */
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1.5px;
  margin-top: 0.75em;
  background: var(--accent);
  flex: none;
}
html[lang="bn"] .eyebrow { font-family: var(--bn); letter-spacing: 0.02em; text-transform: none; font-size: 13px; }

.hero h1 {
  font-size: clamp(2.5rem, 6.4vw, 4.15rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 0 0 6px;
}
/* Secondary rendering of the name in the other script: Bengali when the page
   is in English or Finnish, Latin when the page is in Bengali. */
.name-native {
  display: block;
  font-family: var(--bn);
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 500;
  letter-spacing: 0;
  color: var(--ink-faint);
  margin-top: 12px;
  line-height: 1.4;
}
html[lang="bn"] .name-native {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.015em;
}

.tagline {
  font-family: var(--mono);
  font-size: 0.845rem;
  font-weight: 450;
  line-height: 1.75;
  letter-spacing: 0.005em;
  color: var(--ink-soft);
  margin: 26px 0 0;
  max-width: 54ch;
  padding-left: 16px;
  border-left: 2px solid var(--accent);
}
html[lang="bn"] .tagline { font-family: var(--bn); font-size: 0.95rem; }

.hero-intro {
  font-size: 1.14rem;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 30px 0 0;
  max-width: 60ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 36px;
}

/* Portrait — the source is a modest monochrome headshot, so it is used at a
   deliberately small, framed size rather than stretched into a hero image. */
.hero-media { position: relative; flex: none; }

.portrait-frame {
  position: relative;
  width: 214px;
  padding: 10px;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
/* Offset corner bracket — a registration mark, drawn as an L so it needs no
   negative z-index or background masking to sit correctly behind the frame. */
.portrait-frame::after {
  content: "";
  position: absolute;
  right: -13px;
  bottom: -13px;
  width: 64%;
  height: 64%;
  border-right: 1px solid var(--accent);
  border-bottom: 1px solid var(--accent);
  border-bottom-right-radius: var(--radius);
  opacity: 0.55;
  pointer-events: none;
}
.portrait {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: center 18%;
  border-radius: 2px;
  filter: grayscale(100%) contrast(1.04);
}
.portrait-cap {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 24px 0 0;   /* clears the offset corner bracket below the frame */
  max-width: 214px;
  line-height: 1.5;
}
html[lang="bn"] .portrait-cap { font-family: var(--bn); letter-spacing: 0; text-transform: none; font-size: 12px; }

/* Spec strip — datasheet row of key figures under the hero */
.spec-strip {
  position: relative;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--paper-alt);
}
.spec-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.spec {
  padding: 26px 26px 28px;
  border-left: 1px solid var(--line);
}
.spec:first-child { border-left: 0; }
.spec dt {
  font-family: var(--mono);
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 10px;
}
html[lang="bn"] .spec dt { font-family: var(--bn); }
.spec dd {
  margin: 0;
  font-size: 0.845rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* ---- About ----------------------------------------------------------- */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 72px;
  align-items: start;
}
.about-copy p { font-size: 1.055rem; color: var(--ink-soft); }
.about-copy p strong { color: var(--ink); font-weight: 600; }

.glance {
  border-top: 2px solid var(--ink);
  padding-top: 22px;
  margin: 0;
}
.glance-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.glance-row:last-child { border-bottom: 0; }
.glance dt {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
html[lang="bn"] .glance dt { font-family: var(--bn); letter-spacing: 0.02em; text-transform: none; font-size: 12.5px; }
.glance dd {
  margin: 0;
  font-size: 0.965rem;
  color: var(--ink);
  line-height: 1.55;
}

/* ---- Work cards (inverted band) -------------------------------------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(298px, 1fr));
  gap: 1px;
  background: var(--band-line);
  border: 1px solid var(--band-line);
  border-radius: var(--radius);
  overflow: hidden;
}
.work {
  background: var(--band-bg);
  padding: 34px 30px 36px;
  display: flex;
  flex-direction: column;
  transition: background 0.22s var(--ease);
}
.work:hover { background: var(--band-bg-alt); }

.work-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--band-accent);
  margin: 0 0 16px;
}
html[lang="bn"] .work-tag { font-family: var(--bn); letter-spacing: 0.02em; text-transform: none; font-size: 12.5px; }

.work h3 {
  font-size: 1.24rem;
  letter-spacing: -0.018em;
  margin: 0 0 12px;
}
.work p {
  font-size: 0.955rem;
  line-height: 1.62;
  color: var(--band-ink-soft);
  margin: 0;
}

/* ---- Expertise matrix ------------------------------------------------ */

.matrix {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(316px, 1fr));
  gap: 34px 44px;
}
.cap { padding-top: 22px; border-top: 2px solid var(--ink); }
.cap-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--accent);
  display: block;
  margin-bottom: 12px;
}
.cap h3 {
  font-size: 1.11rem;
  letter-spacing: -0.015em;
  margin: 0 0 10px;
}
.cap p {
  font-size: 0.94rem;
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 0;
}

/* ---- Career timeline ------------------------------------------------- */

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

.timeline li {
  display: grid;
  grid-template-columns: 152px minmax(0, 1fr);
  gap: 34px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
  position: relative;
}
.timeline li:first-child { border-top: 2px solid var(--ink); }
.timeline li:last-child { border-bottom: 1px solid var(--line); }

.tl-date {
  font-family: var(--mono);
  font-size: 0.83rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  padding-top: 3px;
  white-space: nowrap;
}
html[lang="bn"] .tl-date { font-family: var(--bn); white-space: normal; }
.timeline li.is-current .tl-date { color: var(--accent); }

.tl-org {
  font-family: var(--display);
  font-size: 1.16rem;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin: 0 0 3px;
  line-height: 1.25;
}
html[lang="bn"] .tl-org { font-family: var(--bn); }
.tl-meta {
  font-size: 0.9rem;
  color: var(--accent);
  font-weight: 500;
  margin: 0 0 12px;
}
.tl-place {
  color: var(--ink-faint);
  font-weight: 400;
}
.tl-body p {
  font-size: 0.965rem;
  line-height: 1.62;
  color: var(--ink-soft);
  margin: 0;
  max-width: 68ch;
}

/* ---- Credentials ----------------------------------------------------- */

.cred-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 44px;
  margin-bottom: 58px;
}
.cred h3 {
  font-size: 0.95rem;
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--band-accent);
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--band-line);
}
html[lang="bn"] .cred h3 { font-family: var(--bn); letter-spacing: 0.02em; text-transform: none; font-size: 1.02rem; }

.cred ul { list-style: none; margin: 0; padding: 0; }
.cred li {
  font-size: 0.965rem;
  line-height: 1.55;
  color: var(--band-ink);
  padding: 11px 0 11px 18px;
  position: relative;
}
.cred li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20px;
  width: 6px;
  height: 1.5px;
  background: var(--band-accent);
}
.cred li span {
  display: block;
  color: var(--band-ink-soft);
  font-size: 0.87rem;
  margin-top: 2px;
}
/* First span in a credential row is the qualification itself, not the sub-line */
.cred li .cred-title {
  color: var(--band-ink);
  font-size: 0.965rem;
  font-weight: 500;
  margin-top: 0;
}

.tools-heading {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--band-accent);
  margin: 0 0 20px;
}
html[lang="bn"] .tools-heading { font-family: var(--bn); letter-spacing: 0.02em; text-transform: none; font-size: 1.02rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--band-ink-soft);
  border: 1px solid var(--band-line);
  border-radius: 100px;
  padding: 6px 13px;
  white-space: nowrap;
}

/* ---- Contact --------------------------------------------------------- */

.contact-inner { max-width: 680px; }
.contact-inner .sec-sub { margin-bottom: 34px; }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
}

.contact-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 28px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.contact-meta span {
  font-family: var(--mono);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
html[lang="bn"] .contact-meta span { font-family: var(--bn); letter-spacing: 0; font-size: 0.9rem; }

/* ---- Footer ---------------------------------------------------------- */

.site-footer {
  background: var(--paper-alt);
  border-top: 1px solid var(--line);
  padding: 34px 0;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.site-footer p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-faint);
}
.footer-meta a {
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}
.footer-meta a:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Scroll reveal --------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1120px) {
  /* Six nav items, and Finnish labels are long — tighten before wrapping */
  .main-nav { gap: 19px; }
  .main-nav a { font-size: 0.865rem; }
}

@media (max-width: 1000px) {
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .spec-grid { grid-template-columns: repeat(2, 1fr); }
  .spec:nth-child(3) { border-left: 0; }
  .spec:nth-child(n+3) { border-top: 1px solid var(--line); }
}

@media (max-width: 940px) {
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 8px 28px 18px;
    margin: 0;
    display: none;
    box-shadow: 0 14px 30px rgba(6, 10, 16, 0.10);
  }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 13px 0; border-bottom: 1px solid var(--line-soft); font-size: 0.98rem; }
  .main-nav a::after { display: none; }
  .nav-toggle { display: block; }
  .site-header { position: sticky; }

  /* Hero switches to a stacked layout with a small inline avatar */
  .hero { padding-top: 54px; }
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 34px;
    padding-bottom: 54px;
  }
  .hero-media { order: -1; }
  .portrait-frame { width: 118px; padding: 7px; }
  .portrait-frame::after { display: none; }
  .portrait-cap { display: none; }
  .hero h1 { letter-spacing: -0.028em; }
  .hero::before { background-size: 48px 48px; }

  .section { padding: 72px 0; }
  .sec-head { margin-bottom: 40px; }
  .timeline li { grid-template-columns: 1fr; gap: 8px; }
  .tl-date { padding-top: 0; }
  .matrix { gap: 30px; }
  .cred-grid { gap: 36px; margin-bottom: 44px; }
}

@media (max-width: 560px) {
  body { font-size: 16px; }
  .wrap { padding: 0 20px; }
  .spec-grid { grid-template-columns: 1fr; }
  .spec { border-left: 0; padding: 20px 20px 22px; }
  .spec:nth-child(n+2) { border-top: 1px solid var(--line); }
  .work { padding: 28px 24px 30px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .tagline { font-size: 0.8rem; padding-left: 13px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

/* ---- Print ----------------------------------------------------------- */

@media print {
  .site-header, .hero-actions, .contact-links, .nav-toggle, .hero::before { display: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .section, .section-inverted { background: #fff; color: #000; border-top: 1px solid #ccc; padding: 18pt 0; }
  .section-inverted h1, .section-inverted h2, .section-inverted h3,
  .work h3, .work p, .cred li, .chip { color: #000; }
  .work, .work-grid { background: #fff; border-color: #ccc; }
  .reveal { opacity: 1; transform: none; }
}
