/* ==========================================================================
   Guangzheng (David) Wu — personal site
   Bento-grid layout, light/dark, no build step.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light;

  /* surfaces */
  --bg: #f1efec;
  --bg-veil: rgba(241, 239, 236, 0.72);
  --surface: #ffffff;
  --surface-2: #f7f6f4;
  --surface-3: #edebe8;
  --surface-inverse: #16161a;

  /* ink */
  --text: #16161a;
  --text-2: #5a5a63;
  --text-3: #8d8d97;
  --text-inverse: #f6f5f3;

  /* lines */
  --border: rgba(20, 20, 26, 0.07);
  --border-strong: rgba(20, 20, 26, 0.13);

  /* accents */
  --accent: #2f68f0;
  --accent-soft: rgba(47, 104, 240, 0.1);
  --teal: #10a89a;
  --teal-soft: rgba(16, 168, 154, 0.12);
  --amber: #e8963a;
  --rose: #e2556e;

  /* radii */
  --r-xl: 28px;
  --r-lg: 22px;
  --r-md: 15px;
  --r-sm: 10px;

  /* elevation */
  --shadow-xs: 0 1px 2px rgba(16, 17, 22, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 17, 22, 0.05), 0 4px 12px -4px rgba(16, 17, 22, 0.07);
  --shadow-md: 0 1px 2px rgba(16, 17, 22, 0.05), 0 12px 30px -10px rgba(16, 17, 22, 0.14);
  --shadow-lg: 0 2px 4px rgba(16, 17, 22, 0.06), 0 26px 56px -16px rgba(16, 17, 22, 0.2);

  /* type */
  --ff-display: "Playfair Display", "Iowan Old Style", Georgia, serif;
  --ff-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ff-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* motion */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
  --dur: 0.42s;

  /* layout */
  --page-max: 1180px;
  --gap: 16px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0c0c0e;
  --bg-veil: rgba(12, 12, 14, 0.72);
  --surface: #17171a;
  --surface-2: #1e1e22;
  --surface-3: #26262b;
  --surface-inverse: #f6f5f3;

  --text: #f2f1ef;
  --text-2: #a4a4ae;
  --text-3: #74747f;
  --text-inverse: #16161a;

  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);

  --accent: #6c95ff;
  --accent-soft: rgba(108, 149, 255, 0.14);
  --teal: #3ed0c0;
  --teal-soft: rgba(62, 208, 192, 0.14);

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.45), 0 12px 30px -10px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.5), 0 26px 56px -16px rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ff-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--accent);
  color: #fff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 999;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--ff-display);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.08;
}

.eyebrow {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-3);
}

.lede {
  color: var(--text-2);
  font-size: 15px;
  line-height: 1.68;
}

/* --------------------------------------------------------------------------
   4. Shell: header / nav / footer
   -------------------------------------------------------------------------- */

.page {
  width: min(100% - 32px, var(--page-max));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 18px 0 14px;
  background: linear-gradient(var(--bg) 58%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 16px;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--ff-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  flex-shrink: 0;
}

.wordmark__a {
  color: var(--text);
}

.wordmark__b {
  color: var(--accent);
}

.wordmark__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  transform: translateY(-2px);
}

.nav {
  margin-inline: auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border);
}

.nav__list {
  display: flex;
  gap: 2px;
}

.nav__link {
  display: block;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  transition: color 0.2s var(--ease), background-color 0.2s var(--ease);
}

.nav__link:hover {
  color: var(--text);
}

.nav__link[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  box-shadow: var(--shadow-xs);
  transition: transform 0.2s var(--ease), color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.icon-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.icon-btn svg {
  width: 17px;
  height: 17px;
}

.theme-toggle .moon {
  display: none;
}

[data-theme="dark"] .theme-toggle .sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .moon {
  display: block;
}

.site-footer {
  padding: 40px 0 48px;
  text-align: center;
  color: var(--text-3);
  font-size: 12.5px;
}

.site-footer a {
  color: var(--text-2);
  border-bottom: 1px solid var(--border-strong);
}

.site-footer a:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   5. Bento grid + card primitive
   -------------------------------------------------------------------------- */

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--gap);
  padding-bottom: 8px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.card--lift:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.card--flush {
  padding: 0;
}

