/* ==========================================================================
   junze.dev — ink on paper
   ========================================================================== */

:root {
  --paper: #f6f5f2;
  --ink: #151514;
  --ink-soft: #4a4843;
  --ink-muted: #6f6c66;
  --rule: #dbd9d2;
  --accent: #cf3b25;

  /* One family carries every Chinese glyph on the page (and the Latin set beside it) */
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  /* Latin-only labels; anything CJK inside falls through to the serif above */
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Consolas, "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --wrap: 1120px;
  --gutter: clamp(20px, 5vw, 48px);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121211;
    --ink: #ecebe6;
    --ink-soft: #bdbab2;
    --ink-muted: #918e86;
    --rule: #2d2c29;
    --accent: #ff6a4d;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #121211;
  --ink: #ecebe6;
  --ink-soft: #bdbab2;
  --ink-muted: #918e86;
  --rule: #2d2c29;
  --accent: #ff6a4d;
  color-scheme: dark;
}

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.75;
  min-height: 100vh;
  overflow-x: hidden;
}

:lang(en) body {
  line-height: 1.65;
}

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

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

ul, ol {
  list-style: none;
}

[hidden] {
  display: none !important;
}

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

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.svg-defs {
  position: absolute;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -48px;
  padding: 6px 12px;
  background-color: var(--ink);
  color: var(--paper);
  font-size: 14px;
  z-index: 10;
}

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

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 24px;
  animation: fade-in 0.5s ease both;
}

.wordmark {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
}

.wordmark span {
  color: var(--ink-muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.6vw, 26px);
  font-size: 14px;
}

.site-nav a {
  color: var(--ink-soft);
  padding-block: 4px;
  background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px;
  transition: color 0.2s ease, background-size 0.35s var(--ease-out);
}

.site-nav a:hover {
  color: var(--ink);
  background-position: 0 100%;
  background-size: 100% 1px;
}

.lang-toggle,
.theme-toggle {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
}

.lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 2px;
  font-family: inherit;
  font-size: 14px;
  transition: color 0.2s ease;
}

.lang-toggle .icon {
  width: 16px;
  height: 16px;
}

.lang-toggle:hover {
  color: var(--accent);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-left: -6px;
  border-radius: 50%;
  transition: color 0.2s ease, transform 0.45s var(--ease-out);
}

.theme-toggle:hover {
  color: var(--ink);
  transform: rotate(30deg);
}

.theme-toggle .icon {
  width: 19px;
  height: 19px;
}

/* Moon while light, sun while dark */
.theme-toggle .icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .theme-toggle .icon-moon {
    display: none;
  }
}

:root[data-theme="dark"] .theme-toggle .icon-sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

.nav-github {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-github .icon {
  width: 16px;
  height: 16px;
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  align-items: end;
  column-gap: clamp(24px, 5vw, 72px);
  padding-top: clamp(48px, 9vw, 120px);
}

/* The portrait stands on this line */
.hero::after {
  content: "";
  grid-column: 1 / -1;
  height: 1px;
  background-color: var(--ink);
  transform-origin: left;
  animation: draw-x 0.8s var(--ease-in-out) both;
}

.hero-text {
  padding-bottom: clamp(40px, 6vw, 80px);
}

.eyebrow {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 28px;
  animation: fade-up 0.6s var(--ease-out) both;
}

.eyebrow .slash {
  color: var(--accent);
  margin-inline: 4px;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(2rem, 6.2vw, 4.5rem);
  line-height: 1.22;
  margin-bottom: 32px;
}

:lang(en) .hero-title {
  font-size: clamp(1.75rem, 4.7vw, 3.4rem);
  letter-spacing: -0.01em;
}

/* Each line rises out of its own mask */
.hero-title .line {
  display: block;
  clip-path: inset(-0.1em -0.2em -0.2em -0.2em);
}

.hero-title .line-inner {
  display: block;
  white-space: nowrap;
  animation: rise 0.8s var(--ease-out) calc(0.05s + var(--n) * 0.07s) both;
}

:lang(en) .hero-title .line-inner {
  white-space: normal;
}

/* Hand-drawn underline, echoing the scribble over the portrait's face */
.scribble {
  position: relative;
  display: inline-block;
}

.scribble svg {
  position: absolute;
  left: -4%;
  bottom: -0.12em;
  width: 108%;
  height: 0.34em;
  overflow: visible;
}

.scribble path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 0.55s var(--ease-in-out) 0.7s forwards;
}

