:root {
  --bg: #0a0a0b;
  --bg-soft: #101012;
  --text: #e9e7e2;
  --muted: #98959f;
  --dim: #74727c;
  --line: rgba(233, 231, 226, 0.09);
  --line-strong: rgba(233, 231, 226, 0.22);
  --accent: #e20074;
  --accent-soft: rgba(226, 0, 116, 0.14);
  --radius: 18px;
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --container: 1140px;
  --ease-out: cubic-bezier(0.2, 0.65, 0.25, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

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

::-webkit-scrollbar { width: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: rgba(233, 231, 226, 0.14);
  border-radius: 99px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: rgba(233, 231, 226, 0.25); }

.serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0;
}

/* ---------- accessibility ---------- */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 600;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: 999px;
  transform: translateY(-200%);
  transition: transform 0.2s ease;
}
.skip-link:focus { transform: translateY(0); }

/* ---------- grain overlay ---------- */
.grain {
  position: fixed;
  inset: 0;
  z-index: 300;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------- preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: transform 0.9s cubic-bezier(0.75, 0, 0.2, 1);
}
.preloader.done { transform: translateY(-101%); }
.preloader-inner {
  display: grid;
  justify-items: center;
  gap: 18px;
}
.preloader-name {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: var(--text);
}
.preloader-bar {
  width: 160px;
  height: 1px;
  background: var(--line);
  overflow: hidden;
}
.preloader-bar span {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
  animation: load-bar 0.85s var(--ease-out) forwards;
}
@keyframes load-bar { to { transform: scaleX(1); } }

/* ---------- custom cursor ---------- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 400;
  mix-blend-mode: difference;
}
.cursor-dot {
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  background: #fff;
}
.cursor-ring {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
              margin 0.3s var(--ease-out), border-color 0.3s, background 0.3s;
}
html.cursor-on .cursor-ring {
  width: 64px;
  height: 64px;
  margin: -32px 0 0 -32px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.12);
}
html.has-cursor,
html.has-cursor a,
html.has-cursor button { cursor: none; }

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 200;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: background 0.3s ease, border-color 0.3s ease, backdrop-filter 0.3s ease;
}
.nav.scrolled {
  background: rgba(10, 10, 11, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom-color: var(--line);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 20px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-brand {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 1rem;
  letter-spacing: 0.06em;
}
.brand-accent { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 26px;
  align-items: center;
  margin-left: auto;
}
.nav-links a {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  transition: color 0.25s ease;
}
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 0.35s var(--ease-out);
}
.nav-links a:hover { color: var(--text); }
.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
  transform-origin: 0 50%;
}
.nav-links a.active { color: var(--text); }
.nav-links .nav-cta {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 16px;
  color: var(--text);
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.nav-links .nav-cta::after { display: none; }
.nav-links .nav-cta:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.nav-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--dim);
  white-space: nowrap;
}
.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  padding: 10px 9px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 1.5px;
  background: var(--text);
}

/* ---------- hero ---------- */
.hero {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px 28px 90px;
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  overflow: visible;
}
.hero-glow {
  position: absolute;
  top: -10%;
  left: -15%;
  width: 720px;
  height: 720px;
  background: radial-gradient(closest-side, var(--accent-soft), transparent 70%);
  filter: blur(80px);
  pointer-events: none;
}
.hero-ghost {
  position: absolute;
  right: -10px;
  top: 16%;
  font-size: clamp(5rem, 16vw, 12rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(233, 231, 226, 0.06);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}
.hero-inner { position: relative; z-index: 1; width: 100%; }
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 28px;
}
.pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2.2s infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(226, 0, 116, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(226, 0, 116, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 0, 116, 0); }
}
.hero-name {
  margin: 0 0 30px;
  font-size: clamp(4rem, 13vw, 10rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.045em;
  line-height: 0.92;
}
.hero-name .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.ch, .hero-dot {
  display: inline-block;
  transform: translateY(115%) rotate(5deg);
}
body.loaded .ch {
  animation: ch-in 0.9s var(--ease-out) forwards;
  animation-delay: calc(0.5s + var(--ci) * 0.04s);
}
body.loaded .hero-dot {
  animation: ch-in 0.9s var(--ease-out) forwards;
  animation-delay: 0.95s;
}
@keyframes ch-in {
  to { transform: translateY(0) rotate(0); }
}
.hero-dot { color: var(--accent); }
.hero-role {
  margin: 0 0 36px;
  font-size: clamp(1.25rem, 2.6vw, 1.7rem);
  color: var(--text);
}
.hero-role .serif { font-size: 1.15em; }
.hero-role-sep { color: var(--dim); margin: 0 10px; }
.hero-role > span:last-child { color: var(--muted); font-size: 0.85em; }
.hero-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 28px;
  max-width: 820px;
}
.hero-tagline {
  margin: 0;
  color: var(--muted);
  max-width: 36ch;
}
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease-out), background 0.3s ease,
              color 0.3s ease, border-color 0.3s ease;
  will-change: transform;
}
.btn-fill {
  background: var(--text);
  color: var(--bg);
}
.btn-fill:hover {
  background: var(--accent);
  color: #fff;
}
.btn-line {
  border-color: var(--line-strong);
  color: var(--text);
}
.btn-line:hover { border-color: var(--text); }

