/* ═══════════════════════════════════════════════════════════
   Aung Thurein Tun — portfolio
   Light palette on :root, dark overrides in two guarded blocks
   so both the system default and the manual toggle work.
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg:            #fbfaf8;
  --bg-alt:        #f3f1ec;
  --surface:       #ffffff;
  --surface-2:     #f7f5f1;
  --border:        #e2ddd4;
  --border-strong: #cfc8bb;
  --text:          #1c1a17;
  --text-soft:     #5c564d;
  --text-faint:    #8a8377;
  --accent:        #1f5f56;
  --accent-soft:   #e6f0ed;
  --accent-text:   #164a43;
  --shadow:        0 1px 2px rgba(28, 26, 23, .04), 0 8px 24px rgba(28, 26, 23, .05);
  --shadow-lift:   0 2px 4px rgba(28, 26, 23, .06), 0 16px 40px rgba(28, 26, 23, .09);

  --font:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-dp: "Fraunces", Georgia, "Times New Roman", serif;

  --wrap:  70rem;
  --gap:   clamp(1rem, 2.5vw, 1.75rem);
  --pad-y: clamp(4rem, 9vw, 7.5rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:            #14140f;
    --bg-alt:        #1a1a14;
    --surface:       #1e1e17;
    --surface-2:     #24241c;
    --border:        #33322a;
    --border-strong: #474539;
    --text:          #f0ede6;
    --text-soft:     #b3aea3;
    --text-faint:    #857f73;
    --accent:        #6cc5b3;
    --accent-soft:   #1c2f2b;
    --accent-text:   #8fd8c8;
    --shadow:        0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lift:   0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  --bg:            #14140f;
  --bg-alt:        #1a1a14;
  --surface:       #1e1e17;
  --surface-2:     #24241c;
  --border:        #33322a;
  --border-strong: #474539;
  --text:          #f0ede6;
  --text-soft:     #b3aea3;
  --text-faint:    #857f73;
  --accent:        #6cc5b3;
  --accent-soft:   #1c2f2b;
  --accent-text:   #8fd8c8;
  --shadow:        0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lift:   0 2px 4px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .4);
}

/* ── Base ──────────────────────────────────────────────── */

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

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.15; margin: 0; font-weight: 600; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: .5rem;
  padding: .6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  z-index: 100;
}
.skip-link:focus { left: .5rem; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}
.wrap--narrow { max-width: 46rem; }

/* ── Header / nav ──────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease;
}
.site-header[data-scrolled] { border-bottom-color: var(--border); }

.nav {
  display: flex;
  align-items: center;
  gap: var(--gap);
  max-width: var(--wrap);
  margin-inline: auto;
  padding: .85rem clamp(1.25rem, 5vw, 3rem);
}

/* Scroll progress rail, pinned above the sticky header. */
.progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  z-index: 60;
  pointer-events: none;
}
.progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-text));
  transform-origin: left;
  transition: width .08s linear;
}