.hero-lead {
  max-width: 34em;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  color: var(--ink-soft);
  animation: fade-up 0.7s var(--ease-out) 0.25s both;
}

/* The portrait develops upward from the line it stands on: a soft-edged wipe, no sliding */
@property --reveal {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 130%;
}

.hero-figure {
  justify-self: end;
  width: 100%;
  max-width: 400px;
  -webkit-mask-image: linear-gradient(to top, #000 calc(var(--reveal) - 30%), transparent var(--reveal));
  mask-image: linear-gradient(to top, #000 calc(var(--reveal) - 30%), transparent var(--reveal));
  animation: develop 1s var(--ease-in-out) 0.15s both;
}

.hero-avatar {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.hero-figure.boiling .hero-avatar {
  filter: url(#boil);
}

/* Theme-specific portraits retain their natural tones; both share the boil filter. */

/* ==========================================================================
   Hero Social
   ========================================================================== */

.hero-social {
  padding-top: clamp(20px, 2.6vw, 28px);
  padding-bottom: 0;
  animation: fade-up 0.7s var(--ease-out) 0.3s both;
}

.social-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px clamp(16px, 3vw, 36px);
}

.social-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 4px;
  color: var(--ink);
  transition: color 0.2s ease;
}

.social-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--ink-soft);
  transition: color 0.2s ease, transform 0.2s var(--ease-out);
}

.social-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.social-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--ink);
  transition: color 0.2s ease;
}

.social-title .arrow {
  width: 12px;
  height: 12px;
  color: var(--ink-muted);
  opacity: 0.7;
  transition: transform 0.25s var(--ease-out), color 0.2s ease, opacity 0.2s ease;
}

.social-handle {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s ease;
}

/* Micro-interactions on hover */
.social-link:hover .social-icon {
  color: var(--accent);
  transform: translateY(-1px);
}

.social-link:hover .social-title {
  color: var(--accent);
}

.social-link:hover .social-title .arrow {
  color: var(--accent);
  opacity: 1;
  transform: translate(2px, -2px);
}

.social-link:hover .social-handle {
  color: var(--ink);
}

/* ==========================================================================
   Sections
   ========================================================================== */

.section {
  padding-top: clamp(72px, 11vw, 144px);
  scroll-margin-top: -24px;
}

#projects {
  padding-top: clamp(56px, 8vw, 96px);
}

.section-head {
  position: relative;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: clamp(20px, 3vw, 36px);
}

.section-head::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 1px;
  background-color: var(--ink);
  transform-origin: left;
  transition: transform 0.7s var(--ease-in-out);
}

.js .section-head:not(.in)::after {
  transform: scaleX(0);
}

.section-head h2 {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(1.625rem, 3.4vw, 2.5rem);
  line-height: 1.25;
}

:lang(en) .section-head h2 {
  letter-spacing: -0.01em;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-muted);
  white-space: nowrap;
}

a.section-label {
  transition: color 0.2s ease;
}

a.section-label:hover {
  color: var(--ink);
}

.icon {
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
}

.arrow {
  width: 0.8em;
  height: 0.8em;
  margin-left: 0.25em;
  vertical-align: -0.02em;
  color: var(--ink-muted);
  transition: transform 0.3s var(--ease-out), color 0.2s ease;
}

a:hover .arrow {
  color: var(--accent);
  transform: translate(3px, -3px);
}

/* Projects */
.project {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  column-gap: clamp(24px, 5vw, 72px);
  row-gap: 16px;
  padding-block: clamp(28px, 4vw, 44px);
}

.project + .project::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background-color: var(--rule);
}

.project h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: clamp(1.25rem, 2.2vw, 1.625rem);
  line-height: 1.35;
  overflow-wrap: anywhere;
  margin-bottom: 10px;
}

.project h3 a {
  transition: color 0.2s ease;
}

.project h3 a:hover {
  color: var(--accent);
}

.project-stack,
.project-stars {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.tags {
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-muted);
}

.project-stars {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  animation: fade-in 0.4s ease both;
}

.project-stars .star {
  color: var(--accent);
}

.project-desc {
  font-size: 1.0625rem;
}

/* ==========================================================================
   GitHub activity
   ========================================================================== */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 24px clamp(16px, 4vw, 48px);
  padding-block: clamp(28px, 4vw, 44px);
}

.stats li {
  display: flex;
  flex-direction: column;
}

.stats li:nth-child(2) { --d: 0.05s; }
.stats li:nth-child(3) { --d: 0.1s; }
.stats li:nth-child(4) { --d: 0.15s; }