/* hero entrance fades, gated by body.loaded */
.hero-fade { opacity: 0; }
body.loaded .hero-fade {
  animation: fade-up 0.9s var(--ease-out) forwards;
  animation-delay: var(--fd, 0s);
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(22px); }
  to   { opacity: 1; transform: translateY(0); }
}

.scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.scroll-hint-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--dim);
}
.scroll-hint-line {
  width: 56px;
  height: 1px;
  background: var(--line-strong);
  overflow: hidden;
  position: relative;
}
.scroll-hint-line::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--accent);
  transform: translateX(-100%);
  animation: hint-sweep 2.2s ease-in-out infinite;
}
@keyframes hint-sweep {
  0%   { transform: translateX(-100%); }
  60%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}

/* ---------- marquee ---------- */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  overflow: hidden;
}
.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 32s linear infinite;
  will-change: transform;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-half {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  padding-right: 28px;
}
.marquee-item {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  white-space: nowrap;
}
.marquee-sep {
  color: var(--accent);
  font-size: 0.6rem;
}
@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- sections ---------- */
.section {
  max-width: var(--container);
  margin: 0 auto;
  padding: 110px 28px;
}
.section-head { margin-bottom: 56px; }
.section-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  margin-bottom: 16px;
}
.section-title {
  margin: 0;
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.section-sub {
  color: var(--muted);
  margin: 14px 0 0;
  max-width: 56ch;
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 56px;
  align-items: start;
}
.about-bio {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.6;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.01em;
}
.about-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
}
.about-facts li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 0.95rem;
}
.about-facts li:last-child { border-bottom: 1px solid var(--line); }
.fact-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
}
.about-facts a {
  position: relative;
  transition: color 0.25s ease;
}
.about-facts a:hover { color: var(--accent); }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 80px;
  border-top: 1px solid var(--line);
  padding-top: 44px;
}
.stat { display: grid; gap: 6px; }
.stat-value {
  font-size: clamp(2.6rem, 5vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

/* ---------- timeline ---------- */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline-item {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 28px;
  padding: 34px 0;
  border-top: 1px solid var(--line);
  transition: background 0.3s ease;
}
.timeline-item:last-child { border-bottom: 1px solid var(--line); }
.timeline-year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding-top: 5px;
}
.timeline-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  transition: transform 0.35s var(--ease-out);
}
.timeline-item:hover .timeline-title { transform: translateX(8px); }
.timeline-org {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.92rem;
  font-weight: 500;
}
.timeline-desc {
  margin: 0 0 16px;
  color: var(--muted);
  max-width: 62ch;
}
.timeline-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  transition: border-color 0.25s ease, color 0.25s ease;
}
.timeline-item:hover .tag {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- skills ---------- */
.skills { display: grid; }
.skill-group {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 26px 0;
  border-top: 1px solid var(--line);
  align-items: start;
}
.skill-group:last-child { border-bottom: 1px solid var(--line); }
.skill-group-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--dim);
  padding-top: 12px;
}
.skill-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.skill-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text);
  transition: border-color 0.25s ease, transform 0.25s var(--ease-out), background 0.25s ease;
}
.skill-pill:hover {
  border-color: var(--line-strong);
  background: var(--bg-soft);
  transform: translateY(-3px);
}
.skill-pill img {
  width: 16px;
  height: 16px;
  opacity: 0.75;
  transition: opacity 0.25s ease, filter 0.25s ease;
}
.skill-pill:hover img {
  opacity: 1;
  filter: brightness(1.6);
}
.skill-fallback {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  background: var(--line-strong);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
}