.card--dark {
  background: var(--surface-inverse);
  color: var(--text-inverse);
  border-color: transparent;
}

.card--dark .lede,
.card--dark .eyebrow {
  color: rgba(255, 255, 255, 0.62);
}

[data-theme="dark"] .card--dark .lede,
[data-theme="dark"] .card--dark .eyebrow {
  color: rgba(0, 0, 0, 0.6);
}

/* column spans */
.sp-2 { grid-column: span 2; }
.sp-3 { grid-column: span 3; }
.sp-4 { grid-column: span 4; }
.sp-6 { grid-column: span 6; }

/* row spans */
.rw-2 { grid-row: span 2; }

/* JS-injected wrappers must not become grid items themselves */
.contents { display: contents; }

/* corner action pill (the ↗ button from the reference layout) */
.card__go {
  position: absolute;
  left: 20px;
  bottom: 20px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), background-color 0.25s var(--ease), color 0.25s var(--ease);
}

.card__go svg {
  width: 15px;
  height: 15px;
}

.card:hover .card__go {
  transform: translate(1px, -1px) rotate(45deg);
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}

/* --------------------------------------------------------------------------
   6. Hero card
   -------------------------------------------------------------------------- */

.hero {
  gap: 18px;
  justify-content: center;
  min-height: 268px;
}

.hero__top {
  display: flex;
  align-items: center;
  gap: 14px;
}

.avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 3px solid var(--surface);
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.greeting {
  position: relative;
  padding: 7px 15px;
  border-radius: 16px 16px 16px 4px;
  background: var(--accent);
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  animation: pop 0.5s var(--ease) both;
  animation-delay: 0.25s;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}

.hero__title {
  font-size: clamp(26px, 3.4vw, 38px);
}

.hero__name {
  position: relative;
  display: inline-block;
  white-space: nowrap;
}

/* hand-drawn underline under the name */
.hero__name::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.16em;
  height: 0.22em;
  background: no-repeat center / 100% 100%
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 16' preserveAspectRatio='none'%3E%3Cpath d='M2 11c26-6 52-8 78-6s52 7 78 4' fill='none' stroke='%232f68f0' stroke-width='3.5' stroke-linecap='round'/%3E%3Cpath d='M14 15c30-4 60-5 90-3s48 5 82 1' fill='none' stroke='%2310a89a' stroke-width='2' stroke-linecap='round' opacity='.55'/%3E%3C/svg%3E");
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 2px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
}

.chip svg {
  width: 13px;
  height: 13px;
  opacity: 0.65;
}

.chip--live {
  color: var(--teal);
  background: var(--teal-soft);
  border-color: transparent;
}

.dot-live {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: pulse 2.4s var(--ease) infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(16, 168, 154, 0.5); }
  70%  { box-shadow: 0 0 0 7px rgba(16, 168, 154, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 168, 154, 0); }
}

/* --------------------------------------------------------------------------
   7. Stat / scale card
   -------------------------------------------------------------------------- */

.stat {
  justify-content: space-between;
  gap: 14px;
  min-height: 268px;
  background:
    radial-gradient(120% 90% at 90% 0%, var(--accent-soft), transparent 62%),
    var(--surface);
}

