:root {
  --green-900: #173b2d;
  --green-800: #1f4d3a;
  --green-700: #2c5a43;
  --cream: #f5f0e6;
  --cream-deep: #e9e2d3;
  --paper: #fffdf8;
  --line: #e3dccd;
  --ink: #16211c;
  --muted: #4b5751;
  --on-green-muted: #c9d6ce;
  --gold: #e3a52b;
  --gold-on-green: #eab13a;
  --gold-on-cream: #8a6512;

  --radius-lg: 24px;
  --radius-md: 20px;
  --radius-sm: 16px;
  --shadow-soft: 0 1px 2px rgba(22, 33, 28, 0.04), 0 8px 24px rgba(22, 33, 28, 0.06);
  --shadow-lift: 0 2px 4px rgba(22, 33, 28, 0.06), 0 18px 40px rgba(22, 33, 28, 0.12);

  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --header-h: 76px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Noto Sans Thai", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

h1,
h2,
h3 {
  margin: 0;
}

p {
  margin: 0;
}

svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

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

.th {
  font-family: "Noto Sans Thai", "Manrope", sans-serif;
  font-weight: 600;
  color: var(--muted);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-inline: clamp(20px, 5vw, 56px);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  transition: top 200ms var(--ease-out);
}

.skip-link:focus {
  top: 12px;
}

/* ---------- Scroll progress ---------- */

.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 3px;
  z-index: 60;
  background: var(--gold);
  transform-origin: 0 50%;
  transform: scaleX(var(--progress, 0));
  pointer-events: none;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--green-800);
  color: var(--cream);
  transition: background-color 300ms ease, box-shadow 300ms ease;
}

.site-header.is-scrolled {
  background: rgba(31, 77, 58, 0.92);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  box-shadow: 0 8px 24px rgba(10, 25, 18, 0.18);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
  transition: min-height 300ms var(--ease-out);
}

.site-header.is-scrolled .header-inner {
  min-height: 64px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: "Fraunces", Georgia, serif;
  font-size: 21px;
  font-weight: 700;
  color: var(--cream);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 800;
  transition: transform 500ms var(--ease-spring);
}

.brand:hover .brand-mark {
  transform: rotate(-12deg) scale(1.06);
}

.site-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 15px;
  font-weight: 600;
}

.site-nav a:not(.btn) {
  position: relative;
  padding: 10px 0;
  text-decoration: none;
  color: var(--cream);
  opacity: 0.85;
  transition: opacity 200ms ease;
}

.site-nav a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 350ms var(--ease-out);
}

.site-nav a:not(.btn):hover,
.site-nav a:not(.btn).is-active {
  opacity: 1;
}

.site-nav a:not(.btn):hover::after,
.site-nav a:not(.btn).is-active::after {
  transform: scaleX(1);
  transform-origin: left;
}

.menu-toggle {
  display: none;
  margin-left: auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--cream);
  cursor: pointer;
  position: relative;
}

.menu-toggle span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 350ms var(--ease-out), opacity 200ms ease;
}

.menu-toggle span:nth-child(1) {
  top: 15px;
}
.menu-toggle span:nth-child(2) {
  top: 21px;
}
.menu-toggle span:nth-child(3) {
  top: 27px;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.3);
}
.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 300ms var(--ease-spring), box-shadow 300ms ease, background-color 200ms ease,
    color 200ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 100ms;
}

.btn .arrow {
  transition: transform 300ms var(--ease-out);
}

.btn:hover .arrow {
  transform: translateX(4px);
}

.btn-sm {
  min-height: 44px;
  padding: 0 18px;
  font-size: 15px;
}

.btn-lg {
  min-height: 54px;
  padding: 0 26px;
}

.btn-gold {
  background: var(--gold);
  color: var(--ink);
}

.btn-gold:hover {
  box-shadow: 0 10px 24px rgba(227, 165, 43, 0.35);
}

.btn-outline-light {
  border: 1.5px solid var(--cream);
  color: var(--cream);
}

.btn-outline-light:hover {
  background: var(--cream);
  color: var(--green-800);
}

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