/* ---------- projects ---------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 20px;
}
.project-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}
.project-media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.project-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* left-anchored crop + slight zoom hide the avatar, which turns negative under the invert filter */
  object-position: left center;
  transform: scale(1.08);
  transform-origin: left center;
  transition: transform 0.7s var(--ease-out), filter 0.4s ease;
  /* GitHub's OG cards are white — invert + desaturate folds them into the dark monochrome design */
  filter: grayscale(1) invert(0.93) contrast(1.04) brightness(0.85);
}
.project-card:hover .project-media img {
  transform: scale(1.13);
  filter: grayscale(1) invert(0.93) contrast(1.04) brightness(1);
}
.project-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px 24px 24px;
  flex: 1;
}
.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.project-name {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.project-arrow {
  color: var(--dim);
  transition: transform 0.3s var(--ease-out), color 0.3s ease;
}
.project-card:hover .project-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}
.project-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.93rem;
  flex: 1;
}
.project-meta {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--dim);
  margin-top: 8px;
}
.project-meta .lang-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: -1px;
  background: var(--dim);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover .lang-dot {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-soft);
}
.project-skeleton {
  min-height: 300px;
  position: relative;
  overflow: hidden;
}
.project-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(233, 231, 226, 0.04), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ---------- case study ---------- */
.case {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 60px;
  align-items: start;
}
.case-media {
  position: sticky;
  top: 110px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-soft);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.case-media:hover {
  border-color: var(--line-strong);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.8);
}
.case-media img {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: left center;
  transform: scale(1.08);
  transform-origin: left center;
  transition: transform 0.7s var(--ease-out), filter 0.4s ease;
  filter: grayscale(1) invert(0.93) contrast(1.04) brightness(0.85);
}
.case-media:hover img {
  transform: scale(1.13);
  filter: grayscale(1) invert(0.93) contrast(1.04) brightness(1);
}
.case-name {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.case-tagline {
  margin: 0 0 22px;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  color: var(--accent);
}
.case-intro {
  margin: 0 0 36px;
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--text);
}
.case-block {
  border-top: 1px solid var(--line);
  padding: 24px 0;
}
.case-block-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent);
}
.case-block p {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 60ch;
}
.case-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  padding-top: 28px;
}
.case-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- certifications ---------- */
.certs { display: grid; }
.cert-row {
  display: grid;
  grid-template-columns: 64px 1fr auto 28px;
  gap: 22px;
  align-items: center;
  padding: 30px 10px;
  border-top: 1px solid var(--line);
  transition: background 0.3s ease, padding 0.35s var(--ease-out);
}
.cert-row:last-child { border-bottom: 1px solid var(--line); }
.cert-row:hover {
  background: var(--bg-soft);
  padding-left: 26px;
  padding-right: 18px;
}
.cert-index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--dim);
}
.cert-title {
  margin: 0 0 3px;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.cert-issuer {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.cert-year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.cert-arrow {
  color: var(--dim);
  transition: transform 0.3s var(--ease-out), color 0.3s ease;
}
.cert-row:hover .cert-arrow {
  transform: translate(3px, -3px);
  color: var(--accent);
}

/* ---------- contact ---------- */
.section-contact { padding-bottom: 140px; }
.contact-big {
  margin: 0 0 48px;
  font-size: clamp(3rem, 9vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.02;
}
.contact-big .serif {
  color: var(--accent);
  font-weight: 400;
}
.contact-mail {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  font-size: clamp(1.3rem, 3.4vw, 2.2rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  padding-bottom: 10px;
  transition: transform 0.25s var(--ease-out);
  will-change: transform;
}
.contact-mail::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--line-strong);
}
.contact-mail::before {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform 0.45s var(--ease-out);
  z-index: 1;
}
.contact-mail:hover::before {
  transform: scaleX(1);
  transform-origin: 0 50%;
}
.mail-arrow {
  transition: transform 0.3s var(--ease-out), color 0.3s ease;
}
.contact-mail:hover .mail-arrow {
  transform: translateX(8px);
  color: var(--accent);
}
.contact-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 44px;
}
.social-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  transition: border-color 0.25s ease, color 0.25s ease, transform 0.25s var(--ease-out);
}
.social-chip:hover {
  border-color: var(--line-strong);
  color: var(--text);
  transform: translateY(-3px);
}
.social-chip img { width: 15px; height: 15px; opacity: 0.8; }
.social-fallback {
  width: 15px;
  height: 15px;
  border-radius: 4px;
  display: inline-grid;
  place-items: center;
  background: var(--line-strong);
  color: var(--text);
  font-size: 0.6rem;
  font-weight: 500;
}