.nav__brand {
  text-decoration: none;
  flex-shrink: 0;
}
.nav__brand-mark {
  display: block;
  font-family: var(--font-dp);
  font-size: 1.05rem;
  letter-spacing: .06em;
  color: var(--text);
  padding: .25rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.nav__brand:hover .nav__brand-mark {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.nav__links {
  display: flex;
  gap: clamp(.75rem, 2vw, 1.6rem);
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav__links::-webkit-scrollbar { display: none; }

.nav__links a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: .875rem;
  font-weight: 500;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.nav__links a:hover { color: var(--text); }
.nav__links a[aria-current="true"] { color: var(--accent-text); border-bottom-color: var(--accent); }

.theme-toggle {
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-soft);
  transition: color .15s ease, border-color .15s ease;
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* Sun in light mode, moon in dark — drawn with a mask, no assets. */
.theme-toggle__icon {
  width: 1.05rem;
  height: 1.05rem;
  background: currentColor;
  -webkit-mask: var(--icon-sun) center / contain no-repeat;
          mask: var(--icon-sun) center / contain no-repeat;
}
:root {
  --icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4'/%3E%3C/svg%3E");
  --icon-moon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle__icon {
    -webkit-mask-image: var(--icon-moon); mask-image: var(--icon-moon);
  }
}
:root[data-theme="dark"] .theme-toggle__icon {
  -webkit-mask-image: var(--icon-moon); mask-image: var(--icon-moon);
}
:root[data-theme="light"] .theme-toggle__icon {
  -webkit-mask-image: var(--icon-sun); mask-image: var(--icon-sun);
}

/* ── Hero ──────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3rem, 9vw, 6.5rem) clamp(3rem, 8vw, 6rem);
  border-bottom: 1px solid var(--border);
  background:
    radial-gradient(120% 90% at 85% -10%, var(--accent-soft) 0%, transparent 55%),
    var(--bg);
}
.hero > .wrap { position: relative; z-index: 1; }

/* Faint blueprint grid, faded out toward the bottom so text stays clean. */
.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 3.5rem 3.5rem;
  opacity: .5;
  -webkit-mask-image: radial-gradient(90% 70% at 70% 0%, #000 0%, transparent 75%);
          mask-image: radial-gradient(90% 70% at 70% 0%, #000 0%, transparent 75%);
}

.hero__top {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
}

.avatar {
  position: relative;
  flex-shrink: 0;
  width: clamp(3.75rem, 9vw, 4.75rem);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: var(--shadow);
}
.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  /* The source is a seated portrait, so bias the crop toward the head. */
  object-fit: cover;
  object-position: 50% 12%;
  display: block;
}
/* Accent ring sitting just off the photo edge. */
.avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: .35rem;
}

.pin {
  width: .5rem;
  height: .5rem;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 1.5px solid var(--text-faint);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .82rem;
  font-weight: 500;
  color: var(--accent-text);
}
.status__dot {
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  70%  { box-shadow: 0 0 0 .55rem color-mix(in srgb, var(--accent) 0%, transparent); }
  100% { box-shadow: 0 0 0 0    color-mix(in srgb, var(--accent) 0%, transparent); }
}

.hero__name {
  font-family: var(--font-dp);
  font-size: clamp(2.6rem, 8.5vw, 5rem);
  letter-spacing: -.02em;
  margin-bottom: .5rem;
}

.hero__role {
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  font-weight: 500;
  color: var(--accent-text);
  margin-bottom: 1.5rem;
}
.hero__at { color: var(--text-faint); font-weight: 400; }

.hero__contact { display: none; }

.hero__pitch {
  max-width: 44ch;
  font-size: clamp(1rem, 2vw, 1.125rem);
  color: var(--text-soft);
  margin-bottom: 2rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .72rem 1.35rem;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  font-weight: 500;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: var(--accent); }
.btn:active { transform: translateY(0); }

.btn--ghost {
  background: transparent;
  border-style: dashed;
  color: var(--text-soft);
}
.btn--ghost:hover { color: var(--accent-text); border-style: solid; }

.btn__icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
}
.btn__icon svg { width: 100%; height: 100%; }

.btn__arrow { transition: transform .18s ease; }
.btn:hover .btn__arrow { transform: translateX(3px); }

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
:root[data-theme="dark"] .btn--primary,
:root:not([data-theme="light"]) .btn--primary { color: #0f1f1c; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .btn--primary { color: #fff; }
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--gap);
  margin: 0;
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
  border-top: 1px solid var(--border);
}
.stat dt {
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: .3rem;
}
.stat dd {
  margin: 0;
  font-family: var(--font-dp);
  font-size: clamp(1.8rem, 4.5vw, 2.5rem);
  line-height: 1;
}
.stat dd span { color: var(--accent); }

/* ── Sections ──────────────────────────────────────────── */

.section { padding-block: var(--pad-y); }
.section--alt {
  background: var(--bg-alt);
  border-block: 1px solid var(--border);
}