.hero {
  background: var(--green-800);
  color: var(--cream);
  overflow: hidden;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
  gap: 40px;
  align-items: end;
  padding-top: clamp(32px, 6vw, 72px);
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding-bottom: clamp(40px, 7vw, 96px);
}

.eyebrow-pill {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid rgba(245, 240, 230, 0.35);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
}

.pulse-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
}

.pulse-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 2.2s ease-out infinite;
}

.hero-title {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(40px, 4.6vw, 62px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-lead {
  max-width: 560px;
  font-size: 18px;
  color: var(--on-green-muted);
}

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

.hero-facts {
  list-style: none;
  margin: 8px 0 0;
  padding: 20px 0 0;
  border-top: 1px solid rgba(245, 240, 230, 0.2);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  font-size: 14px;
  color: var(--on-green-muted);
}

.hero-facts li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-facts svg {
  width: 18px;
  height: 18px;
}

.hero-portrait {
  position: relative;
  justify-self: center;
  width: min(100%, 480px);
  aspect-ratio: 440 / 520;
  border-radius: 220px 220px 0 0;
  background: var(--green-700);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.portrait-ring {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 9%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1.5px solid rgba(227, 165, 43, 0.6);
  animation: spin 24s linear infinite;
}

.portrait-ring::after {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 6px rgba(227, 165, 43, 0.18);
}

.hero-portrait img {
  position: relative;
  width: 88%;
  height: auto;
  will-change: transform;
  transform: translate3d(0, var(--parallax, 0px), 0);
}

/* Hero entrance — runs once on load */
.hero-in {
  animation: rise 900ms var(--ease-out) both;
  animation-delay: calc(var(--d, 0) * 110ms + 80ms);
}

.hero-portrait.hero-in {
  animation-name: rise-portrait;
  animation-duration: 1100ms;
}

/* ---------- Sections ---------- */

.section {
  padding-top: clamp(64px, 9vw, 112px);
}

.section-last {
  padding-bottom: clamp(64px, 9vw, 112px);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.section h2 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
}

.eyebrow {
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-on-cream);
}

.eyebrow-light {
  color: var(--gold-on-green);
}

.section-note {
  max-width: 420px;
  color: var(--muted);
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  transition: translate 450ms var(--ease-out), box-shadow 450ms var(--ease-out), border-color 300ms ease;
}

a.card,
.skill-card,
.project-card,
.case-card {
  will-change: translate;
}

a.card:hover,
.skill-card:hover,
.project-card:hover,
.case-card:hover {
  translate: 0 -6px;
  box-shadow: var(--shadow-lift);
  border-color: #d6ccb6;
}

/* ---------- Skills ---------- */

.skill-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.skill-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.skill-card h3 {
  font-size: 20px;
  font-weight: 800;
}

.skill-card p {
  color: var(--muted);
}

.skill-card .skill-tools {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-800);
}

.icon-tile {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--green-800);
  color: var(--cream);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 500ms var(--ease-spring), background-color 300ms ease;
}

.icon-tile svg {
  width: 24px;
  height: 24px;
}

.skill-card:hover .icon-tile {
  transform: rotate(-8deg) scale(1.08);
  background: var(--green-700);
}

.chip-row {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.chip-label {
  margin-right: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.chip {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--cream-deep);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 200ms ease, color 200ms ease, transform 300ms var(--ease-spring);
}

.chip:hover {
  background: var(--green-800);
  color: var(--cream);
  transform: translateY(-2px);
}

/* ---------- Work ---------- */

.work-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.case-card {
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.media-placeholder {
  background: var(--cream-deep);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  font-weight: 700;
  text-align: center;
}

.media-placeholder svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.4;
  transition: transform 600ms var(--ease-spring);
}

.card:hover .media-placeholder svg {
  transform: scale(1.12) rotate(-4deg);
}

.case-media {
  min-height: 320px;
}

.case-body {
  padding: clamp(24px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.case-body h3 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 30px;
  line-height: 1.15;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.tag {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--cream-deep);
}

.tag-dark {
  background: var(--green-800);
  color: var(--cream);
}

.case-facts {
  margin: 0;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 16px;
  font-size: 15px;
}

.case-facts dt {
  font-weight: 800;
  color: var(--green-800);
}

.case-facts dd {
  margin: 0;
  color: var(--muted);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.project-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.project-media {
  height: 200px;
  overflow: hidden;
}

.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 900ms var(--ease-out);
}

.project-card:hover .project-media img {
  transform: scale(1.06);
}

.more-card {
  padding: 28px;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  min-height: 220px;
  text-decoration: none;
  color: var(--ink);
  background: var(--cream-deep);
  border-style: dashed;
}

.more-card strong {
  font-size: 20px;
}

.more-card > span:last-child {
  font-weight: 700;
  color: var(--green-800);
}

.more-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green-800);
  color: var(--cream);
}