.stat-num {
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: clamp(2rem, 4.6vw, 3.25rem);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 13px;
  color: var(--ink-muted);
}

/* Heatmap: washes of the accent colour instead of the usual greens */
.heatmap {
  --level-0: color-mix(in srgb, var(--ink) 7%, var(--paper));
  --level-1: color-mix(in srgb, var(--accent) 24%, var(--paper));
  --level-2: color-mix(in srgb, var(--accent) 48%, var(--paper));
  --level-3: color-mix(in srgb, var(--accent) 74%, var(--paper));
  --level-4: var(--accent);
}

.heatmap.unavailable {
  display: none;
}

.heatmap-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  /* Room for the hover outline */
  padding: 3px;
  margin: -3px;
}

.heatmap-scroll::-webkit-scrollbar {
  display: none;
}

.heatmap-inner {
  min-width: 742px;
}

.heatmap-months,
.heatmap-grid {
  display: grid;
  grid-template-columns: repeat(var(--weeks, 53), minmax(0, 1fr));
  column-gap: 3px;
}

.heatmap-months {
  height: 22px;
  font-size: 12px;
  color: var(--ink-muted);
}

.heatmap-months span {
  grid-row: 1;
  white-space: nowrap;
}

.heatmap-grid {
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  row-gap: 3px;
}

.heatmap-grid i,
.heatmap-legend i {
  aspect-ratio: 1;
  border-radius: 2px;
  background-color: var(--level-0);
}

.heatmap-grid i {
  transition: background-color 0.4s ease var(--delay, 0s);
}

.heatmap-grid i.pad {
  visibility: hidden;
}

.heatmap-grid i[data-date]:hover {
  outline: 1.5px solid var(--ink);
  outline-offset: 1px;
}

[data-level="1"] { background-color: var(--level-1) !important; }
[data-level="2"] { background-color: var(--level-2) !important; }
[data-level="3"] { background-color: var(--level-3) !important; }
[data-level="4"] { background-color: var(--level-4) !important; }

.heatmap-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--ink-muted);
}

.heatmap-legend i {
  width: 11px;
}

.heatmap-legend span:first-child {
  margin-right: 4px;
}

.heatmap-legend span:last-child {
  margin-left: 4px;
}

.heat-tip {
  position: fixed;
  z-index: 20;
  transform: translate(-50%, calc(-100% - 9px));
  padding: 4px 10px;
  border-radius: 4px;
  background-color: var(--ink);
  color: var(--paper);
  font-size: 12.5px;
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
}

/* Sub-blocks inside the activity section: tech stack, recently merged */
.subsection {
  margin-top: clamp(40px, 6vw, 72px);
}

.subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}

.subhead h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.4;
}

.subhead p {
  font-size: 13px;
  color: var(--ink-muted);
}

/* Tech stack: one bar split by language, strongest accent for the most used */
.stack-bar {
  display: flex;
  gap: 2px;
  height: 10px;
  margin-top: 26px;
  clip-path: inset(0 0 0 0);
  transition: clip-path 0.9s var(--ease-in-out) 0.15s;
}

.js .subsection:not(.in) .stack-bar {
  clip-path: inset(0 100% 0 0);
}

.stack-bar i {
  min-width: 3px;
  border-radius: 2px;
}

/* Rank colours for the bar segments */
#stack [data-rank] {
  --rank: color-mix(in srgb, var(--ink) 12%, var(--paper));
}

#stack [data-rank="1"] { --rank: var(--accent); }
#stack [data-rank="2"] { --rank: color-mix(in srgb, var(--accent) 76%, var(--paper)); }
#stack [data-rank="3"] { --rank: color-mix(in srgb, var(--accent) 56%, var(--paper)); }
#stack [data-rank="4"] { --rank: color-mix(in srgb, var(--accent) 40%, var(--paper)); }
#stack [data-rank="5"] { --rank: color-mix(in srgb, var(--accent) 27%, var(--paper)); }
#stack [data-rank="6"] { --rank: color-mix(in srgb, var(--accent) 16%, var(--paper)); }

.stack-bar i {
  background-color: var(--rank);
  transition: opacity 0.25s ease;
}

/* Pointing at a language (in the bar or the list) dims everything else */
.stack-bar.focusing i:not(.active),
.stack-legend.focusing li:not(.active) {
  opacity: 0.25;
}

.stack-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px clamp(20px, 3.4vw, 40px);
  margin-top: 22px;
}

.stack-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  cursor: default;
  transition: opacity 0.25s ease;
}