.section__title {
  display: flex;
  align-items: baseline;
  gap: .85rem;
  font-family: var(--font-dp);
  font-size: clamp(1.7rem, 4.5vw, 2.4rem);
  letter-spacing: -.015em;
  margin-bottom: 1.25rem;
}
.section__num {
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--accent);
}
/* Rule that runs from the heading to the right edge of the column. */
.section__title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
  transform: translateY(-.35em);
}

.section__lede {
  max-width: 52ch;
  color: var(--text-soft);
  margin-bottom: clamp(2rem, 5vw, 3rem);
}

.prose p { color: var(--text-soft); max-width: 62ch; }
.prose p + p { margin-top: 1.1rem; }

.facts {
  display: grid;
  gap: .1rem;
  margin-top: 2.5rem;
  border-top: 1px solid var(--border);
}
.facts li {
  display: grid;
  grid-template-columns: minmax(8rem, 12rem) 1fr;
  gap: 1rem;
  padding: .85rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .925rem;
}
.facts__k { color: var(--text-faint); }
.facts__v { color: var(--text); }

@media (max-width: 34rem) {
  .facts li { grid-template-columns: 1fr; gap: .15rem; }
}

/* ── Timeline ──────────────────────────────────────────── */

.timeline { display: grid; gap: clamp(2rem, 5vw, 3.25rem); }

.job {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  position: relative;
  padding-left: 1.5rem;
}
.job::before {
  content: "";
  position: absolute;
  left: 0;
  top: .55rem;
  bottom: -.5rem;
  width: 1px;
  background: var(--border-strong);
}
.job:last-child::before { bottom: auto; height: 1.5rem; }
.job::after {
  content: "";
  position: absolute;
  left: -4.5px;
  top: .45rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 2.5px solid var(--border-strong);
  transition: border-color .25s ease, box-shadow .25s ease;
}
.job:hover::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
/* Current role reads as active. */
.job:first-child::after {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.job__dates { font-size: .875rem; font-weight: 600; color: var(--text); }
.job__len   { font-size: .8rem; color: var(--accent-text); }
.job__place { font-size: .8rem; color: var(--text-faint); margin-top: .25rem; }

.job__title { font-size: clamp(1.15rem, 3vw, 1.4rem); margin-bottom: .3rem; }

.job__org {
  color: var(--text-soft);
  font-size: .95rem;
  margin-bottom: 1rem;
}

.tag {
  display: inline-block;
  margin-left: .5rem;
  padding: .1rem .5rem;
  border: 1px solid var(--border-strong);
  border-radius: 100px;
  font-size: .7rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-faint);
  vertical-align: 2px;
}

.job__points { display: grid; gap: .55rem; }
.job__points li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--text-soft);
  font-size: .935rem;
}
.job__points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .62em;
  width: 5px;
  height: 1.5px;
  background: var(--accent);
}

.job__note {
  margin-top: 1rem;
  padding: .85rem 1rem;
  background: var(--surface-2);
  border-left: 2px solid var(--accent);
  border-radius: 0 6px 6px 0;
  font-size: .9rem;
  color: var(--text-soft);
}
.job__note strong { color: var(--text); }

.job__skills {
  margin-top: 1rem;
  font-size: .8rem;
  color: var(--text-faint);
  letter-spacing: .01em;
}

@media (max-width: 48rem) {
  .job { grid-template-columns: 1fr; gap: .75rem; }
  .job__meta { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
  .job__place { margin-top: 0; }
}

/* ── Cards / grids ─────────────────────────────────────── */

.grid { display: grid; gap: var(--gap); }
.grid--skills   { grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.grid--certs    { grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); }
.grid--projects { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: clamp(1.15rem, 2.5vw, 1.6rem);
}

.card__title {
  font-size: 1rem;
  letter-spacing: .01em;
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--border);
}