.more-icon svg {
  width: 24px;
  height: 24px;
}

.project-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-grow: 1;
}

.project-body h3 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.3;
}

.project-body > p:not(.kicker) {
  color: var(--muted);
  font-size: 15px;
}

.kicker {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-on-cream);
}

.link-row {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 800;
  font-size: 15px;
  color: var(--green-800);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 calc(100% - 10px) / 0 2px no-repeat;
  transition: background-size 350ms var(--ease-out);
}

.text-link:hover {
  background-size: 100% 2px;
}

/* ---------- Experience ---------- */

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
}

.two-col h2 {
  margin-bottom: 28px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0 0 0 26px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #d8cfbc;
  transform-origin: top;
  transform: scaleY(var(--line-progress, 1));
  transition: transform 1200ms var(--ease-out);
}

.timeline li {
  position: relative;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -33px;
  top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--green-800);
  border: 3px solid var(--cream);
  box-sizing: border-box;
}

.timeline-year {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-on-cream);
}

.timeline h3 {
  margin: 2px 0 4px;
  font-size: 18px;
  font-weight: 800;
}

.timeline li > p:last-child {
  color: var(--muted);
}

.timeline .text-link {
  display: inline;
  min-height: 0;
  background-position: 0 100%;
}

.side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-dark {
  background: var(--green-800);
  border-color: var(--green-800);
  color: var(--cream);
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-dark p:not(.eyebrow) {
  color: var(--on-green-muted);
}

.serif {
  font-family: "Fraunces", Georgia, serif;
  font-size: 28px;
  line-height: 1.2;
}

.lang-card {
  border-radius: var(--radius-lg);
  padding: 32px;
}

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.lang-grid strong {
  display: block;
  font-size: 18px;
}

.lang-grid span {
  color: var(--muted);
}

/* ---------- Certifications ---------- */

.cert-carousel {
  --per-view: 3;
  --gap: 20px;
}

.cert-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.cert-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.cert-buttons {
  display: flex;
  gap: 10px;
}

.cert-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--green-800);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background-color 200ms ease, color 200ms ease, transform 300ms var(--ease-spring), opacity 200ms ease;
}

.cert-btn:hover:not(:disabled) {
  background: var(--green-800);
  color: var(--cream);
  transform: translateY(-2px);
}

.cert-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.cert-btn svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2;
}

.cert-track {
  list-style: none;
  margin: 0;
  padding: 4px 4px 24px;
  margin-inline: -4px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--per-view) - 1) * var(--gap)) / var(--per-view));
  gap: var(--gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 4px;
  scroll-behavior: smooth;
  scrollbar-width: none;
}

.cert-track::-webkit-scrollbar {
  display: none;
}

.cert-track:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}

.cert-slide {
  scroll-snap-align: start;
  display: flex;
}

.cert-slide-link {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--ink);
}

.cert-slide-media {
  display: block;
  aspect-ratio: 4 / 3;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}

.cert-slide-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 900ms var(--ease-out);
}

.cert-slide-link:hover .cert-slide-media img {
  transform: scale(1.04);
}