/* Language marks are drawn in ink, like the portrait */
.stack-legend .icon {
  width: 17px;
  height: 17px;
  color: var(--ink);
}

.stack-share {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* One line per repository: name and how many PRs were merged */
.merged-list {
  min-height: 52px;
}

.merged-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
}

.merged-list li.enter {
  animation: fade-up 0.5s var(--ease-out) var(--d, 0s) both;
}

.merged-repo {
  font-weight: 600;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--accent), var(--accent)) no-repeat 100% 100% / 0 1px;
  transition: color 0.2s ease, background-size 0.4s var(--ease-out);
}

.merged-repo:hover {
  color: var(--accent);
  background-position: 0 100%;
  background-size: 100% 1px;
}

.merged-count {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

.merged-list .merged-note {
  display: block;
  padding-block: 20px;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.merged-note a {
  color: var(--accent);
}

/* ==========================================================================
   Contributions
   ========================================================================== */

.contrib-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 5vw, 72px);
}

.contrib {
  border-bottom: 1px solid var(--rule);
}

.contrib:nth-child(2n) { --d: 0.05s; }

.contrib a {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 22px;
}

.contrib-logo {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background-color: #fff;
  box-shadow: 0 0 0 1px var(--rule);
  object-fit: cover;
  transition: transform 0.3s var(--ease-out);
}

.contrib a:hover .contrib-logo {
  transform: scale(1.06) rotate(-3deg);
}

.contrib-text {
  min-width: 0;
}

.contrib-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.125rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  transition: color 0.2s ease;
}

.contrib-owner {
  color: var(--ink-muted);
  transition: color 0.2s ease;
}

.contrib a:hover .contrib-name,
.contrib a:hover .contrib-owner {
  color: var(--accent);
}

.contrib-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.contrib-facts .fact {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.contrib-facts .star {
  color: var(--accent);
}

/* ==========================================================================
   Expertise
   ========================================================================== */

.expertise-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: clamp(24px, 4vw, 48px);
}

.expertise {
  display: flex;
  flex-direction: column;
  padding-block: 28px 32px;
  border-bottom: 1px solid var(--rule);
}

.expertise:nth-child(3n + 2) { --d: 0.05s; }
.expertise:nth-child(3n) { --d: 0.1s; }

.expertise h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.1875rem;
  line-height: 1.4;
  margin-bottom: 10px;
}

.expertise p:not(.tags) {
  font-size: 0.9375rem;
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.expertise .tags {
  margin-top: auto;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  padding-top: clamp(72px, 10vw, 128px);
  padding-bottom: 40px;
}

.footer-meta {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* ==========================================================================
   Motion
   ========================================================================== */

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
}

@keyframes rise {
  from { transform: translateY(130%); }
}

@keyframes develop {
  from { --reveal: 0%; }
}

@keyframes draw-x {
  from { transform: scaleX(0); }
}

@keyframes draw {
  to { stroke-dashoffset: 0; }
}

/* Scroll reveal (only when JS is there to undo it) */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease var(--d, 0s), transform 0.6s var(--ease-out) var(--d, 0s);
}

.js .reveal.in {
  opacity: 1;
  transform: none;
}

/* Switching language loads the other page: cross-fade between the two documents.
   The theme switch wipes in as a circle (driven from app.js). */
@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
}

.theme-switching::view-transition-old(root),
.theme-switching::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

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

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }

  .scribble path {
    stroke-dashoffset: 0;
  }

  .hero-figure {
    -webkit-mask-image: none;
    mask-image: none;
  }

  .js .reveal,
  .js .section-head:not(.in)::after {
    opacity: 1;
    transform: none;
  }
}

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

@media (max-width: 900px) {
  .social-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 24px;
  }

  .expertise-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .expertise:nth-child(n) { --d: 0s; }
  .expertise:nth-child(2n) { --d: 0.05s; }
}

@media (max-width: 720px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-text {
    padding-bottom: 32px;
  }

  .hero-figure {
    width: 58%;
    max-width: 260px;
  }

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

  .contrib:nth-child(n) { --d: 0s; }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .nav-anchor {
    display: none;
  }

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

  .expertise:nth-child(n) { --d: 0s; }
}

@media (max-width: 540px) {
  .social-list {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .social-meta {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    flex: 1;
    gap: 12px;
  }
}

@media print {
  .js .reveal {
    opacity: 1;
    transform: none;
  }

  .lang-toggle,
  .theme-toggle {
    display: none;
  }
}