.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chips li {
  padding: .28rem .65rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .8rem;
  color: var(--text-soft);
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.chips li:hover {
  color: var(--accent-text);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.chips li em { color: var(--text-faint); font-style: normal; }

.certs { display: grid; gap: .8rem; }
.certs li { display: grid; }

/* A single credential. The linked variant carries a Verify affordance that
   only appears on hover or focus, so the resting state stays calm. */
.cert {
  display: grid;
  gap: .2rem;
  padding: .55rem .7rem;
  margin: -.55rem -.7rem;
  border-radius: 7px;
  color: inherit;
  text-decoration: none;
  transition: background .18s ease;
}
a.cert:hover,
a.cert:focus-visible { background: var(--surface-2); }

.cert__name {
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.4;
  transition: color .18s ease;
}
a.cert:hover .cert__name { color: var(--accent-text); }

.cert__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  color: var(--text-faint);
}

.cert__verify {
  display: inline-flex;
  align-items: center;
  gap: .15rem;
  padding: .05rem .4rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-text);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity .18s ease, transform .18s ease, border-color .18s ease;
}
a.cert:hover .cert__verify,
a.cert:focus-visible .cert__verify {
  opacity: 1;
  transform: none;
  border-color: var(--accent);
}

/* Touch devices have no hover, so the badge is always shown there. */
@media (hover: none) {
  .cert__verify { opacity: 1; transform: none; }
}

/* Certification cards stretch so a row of them shares one baseline. */
.card--cert { display: flex; flex-direction: column; }
.card--cert .certs { align-content: start; gap: 1.1rem; }

/* Small label above a card's contents — quieter than a heading. */
.card__kicker {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--border);
}

/* One quiet link standing in for the twenty-two credentials not listed. */
.cert-all {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  margin-top: clamp(1.5rem, 4vw, 2.25rem);
  padding: .8rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-soft);
  font-size: .875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.cert-all:hover {
  color: var(--accent-text);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.cert-all__arrow { transition: transform .18s ease; }
.cert-all:hover .cert-all__arrow { transform: translateX(3px); }

/* Non-project cards get a quiet lift too, so the whole grid feels alive. */
.card:not(.card--project) { transition: border-color .2s ease, box-shadow .2s ease; }
.card:not(.card--project):hover { border-color: var(--border-strong); box-shadow: var(--shadow); }

.card--project {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
/* Accent wash that sweeps in from the top-right on hover. */
.card--project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 60% at 100% 0%, var(--accent-soft), transparent 70%);
  opacity: 0;
  transition: opacity .25s ease;
}
.card--project > * { position: relative; }
.card--project:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lift);
  border-color: var(--accent);
}
.card--project:hover::before { opacity: 1; }

.card--project .card__title { border-bottom: 0; padding-bottom: 0; margin-bottom: .6rem; }
.card__desc { font-size: .9rem; color: var(--text-soft); margin-bottom: 1rem; }
.card__tech { font-size: .78rem; color: var(--text-faint); margin-top: auto; }

.card__go {
  position: absolute;
  top: clamp(1.15rem, 2.5vw, 1.6rem);
  right: clamp(1.15rem, 2.5vw, 1.6rem);
  font-size: 1rem;
  color: var(--text-faint);
  opacity: 0;
  transform: translate(-4px, 4px);
  transition: opacity .22s ease, transform .22s ease, color .22s ease;
}
.card--project:hover .card__go,
.card--project:focus-visible .card__go {
  opacity: 1;
  transform: none;
  color: var(--accent-text);
}

/* ── Back to top ───────────────────────────────────────── */