.stat__value {
  font-family: var(--ff-display);
  font-size: clamp(40px, 5.4vw, 58px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1;
  background: linear-gradient(120deg, var(--accent), var(--teal));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat__unit {
  font-size: 0.42em;
  font-family: var(--ff-mono);
  font-weight: 500;
  letter-spacing: 0;
}

.stat__bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 46px;
}

.stat__bars span {
  flex: 1;
  border-radius: 3px;
  background: linear-gradient(var(--accent), var(--teal));
  opacity: 0.28;
  transform-origin: bottom;
  animation: rise 1.5s var(--ease) both;
}

.stat__bars span:nth-child(3n) { opacity: 0.75; }
.stat__bars span:nth-child(4n) { opacity: 0.45; }

@keyframes rise {
  from { transform: scaleY(0.1); opacity: 0; }
}

/* --------------------------------------------------------------------------
   8. Tech stack card
   -------------------------------------------------------------------------- */

.stack {
  --contour: rgba(20, 20, 26, 0.055);
  background:
    repeating-radial-gradient(circle at 30% 22%, transparent 0 15px, var(--contour) 15px 16px),
    repeating-radial-gradient(circle at 78% 74%, transparent 0 19px, var(--contour) 19px 20px),
    var(--surface);
  min-height: 380px;
  justify-content: flex-end;
}

[data-theme="dark"] .stack {
  --contour: rgba(255, 255, 255, 0.05);
}

.stack__grid {
  position: absolute;
  inset: 14px 14px 62px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: space-evenly;
  justify-items: center;
  gap: 10px;
}

.tile {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  animation: bob 6s ease-in-out infinite;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.tile:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: var(--shadow-md);
}

.tile img {
  width: 26px;
  height: 26px;
}

.tile--text {
  font-family: var(--ff-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tile:nth-child(2)  { animation-delay: -0.7s; }
.tile:nth-child(3)  { animation-delay: -1.4s; }
.tile:nth-child(4)  { animation-delay: -2.1s; }
.tile:nth-child(5)  { animation-delay: -2.8s; }
.tile:nth-child(6)  { animation-delay: -3.5s; }
.tile:nth-child(7)  { animation-delay: -4.2s; }
.tile:nth-child(8)  { animation-delay: -4.9s; }
.tile:nth-child(9)  { animation-delay: -5.6s; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

.stack__foot {
  position: relative;
  margin-top: auto;
  padding-left: 46px;
}

/* --------------------------------------------------------------------------
   9. Terminal / KQL card
   -------------------------------------------------------------------------- */

.term {
  background: #101116;
  color: #d7dbe6;
  border-color: transparent;
  gap: 12px;
  min-height: 210px;
}

.term__chrome {
  display: flex;
  gap: 6px;
}

.term__chrome i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #34363f;
}

.term__chrome i:first-child { background: #e2556e; }
.term__chrome i:nth-child(2) { background: #e8963a; }
.term__chrome i:nth-child(3) { background: #10a89a; }

.term__body {
  font-family: var(--ff-mono);
  font-size: 12px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
}

.term__body .k { color: #7aa2ff; }
.term__body .s { color: #5fd3a8; }
.term__body .c { color: #6a6f80; }
.term__body .n { color: #e8b464; }

.caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  vertical-align: -2px;
  background: #5fd3a8;
  animation: blink 1.1s steps(2) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* --------------------------------------------------------------------------
   10. Feature / media cards
   -------------------------------------------------------------------------- */

.feature {
  min-height: 300px;
  justify-content: flex-end;
  color: #fff;
  border-color: transparent;
}

.feature__bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  object-fit: cover;
  width: 100%;
  height: 100%;
  transition: transform 0.7s var(--ease);
}

.card--lift:hover .feature__bg {
  transform: scale(1.05);
}

.feature::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(transparent 32%, rgba(8, 9, 14, 0.86));
}

.feature__body {
  position: relative;
  z-index: 2;
  padding-left: 46px;
}

.feature__body .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.feature__title {
  font-size: 21px;
  margin-top: 2px;
}

.feature__note {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  margin-top: 4px;
}

.feature .card__go {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
  backdrop-filter: blur(8px);
}

/* gradient placeholder used when a project has no screenshot yet */
.canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.canvas--aurora  { background: linear-gradient(135deg, #4f46e5, #2f68f0 45%, #10a89a); }
.canvas--sunset  { background: linear-gradient(135deg, #f0762f, #e2556e 55%, #a3379a); }
.canvas--forest  { background: linear-gradient(135deg, #0f766e, #10a89a 50%, #86c93a); }
.canvas--carbon  { background: linear-gradient(135deg, #1f2430, #343b4d 60%, #4b5468); }

/* dot lattice so an image-less card still reads as designed, not unfinished */
.canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.22) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: 0.55;
}

.canvas__mark {
  position: absolute;
  right: 6%;
  bottom: -14%;
  font-family: var(--ff-display);
  font-size: 11rem;
  font-weight: 800;
  line-height: 1;
  color: rgba(255, 255, 255, 0.16);
  user-select: none;
}

.canvas__glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.42), transparent);
  animation: drift 14s ease-in-out infinite alternate;
}

@keyframes drift {
  from { transform: translate(-14%, -8%) scale(1); }
  to   { transform: translate(14%, 10%) scale(1.18); }
}

/* --------------------------------------------------------------------------
   11. Social cards
   -------------------------------------------------------------------------- */

.social {
  min-height: 168px;
  align-items: flex-start;
  justify-content: space-between;
  color: #fff;
  border-color: transparent;
}

.social--in { background: linear-gradient(140deg, #0a66c2, #1d92e8); }
.social--gh { background: var(--surface-inverse); color: var(--text-inverse); }

.social__mark {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
}

.social__mark svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.social__label {
  position: relative;
  z-index: 1;
  display: block;
  margin-top: auto;
  padding-right: 46px;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.social__handle {
  display: block;
  margin-top: 3px;
  font-family: var(--ff-mono);
  font-size: 11.5px;
  font-weight: 400;
  opacity: 0.72;
  overflow-wrap: anywhere;
}

.social--plain {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.social--plain .social__mark { color: var(--text-3); }
.social--plain .social__handle { color: var(--text-3); opacity: 1; }

.social .card__go {
  left: auto;
  right: 20px;
  bottom: 20px;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.26);
  color: #fff;
}

.social--plain .card__go {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.social--gh .card__go {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .social--gh .card__go {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.16);
  color: var(--text-inverse);
}

/* --------------------------------------------------------------------------
   12. Contact card
   -------------------------------------------------------------------------- */

.contact {
  min-height: 176px;
  gap: 22px;
  flex-direction: row;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  background:
    radial-gradient(90% 130% at 100% 100%, var(--teal-soft), transparent 60%),
    var(--surface);
}

.contact__title {
  font-size: clamp(24px, 3vw, 32px);
}

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 17px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform 0.2s var(--ease), background-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.btn svg {
  width: 15px;
  height: 15px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn--primary {
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow-sm);
}

.btn--primary:hover {
  box-shadow: var(--shadow-md);
}

.btn--ghost {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-2);
}

.btn--ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   13. Page header (about / projects)
   -------------------------------------------------------------------------- */

.page-head {
  padding: 26px 0 22px;
  max-width: 640px;
}

.page-head__title {
  font-size: clamp(32px, 5vw, 46px);
  margin-top: 8px;
}

.page-head .lede {
  margin-top: 10px;
}

/* --------------------------------------------------------------------------
   14. Timeline (about)
   -------------------------------------------------------------------------- */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-title h2 {
  font-family: var(--ff-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline--split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
}

.role {
  position: relative;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color 0.25s var(--ease), background-color 0.25s var(--ease);
}

.role:hover {
  border-color: var(--border-strong);
}

.role__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.role__title {
  font-size: 15.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.role__org {
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 550;
}

.role__when {
  font-family: var(--ff-mono);
  font-size: 11.5px;
  color: var(--text-3);
  white-space: nowrap;
}

.role__tag {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}

.role__tag--now {
  color: var(--teal);
  border-color: var(--teal);
  background: var(--teal-soft);
}

.role__points {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.role__points li {
  position: relative;
  padding-left: 17px;
  font-size: 13.5px;
  line-height: 1.62;
  color: var(--text-2);
}

.role__points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-strong);
}

.role__points strong {
  color: var(--text);
  font-weight: 600;
}

/* --------------------------------------------------------------------------
   15. Skill groups
   -------------------------------------------------------------------------- */

.skill-group + .skill-group {
  margin-top: 16px;
}

.skill-group__label {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 9px;
}

.skill-group__items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 5px 11px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.pill:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

/* --------------------------------------------------------------------------
   16. Projects page
   -------------------------------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 18px;
}

.filter {
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.2s var(--ease);
}

.filter:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter[aria-pressed="true"] {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: var(--gap);
}

.project {
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 13px;
}

.project__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}

.project__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.project:hover .project__thumb img {
  transform: scale(1.05);
}

.project__body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 0 6px;
  flex: 1;
}

.project__title {
  font-family: var(--ff-display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.project__desc {
  font-size: 13.2px;
  line-height: 1.6;
  color: var(--text-2);
}

.project__tech {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: auto;
  padding-top: 6px;
}

.tech-tag {
  padding: 3px 9px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.project__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 6px 3px;
  border-top: 1px solid var(--border);
}

.project__foot .spacer {
  margin-left: auto;
}

.badge {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge--work    { background: var(--accent-soft); color: var(--accent); }
.badge--personal{ background: var(--teal-soft); color: var(--teal); }
.badge--research{ background: rgba(232, 150, 58, 0.14); color: #b26b17; }
.badge--soon    { background: var(--surface-3); color: var(--text-3); }

[data-theme="dark"] .badge--research { color: var(--amber); }

.project__date {
  font-family: var(--ff-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.link-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  transition: all 0.2s var(--ease);
}

.link-btn svg {
  width: 14px;
  height: 14px;
}

.link-btn:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.empty-note {
  padding: 40px 0;
  text-align: center;
  color: var(--text-3);
  font-size: 13.5px;
}

/* --------------------------------------------------------------------------
   17. Reveal-on-scroll
   -------------------------------------------------------------------------- */

/* Only hide pre-scroll content when JS is present to reveal it again. */
.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   18. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 960px) {
  .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sp-2 { grid-column: span 2; }
  .sp-3 { grid-column: span 2; }
  .sp-4 { grid-column: span 4; }
  .sp-6 { grid-column: span 4; }
  .rw-2 { grid-row: span 1; }
  .stack { min-height: 320px; }
  .stack__grid { position: static; inset: auto; margin-bottom: 16px; grid-template-columns: repeat(5, 1fr); }
  .stack__foot { padding-left: 0; }
  .stack .card__go { position: static; margin-top: 12px; }
}

@media (max-width: 720px) {
  :root { --gap: 12px; --r-xl: 22px; }

  .site-header { padding: 12px 0 10px; }
  .site-header__inner { flex-wrap: wrap; justify-content: space-between; }
  .nav {
    order: 3;
    width: 100%;
    margin-inline: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav__list { min-width: max-content; }

  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-2, .sp-3 { grid-column: span 2; }
  .sp-4, .sp-6 { grid-column: span 2; }
  .timeline--split { grid-template-columns: 1fr; }

  .card { padding: 18px; }
  .hero { min-height: 0; }
  .stat { min-height: 0; }
  .stack__grid { grid-template-columns: repeat(4, 1fr); }
  .project-grid { grid-template-columns: 1fr; }
  .social { min-height: 140px; }
  .contact { flex-direction: column; align-items: stretch; gap: 16px; min-height: 0; }
}

@media (max-width: 420px) {
  .stack__grid { grid-template-columns: repeat(3, 1fr); }
  .hero__title { font-size: 25px; }
}

/* --------------------------------------------------------------------------
   19. Motion & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .reveal { opacity: 1; transform: none; }
  .js .reveal { opacity: 1; transform: none; }
}

@media print {
  .site-header,
  .card__go,
  .filters,
  .site-footer { display: none; }

  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