/* ---------- footer ---------- */
.footer {
  position: relative;
  overflow: hidden;
  border-top: 1px solid var(--line);
}
.footer-ghost {
  display: block;
  text-align: center;
  font-size: clamp(4rem, 14vw, 11rem);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px rgba(233, 231, 226, 0.07);
  user-select: none;
  padding: 50px 20px 0;
  white-space: nowrap;
}
.footer-row {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
}

/* ---------- back to top ---------- */
.to-top {
  position: fixed;
  bottom: 26px;
  right: 26px;
  z-index: 90;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: rgba(16, 16, 18, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text);
  font-size: 1rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out), border-color 0.25s ease;
}
.to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.to-top:hover { border-color: var(--accent); }

/* ---------- reveal animations ---------- */
.reveal { opacity: 0; }
.reveal.is-visible {
  animation: rise 0.8s var(--ease-out) both;
  animation-delay: var(--d, 0ms);
}
@keyframes rise {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* masked line reveal for headings */
.mask { overflow: hidden; }
.mask.reveal { opacity: 1; }
.mask.reveal.is-visible { animation: none; }
.mask > span {
  display: block;
  transform: translateY(115%);
}
.mask.is-visible > span {
  animation: mask-up 0.95s var(--ease-out) forwards;
}
@keyframes mask-up {
  to { transform: translateY(0); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ch, .hero-dot, .mask > span { transform: none; }
  .reveal, .hero-fade { opacity: 1; }
  .marquee-track { animation: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 880px) {
  .nav-time { display: none; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .nav-links {
    position: absolute;
    top: 100%;
    right: 16px;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-soft);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    padding: 14px;
    gap: 12px;
    min-width: 200px;
    margin-left: 0;
    transform: translateY(-6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7);
  }
  .nav-links.open {
    opacity: 1;
    transform: translateY(6px);
    pointer-events: auto;
  }
  .hero { min-height: 0; padding-bottom: 70px; }
  .hero-ghost { display: none; }
  .scroll-hint { display: none; }
  .about-grid { grid-template-columns: 1fr; gap: 36px; }
  .case { grid-template-columns: 1fr; gap: 36px; }
  .case-media { position: static; }
  .stats { grid-template-columns: 1fr; gap: 22px; }
  .timeline-item { grid-template-columns: 1fr; gap: 8px; padding: 26px 0; }
  .skill-group { grid-template-columns: 1fr; gap: 12px; padding: 20px 0; }
  .skill-group-label { padding-top: 0; }
  .cert-row { grid-template-columns: 1fr auto 24px; }
  .cert-index { display: none; }
  .footer-row { justify-content: center; text-align: center; }
}
@media (max-width: 520px) {
  .section { padding: 70px 20px; }
  .hero { padding: 30px 20px 60px; }
  .hero-foot { flex-direction: column; align-items: flex-start; }
  .contact-mail { font-size: 1.15rem; gap: 10px; }
  .to-top { bottom: 18px; right: 18px; }
}