.to-top {
  position: fixed;
  right: clamp(1rem, 3vw, 2rem);
  bottom: clamp(1rem, 3vw, 2rem);
  z-index: 55;

  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  padding: 0;

  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  box-shadow: var(--shadow-lift);
  color: var(--text-soft);
  cursor: pointer;

  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(.9);
  transition: opacity .25s ease, transform .25s cubic-bezier(.22, 1, .36, 1),
              visibility .25s, color .18s ease, border-color .18s ease;
}
.to-top[data-visible] {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.to-top:hover {
  color: var(--accent-text);
  border-color: var(--accent);
  transform: translateY(-2px);
}
.to-top:active { transform: translateY(0) scale(.95); }

.to-top svg { width: 1.05rem; height: 1.05rem; }

/* Progress ring drawn around the button, driven from JS. */
.to-top__ring {
  position: absolute;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  transform: rotate(-90deg);
  pointer-events: none;
}
.to-top__ring circle {
  fill: none;
  stroke-width: 2;
  /* 2 * pi * r, r = 20 */
  stroke-dasharray: 125.66;
}
.to-top__track { stroke: transparent; }
.to-top__value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dashoffset: 125.66;
  transition: stroke-dashoffset .1s linear;
}

/* ── Writing ───────────────────────────────────────────── */

.posts {
  display: grid;
  border-top: 1px solid var(--border);
}

.post {
  display: block;
  padding: clamp(1.25rem, 3vw, 1.75rem) 0;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: padding-left .22s ease;
}
.post:hover,
.post:focus-visible { padding-left: .75rem; }

.post__title {
  font-family: var(--font-dp);
  font-size: clamp(1.1rem, 2.8vw, 1.35rem);
  letter-spacing: -.01em;
  margin-bottom: .45rem;
  transition: color .18s ease;
}
.post:hover .post__title { color: var(--accent-text); }

.post__desc {
  max-width: 58ch;
  font-size: .925rem;
  color: var(--text-soft);
  margin-bottom: .85rem;
}

.post__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.post__tag {
  padding: .15rem .6rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .03em;
  color: var(--text-faint);
}
/* Marks a piece written in a language other than the site's. */
.post__tag--lang {
  background: transparent;
  border-style: dashed;
}

.post__go {
  margin-left: auto;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-text);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .2s ease, transform .2s ease;
}
.post:hover .post__go,
.post:focus-visible .post__go { opacity: 1; transform: none; }

@media (hover: none) {
  .post__go { opacity: 1; transform: none; }
}

/* ── Contact links ─────────────────────────────────────── */

.links { display: grid; border-top: 1px solid var(--border); }
.links a {
  display: grid;
  grid-template-columns: minmax(6rem, 9rem) 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: padding-left .18s ease;
}
.links a:hover { padding-left: .5rem; }
.links a:hover .links__v { color: var(--accent-text); }
.links__k { font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.links__v { font-size: .95rem; transition: color .15s ease; }

/* ── Footer ────────────────────────────────────────────── */

.site-footer {
  padding-block: 2.5rem 3rem;
  border-top: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text-soft);
}
.site-footer__meta { color: var(--text-faint); margin-top: .25rem; }

/* ── Scroll reveal ─────────────────────────────────────── */