.cert-slide-body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.cert-slide-body strong {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.cert-slide-body > span:last-child {
  font-size: 14px;
  color: var(--muted);
}

.cert-badge {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: var(--cream-deep);
  color: var(--green-800);
}

.cert-badge-int {
  background: var(--green-800);
  color: var(--cream);
}

.cert-badge-gold {
  background: var(--gold);
  color: var(--ink);
}

.cert-progress {
  height: 4px;
  border-radius: 4px;
  background: var(--cream-deep);
  overflow: hidden;
}

.cert-progress span {
  display: block;
  height: 100%;
  width: var(--thumb, 30%);
  border-radius: 4px;
  background: var(--green-800);
  transform: translateX(var(--offset, 0%));
  transition: transform 150ms linear;
}

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

.contact {
  background: var(--green-800);
  color: var(--cream);
}

.contact-inner {
  padding-top: clamp(64px, 9vw, 104px);
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.contact h2 {
  max-width: 760px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(36px, 5vw, 64px);
  line-height: 1.05;
  text-wrap: balance;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-row {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(245, 240, 230, 0.2);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  color: var(--on-green-muted);
}

/* ---------- Back to top ---------- */

.to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 10px 24px rgba(22, 33, 28, 0.2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 300ms ease, transform 400ms var(--ease-spring), visibility 0s linear 300ms;
}

.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 300ms ease, transform 400ms var(--ease-spring), visibility 0s;
}

.to-top:hover {
  transform: translateY(-3px);
}

/* ---------- Scroll reveal (only when JS is running) ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out),
    translate 450ms var(--ease-out), box-shadow 450ms var(--ease-out), border-color 300ms ease;
  transition-delay: calc(var(--i, 0) * 90ms);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* once revealed, hover lift should respond instantly, not wait for the stagger delay */
.js [data-reveal].is-done {
  transition-delay: 0ms;
  transition-duration: 450ms;
}

.js .timeline {
  --line-progress: 0;
}

.js .timeline.is-drawn {
  --line-progress: 1;
}

/* ---------- Keyframes ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes rise-portrait {
  from {
    opacity: 0;
    transform: translate3d(0, 48px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .skill-grid,
  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cert-carousel {
    --per-view: 2;
  }
}

@media (max-width: 880px) {
  :root {
    --header-h: 64px;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px clamp(20px, 5vw, 56px) 20px;
    background: var(--green-800);
    box-shadow: 0 16px 32px rgba(10, 25, 18, 0.25);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 250ms ease, transform 350ms var(--ease-out), visibility 0s linear 350ms;
  }

  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: opacity 250ms ease, transform 350ms var(--ease-out), visibility 0s;
  }

  .site-nav a:not(.btn) {
    padding: 14px 0;
    border-bottom: 1px solid rgba(245, 240, 230, 0.12);
    font-size: 17px;
  }

  .site-nav a:not(.btn)::after {
    bottom: 8px;
    right: auto;
    width: 32px;
  }

  .nav-cta {
    margin-top: 16px;
    align-self: flex-start;
  }

  .hero-grid,
  .case-card,
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-grid {
    gap: 32px;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .hero-portrait {
    width: min(100%, 360px);
  }

  .case-media {
    min-height: 220px;
  }
}

@media (max-width: 600px) {
  .brand-name {
    font-size: 18px;
  }

  .skill-grid,
  .project-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cert-carousel {
    --per-view: 1.2;
    --gap: 14px;
  }

  .hero-lead {
    font-size: 17px;
  }

  .hero-actions .btn {
    flex: 1 1 auto;
  }

  .case-facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }

  .case-facts dd + dt {
    margin-top: 10px;
  }

  .case-media {
    min-height: 150px;
  }

  .project-media {
    height: 140px;
  }

  .media-placeholder {
    padding: 20px;
    gap: 8px;
  }

  .media-placeholder svg {
    width: 34px;
    height: 34px;
  }

  .project-body {
    padding: 20px;
  }

  .more-card {
    min-height: 0;
  }

  .contact-actions .btn {
    width: 100%;
    white-space: normal;
  }

  .to-top {
    right: 16px;
    bottom: 16px;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .cert-track {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }

  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }

  .hero-portrait img {
    transform: none;
  }
}