.reveal { opacity: 0; transform: translateY(14px); }
.reveal.is-visible {
  opacity: 1;
  transform: none;
  transition: opacity .55s ease, transform .55s cubic-bezier(.22, 1, .36, 1);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ── Print ─────────────────────────────────────────────── */

@media print {

  /* ─────────────────────────────────────────────────────────
     Resume layout.

     Nothing here may depend on background rendering — Chrome and Edge
     ship with "Background graphics" switched OFF, which silently drops
     any decoration painted with background-color. Rules, markers and
     accents below are all borders, text or glyphs.
     ───────────────────────────────────────────────────────── */

  @page { margin: 13mm 12mm 11mm; }

  :root {
    --ink:   #111;
    --muted: #555;
    --faint: #888;
    --rule:  #d4d0c8;
    --brand: #1f5f56;
  }

  /* Screen furniture has no place on paper. */
  .site-header, .hero__actions, .theme-toggle, .skip-link, .to-top,
  .progress, .hero__grid, .card__go, .post__go, .status,
  .cert__verify, .section__num, .section__lede, .tag,
  #contact, .site-footer, .cert-all { display: none !important; }

  html { font-size: 15px; }

  body {
    background: #fff;
    color: var(--ink);
    font-size: 9pt;
    line-height: 1.4;
  }

  .wrap, .wrap--narrow { max-width: none; padding-inline: 0; }

  a { color: inherit; text-decoration: none; }

  /* ── Masthead ────────────────────────────────────────── */

  .hero {
    padding: 0 0 .55rem;
    background: none;
    border-bottom: 1.5pt solid var(--ink);
    margin-bottom: .2rem;
  }

  .hero__top { gap: .65rem; margin-bottom: .45rem; align-items: center; }

  .avatar { width: 58px; }
  .avatar::after { border-color: var(--rule); }

  .hero__eyebrow { font-size: 6.5pt; letter-spacing: .18em; color: var(--faint); }
  .hero__eyebrow .pin { display: none; }

  .hero__name {
    font-size: 24pt;
    letter-spacing: -.02em;
    margin-bottom: .05rem;
  }

  .hero__role {
    font-size: 10.5pt;
    font-weight: 500;
    color: var(--brand);
    margin-bottom: .3rem;
  }
  .hero__at { color: var(--faint); }

  .hero__contact {
    display: block;
    font-size: 8pt;
    color: var(--muted);
    padding-bottom: .35rem;
    margin-bottom: .35rem;
    border-bottom: .5pt solid var(--rule);
  }
  .hero__contact span { color: var(--rule); margin-inline: .3rem; }

  .hero__pitch {
    font-size: 9pt;
    line-height: 1.45;
    color: var(--muted);
    max-width: none;
    margin-bottom: .45rem;
  }

  .stats {
    grid-template-columns: repeat(3, max-content);
    gap: 1.75rem;
    padding-top: 0;
    border-top: 0;
  }
  .stat dt {
    font-size: 6pt;
    letter-spacing: .14em;
    color: var(--faint);
    margin-bottom: 0;
  }
  .stat dd { font-size: 12pt; }
  .stat dd span { color: var(--brand); }

  /* ── Section headings ────────────────────────────────── */

  .section { padding-block: .55rem 0; break-inside: auto; }
  .section--alt { background: none; border: 0; }

  .section__title {
    display: block;
    font-family: var(--font);
    font-size: 7.5pt;
    font-weight: 700;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: var(--brand);
    margin: 0 0 .4rem;
    padding-bottom: .18rem;
    border-bottom: .75pt solid var(--ink);
    break-after: avoid;
    break-inside: avoid;
  }
  .section__title::after { display: none; }

  /* ── About ───────────────────────────────────────────── */

  .prose p { font-size: 9pt; max-width: none; color: var(--ink); }
  .prose p + p { margin-top: .3rem; }

  .facts { margin-top: .45rem; border-top: 0; }
  .facts li {
    grid-template-columns: 7.5rem 1fr;
    gap: .5rem;
    padding: .13rem 0;
    font-size: 8pt;
    border-bottom: 0;
  }
  .facts__k { color: var(--faint); }

  /* ── Experience ──────────────────────────────────────── */

  .timeline { gap: .6rem; }

  /* Grid containers fragment unreliably across printed pages — a role that
     did not fit in the remaining space jumped to the next sheet whole,
     leaving half a page blank. Plain block flow always splits cleanly. */
  .job {
    display: block;
    padding-left: 0;
    break-inside: auto;
  }
  .job::before, .job::after { display: none; }

  /* Date, tenure and location collapse onto one line above the role. */
  .job__meta { display: block; margin-bottom: .1rem; }
  .job__meta p {
    display: inline;
    margin: 0;
    font-size: 7.5pt;
    color: var(--faint);
  }
  .job__dates { font-weight: 600; color: var(--ink); }
  .job__len::before,
  .job__place::before { content: "\00B7  "; color: var(--rule); }

  .job__body {
    padding-left: .7rem;
    border-left: 1pt solid var(--rule);
  }

  .job__points li, .prose p, .card__desc, .post__desc {
    orphans: 2;
    widows: 2;
  }
  .job__title {
    font-family: var(--font);
    font-size: 10pt;
    font-weight: 600;
    margin-bottom: .05rem;
  }
  .job__org {
    font-size: 8.5pt;
    color: var(--brand);
    margin-bottom: .25rem;
  }
  .job__title, .job__org { break-after: avoid; }

  .job__points { gap: .1rem; }
  .job__points li {
    padding-left: .75rem;
    font-size: 8.5pt;
    color: var(--ink);
    break-inside: avoid;
  }
  /* A glyph, not a painted bar — survives "Background graphics: off". */
  .job__points li::before {
    content: "\2022";
    position: absolute;
    left: 0;
    top: 0;
    width: auto;
    height: auto;
    background: none;
    color: var(--brand);
    font-size: 8pt;
  }

  .job__note {
    margin-top: .28rem;
    padding: .1rem 0 .1rem .5rem;
    background: none;
    border-left: 1.5pt solid var(--brand);
    border-radius: 0;
    font-size: 8pt;
    color: var(--muted);
  }
  .job__note strong { color: var(--ink); }

  .job__skills {
    margin-top: .28rem;
    font-size: 7.5pt;
    color: var(--faint);
  }

  /* ── Cards: skills, certifications, projects ─────────── */

  .grid { gap: .5rem 1.5rem; }
  .grid--skills   { grid-template-columns: repeat(2, 1fr); }
  .grid--certs    { grid-template-columns: repeat(2, 1fr); }
  .grid--projects { grid-template-columns: repeat(2, 1fr); }

  .card {
    padding: 0;
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: none;
    box-shadow: none;
    break-inside: avoid;
  }
  .card--project::before { display: none; }

  .card__kicker, .card__title {
    font-family: var(--font);
    font-size: 7pt;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: .22rem;
    padding-bottom: .12rem;
    border-bottom: .5pt solid var(--rule);
  }

  /* Skills read as a sentence rather than a stack of pills. */
  .chips { display: block; }
  .chips li {
    display: inline;
    padding: 0;
    border: 0;
    background: none;
    font-size: 8.5pt;
    color: var(--ink);
  }
  /* Separators must read as separators — --rule is too pale for text. */
  .chips li + li::before {
    content: "\00B7  ";
    color: var(--faint);
  }

  .certs { gap: .3rem; }
  .cert { padding: 0; margin: 0; }
  .cert__name { font-size: 8.5pt; font-weight: 500; line-height: 1.3; }
  .cert__meta { font-size: 7pt; color: var(--faint); }

  .card--project .card__title {
    font-family: var(--font);
    font-size: 8.5pt;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--ink);
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: .1rem;
  }
  .card__desc { font-size: 8pt; color: var(--muted); margin-bottom: .15rem; }
  .card__tech { font-size: 7pt; color: var(--faint); }

  /* ── Writing ─────────────────────────────────────────── */

  .posts { border-top: 0; }
  .post {
    padding: .22rem 0;
    border-bottom: .5pt solid var(--rule);
    break-inside: avoid;
  }
  .post:last-child { border-bottom: 0; }
  .post__title {
    font-family: var(--font);
    font-size: 8.5pt;
    font-weight: 600;
    margin-bottom: .05rem;
  }
  .post__desc {
    font-size: 8pt;
    color: var(--muted);
    max-width: none;
    margin-bottom: .1rem;
  }
  .post__tag {
    padding: 0;
    border: 0;
    background: none;
    font-size: 7pt;
    color: var(--faint);
  }
  /* post__go is the real last child but is hidden, so a :last-child rule
     would leave a trailing separator. Lead each extra tag instead. */
  .post__tag + .post__tag::before { content: "\00B7  "; }

  /* Reveal-on-scroll must never hide content on paper. */
  .reveal, .reveal.is-visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
