/* =========================================================================
   Martin Stejskal — personal site
   Lean design system: tokens, layout, components, micro-interactions.
   No build step, no external requests (system font stack).
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------------------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #07080c;
  --bg-soft: #0b0d13;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.065);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);

  --text: #e9ebf2;
  --text-muted: #98a2b3;
  --text-faint: #6c7689;

  --accent: #7c8cff;
  --accent-2: #22d3ee;
  --accent-ink: #0a0b12;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --ring: rgba(124, 140, 255, 0.55);

  --shadow-md: 0 20px 45px -24px rgba(0, 0, 0, 0.85);
  --shadow-lg: 0 40px 80px -40px rgba(0, 0, 0, 0.9);
  --glow: 0 0 0 1px rgba(124, 140, 255, 0.22),
    0 22px 60px -28px rgba(124, 140, 255, 0.7);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --header-h: 64px;
  --shell: 1120px;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --speed: 240ms;
}

:root[data-theme="light"] {
  --bg: #fbfbfe;
  --bg-soft: #f3f4f9;
  --surface: rgba(11, 13, 20, 0.025);
  --surface-2: rgba(11, 13, 20, 0.05);
  --border: rgba(11, 13, 20, 0.09);
  --border-strong: rgba(11, 13, 20, 0.18);

  --text: #12141c;
  --text-muted: #5a6376;
  --text-faint: #7e879a;

  --accent: #4f5fe0;
  --accent-2: #0891b2;
  --accent-ink: #ffffff;
  --accent-soft: rgba(79, 95, 224, 0.1);

  --shadow-md: 0 18px 40px -28px rgba(17, 22, 40, 0.35);
  --shadow-lg: 0 40px 70px -40px rgba(17, 22, 40, 0.35);
  --glow: 0 0 0 1px rgba(79, 95, 224, 0.2),
    0 24px 60px -32px rgba(79, 95, 224, 0.5);
}

/* No JavaScript? Follow the OS preference. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #fbfbfe;
    --bg-soft: #f3f4f9;
    --surface: rgba(11, 13, 20, 0.025);
    --surface-2: rgba(11, 13, 20, 0.05);
    --border: rgba(11, 13, 20, 0.09);
    --border-strong: rgba(11, 13, 20, 0.18);
    --text: #12141c;
    --text-muted: #5a6376;
    --text-faint: #7e879a;
    --accent: #4f5fe0;
    --accent-2: #0891b2;
    --accent-ink: #ffffff;
    --accent-soft: rgba(79, 95, 224, 0.1);
    --shadow-md: 0 18px 40px -28px rgba(17, 22, 40, 0.35);
    --shadow-lg: 0 40px 70px -40px rgba(17, 22, 40, 0.35);
    --glow: 0 0 0 1px rgba(79, 95, 224, 0.2),
      0 24px 60px -32px rgba(79, 95, 224, 0.5);
  }
}

/* -------------------------------------------------------------------------
   2. Base
   ------------------------------------------------------------------------- */
html {
  font-size: 16px;
  min-height: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 20px);
  background: var(--bg);
}

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

/* A very subtle ambient wash — cheap, purely decorative. */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background: radial-gradient(
      42% 60% at 20% 0%,
      color-mix(in srgb, var(--accent) 22%, transparent) 0%,
      transparent 70%
    ),
    radial-gradient(
      40% 55% at 85% 5%,
      color-mix(in srgb, var(--accent-2) 16%, transparent) 0%,
      transparent 70%
    );
  filter: blur(20px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

h1, h2, h3, h4 {
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 0.5em;
}

p { margin: 0 0 1rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--speed) var(--ease);
}

a:hover { color: color-mix(in srgb, var(--accent) 70%, var(--text)); }

code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--accent-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.42em;
}

::selection {
  background: color-mix(in srgb, var(--accent) 45%, transparent);
  color: #fff;
}

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

.skip-link {
  position: fixed;
  left: 50%;
  top: 0.75rem;
  z-index: 80;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 0.9rem;
  font-weight: 600;
  transform: translate(-50%, -180%);
  transition: transform 260ms var(--ease-out);
}
.skip-link:focus { color: var(--accent-ink); transform: translate(-50%, 0); }

.container {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: clamp(1.1rem, 4vw, 2rem);
}

/* Thin, unobtrusive scrollbar (WebKit + Firefox). */
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid transparent;
  border-radius: 99px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-clip: content-box; background-color: var(--text-faint); }

.theme-transition,
.theme-transition * {
  transition: background-color 320ms var(--ease), border-color 320ms var(--ease),
    color 320ms var(--ease) !important;
}

/* Circular theme reveal, used when the View Transitions API is available. */
::view-transition-old(root) { animation: none; z-index: 1; }
::view-transition-new(root) {
  z-index: 2;
  animation: theme-reveal 560ms var(--ease-out) both;
}
@keyframes theme-reveal {
  from { clip-path: circle(0% at var(--tx, 50%) var(--ty, 0%)); }
  to { clip-path: circle(150% at var(--tx, 50%) var(--ty, 0%)); }
}

/* -------------------------------------------------------------------------
   3. Header
   ------------------------------------------------------------------------- */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 60;
  will-change: transform;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  border-bottom: 1px solid transparent;
  transition: background-color var(--speed) var(--ease),
    border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease);
}

.site-header.is-stuck {
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-md);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.01em;
  margin-right: auto;
}
.brand:hover { color: var(--text); }

.brand__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-ink);
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px -12px color-mix(in srgb, var(--accent) 90%, transparent);
  transition: transform var(--speed) var(--ease-out),
    box-shadow var(--speed) var(--ease);
}
.brand:hover .brand__mark {
  transform: rotate(-8deg) scale(1.06);
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--accent) 90%, transparent);
}
.brand:active .brand__mark { transform: scale(0.94); }

.brand__text { white-space: nowrap; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.site-nav__link {
  position: relative;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.93rem;
  font-weight: 500;
  transition: color var(--speed) var(--ease);
}
.site-nav__link:hover { color: var(--text); }

.site-nav__link::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.15rem;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: 50% 50%;
  transition: transform 320ms var(--ease-out);
}
.site-nav__link:hover::after,
.site-nav__link.is-active::after { transform: scaleX(1); }
.site-nav__link.is-active { color: var(--text); }

.site-header__actions { display: flex; align-items: center; gap: 0.4rem; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: transform var(--speed) var(--ease-out),
    border-color var(--speed) var(--ease), background-color var(--speed) var(--ease);
}
.icon-btn:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface-2);
}
.icon-btn:active { transform: translateY(0) scale(0.95); }

.theme-toggle { overflow: hidden; }

.theme-toggle__icon {
  grid-area: 1 / 1;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 420ms var(--ease-out), opacity 240ms var(--ease);
}
.theme-toggle__icon--sun { transform: rotate(0) scale(1); opacity: 1; }
.theme-toggle__icon--moon { transform: rotate(-90deg) scale(0.4); opacity: 0; }

:root[data-theme="light"] .theme-toggle__icon--sun { transform: rotate(90deg) scale(0.4); opacity: 0; }
:root[data-theme="light"] .theme-toggle__icon--moon { transform: rotate(0) scale(1); opacity: 1; }

/* Mobile navigation */
.nav-toggle { display: none; }
.nav-toggle__bars { display: grid; gap: 4px; width: 18px; }
.nav-toggle__bars i {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 300ms var(--ease-out), opacity 200ms var(--ease);
}
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 780px) {
  .nav-toggle { display: grid; order: 3; }
  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: var(--header-h);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0.5rem clamp(1.1rem, 4vw, 2rem) 1rem;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 220ms var(--ease), transform 280ms var(--ease-out),
      visibility 0s linear 280ms;
  }
  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }
  .site-nav__link { padding: 0.75rem 0.2rem; border-radius: 8px; font-size: 1rem; }
  .site-nav__link::after { left: 0.2rem; right: 0.2rem; bottom: 0.35rem; }
}

/* -------------------------------------------------------------------------
   4. Layout primitives
   ------------------------------------------------------------------------- */
.site-main { position: relative; z-index: 1; }

.section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }

.section--tight { padding: clamp(2.25rem, 5vw, 3.25rem) 0; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 0.9rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.section__title { font-size: clamp(1.6rem, 3.6vw, 2.4rem); }
.section__lead { max-width: 58ch; color: var(--text-muted); font-size: 1.05rem; }

.gradient-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* -------------------------------------------------------------------------
   5. Buttons & micro-interactions
   ------------------------------------------------------------------------- */
.btn-glow,
.btn-ghost,
.chip-link {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.72rem 1.15rem;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: transform 200ms var(--ease-out), box-shadow var(--speed) var(--ease),
    border-color var(--speed) var(--ease), background-color var(--speed) var(--ease),
    color var(--speed) var(--ease);
}

.btn-glow {
  color: var(--accent-ink);
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  box-shadow: 0 14px 34px -18px color-mix(in srgb, var(--accent) 95%, transparent);
}
.btn-glow:hover {
  color: var(--accent-ink);
  transform: translateY(-2px);
  box-shadow: 0 20px 42px -16px color-mix(in srgb, var(--accent) 95%, transparent);
}
/* light sweep on hover */
.btn-glow::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    100deg,
    transparent 20%,
    rgba(255, 255, 255, 0.42) 50%,
    transparent 80%
  );
  transform: translateX(-120%);
  transition: transform 620ms var(--ease-out);
}
.btn-glow:hover::after { transform: translateX(120%); }

.btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text);
  transform: translateY(-2px);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-glow:active,
.btn-ghost:active,
.chip-link:active { transform: translateY(0) scale(0.97); }

.btn-glow svg,
.btn-ghost svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 320ms var(--ease-out);
}
.btn-glow:hover svg,
.btn-ghost:hover svg { transform: translateX(3px); }

/* -------------------------------------------------------------------------
   6. Hero
   ------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(3rem, 9vw, 6.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
  overflow: hidden;
}

/* pointer-following spotlight (JS sets --mx / --my) */
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    620px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in srgb, var(--accent) 12%, transparent),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 500ms var(--ease);
}
.hero.is-live::after { opacity: 1; }

.hero__grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 6vw, 4.5rem);
}

.hero__title {
  font-size: clamp(2.1rem, 6.2vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  margin-bottom: 0.9rem;
}

.hero__lead {
  max-width: 46ch;
  color: var(--text-muted);
  font-size: clamp(1.02rem, 1.6vw, 1.15rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.6rem;
}

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  margin: 1.9rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-faint);
  font-size: 0.88rem;
}
.hero__meta li { display: inline-flex; align-items: center; gap: 0.45rem; }
.hero__meta li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2) 18%, transparent);
}

/* Portrait */
.portrait {
  position: relative;
  justify-self: center;
  width: min(330px, 72vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}
/* slow rotating gradient halo */
.portrait::before {
  content: "";
  position: absolute;
  inset: -7%;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    color-mix(in srgb, var(--accent) 70%, transparent) 90deg,
    transparent 180deg,
    color-mix(in srgb, var(--accent-2) 70%, transparent) 270deg,
    transparent 360deg
  );
  filter: blur(14px);
  opacity: 0.75;
  animation: halo-spin 14s linear infinite;
}
@keyframes halo-spin { to { transform: rotate(360deg); } }

.portrait__frame {
  position: relative;
  width: 88%;
  height: 88%;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  box-shadow: var(--shadow-lg);
  animation: float 9s ease-in-out infinite;
  transition: transform 420ms var(--ease-out);
}
.portrait:hover .portrait__frame { transform: scale(1.03); }

.portrait__frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: saturate(1.03) contrast(1.02);
  transition: transform 700ms var(--ease-out);
}
.portrait:hover .portrait__frame img { transform: scale(1.07); }

@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

.portrait__badge {
  position: absolute;
  right: 2%;
  bottom: 8%;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-md);
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  animation: float 9s ease-in-out 1.2s infinite;
}

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex: none;
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: inherit;
  animation: ping 2.2s var(--ease-out) infinite;
}
@keyframes ping {
  0% { transform: scale(1); opacity: 0.7; }
  75%, 100% { transform: scale(2.6); opacity: 0; }
}

@media (max-width: 860px) {
  .hero__grid { grid-template-columns: 1fr; text-align: left; }
  .portrait { order: -1; width: min(240px, 60vw); }
}

/* -------------------------------------------------------------------------
   7. Live strip (clock + weather)
   ------------------------------------------------------------------------- */
.live-strip {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--border);
}

.live-cell {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg-soft);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  transition: background-color var(--speed) var(--ease);
}
.live-cell:hover { background: var(--bg-soft); background: color-mix(in srgb, var(--bg-soft) 92%, var(--surface-2)); }

.live-cell__icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 400ms var(--ease-out);
}
.live-cell:hover .live-cell__icon { transform: translateY(-2px) rotate(-6deg); }

.live-cell__label {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.live-cell__value {
  font-family: var(--font-mono);
  font-size: 1.02rem;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  color: var(--text);
}

/* value swap animation */
.live-cell__value.is-updating { animation: value-in 520ms var(--ease-out); }
@keyframes value-in {
  from { opacity: 0; transform: translateY(6px); filter: blur(3px); }
  to { opacity: 1; transform: none; filter: none; }
}

/* skeleton shimmer while loading */
.is-loading .live-cell__value {
  max-width: 8ch;
  color: transparent;
  border-radius: 6px;
  background: linear-gradient(
    100deg,
    var(--surface) 30%,
    var(--surface-2) 50%,
    var(--surface) 70%
  );
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from { background-position: 140% 0; }
  to { background-position: -40% 0; }
}

@media (max-width: 780px) {
  .live-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* -------------------------------------------------------------------------
   8. Tiles (content cards)
   ------------------------------------------------------------------------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.1rem;
}

.tile {
  position: relative;
  overflow: hidden;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  box-shadow: var(--shadow-md);
  transition: transform 380ms var(--ease-out), border-color var(--speed) var(--ease),
    box-shadow 380ms var(--ease);
}

/* cursor spotlight inside tiles */
.tile::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(
    340px circle at var(--mx, 50%) var(--my, 50%),
    color-mix(in srgb, var(--accent) 16%, transparent),
    transparent 62%
  );
  transition: opacity 400ms var(--ease);
}
.tile:hover::before { opacity: 1; }
.tile:hover {
  transform: translateY(-5px);
  border-color: color-mix(in srgb, var(--accent) 42%, var(--border));
  box-shadow: var(--shadow-lg), var(--glow);
}

.tile__title { font-size: 1.12rem; margin-bottom: 0.4rem; }
.tile__text { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 0; }

.tile__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
}
.tile__link svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 300ms var(--ease-out);
}
.tile__link:hover svg { transform: translateX(4px); }

.tile--spotlight {
  background: linear-gradient(160deg, var(--accent-soft), transparent 60%),
    color-mix(in srgb, var(--bg) 88%, transparent);
}

/* -------------------------------------------------------------------------
   9. Chips / tags
   ------------------------------------------------------------------------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.87rem;
  font-weight: 500;
  transition: transform 220ms var(--ease-out), color var(--speed) var(--ease),
    border-color var(--speed) var(--ease), background-color var(--speed) var(--ease);
}
.chip:hover {
  transform: translateY(-3px);
  color: var(--text);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
}
.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
}

.fact-list {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.fact-list li {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  color: var(--text-muted);
  font-size: 0.96rem;
}
.fact-list strong { color: var(--text); font-weight: 600; min-width: 6.5rem; }

/* -------------------------------------------------------------------------
   10. Timeline (career), education list, social links
   ------------------------------------------------------------------------- */
.timeline {
  position: relative;
  margin: 0;
  padding: 0 0 0 1.75rem;
  list-style: none;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 0.34rem;
  top: 0.6rem;
  bottom: 2rem;
  width: 1px;
  background: linear-gradient(180deg, var(--border-strong), transparent);
}

.timeline__item {
  position: relative;
  padding-bottom: 2rem;
  transition: transform 320ms var(--ease-out);
}
.timeline__item:last-child { padding-bottom: 0; }

.timeline__item::before {
  content: "";
  position: absolute;
  left: -1.75rem;
  top: 0.5rem;
  width: 0.72rem;
  height: 0.72rem;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  transition: background-color 320ms var(--ease), transform 320ms var(--ease-out);
}
.timeline__item:hover { transform: translateX(4px); }
.timeline__item:hover::before { background: var(--accent); transform: scale(1.15); }

.timeline__period {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  color: var(--accent-2);
}

.timeline__role {
  font-size: 1.08rem;
  font-weight: 620;
  margin: 0.25rem 0 0.1rem;
}
.timeline__role .sep {
  color: var(--text-faint);
  font-weight: 400;
}

.timeline__org {
  margin: 0 0 0.6rem;
  font-size: 0.88rem;
  color: var(--text-faint);
}

.timeline__text {
  max-width: 68ch;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.edu-list {
  display: grid;
  gap: 0.9rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.edu-list li {
  padding-top: 0.9rem;
  border-top: 1px solid var(--border);
}
.edu-list li:first-child { padding-top: 0; border-top: 0; }
.edu-list__title {
  display: block;
  color: var(--text);
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.35;
}
.edu-list__meta {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-faint);
  font-size: 0.85rem;
}

.fact-heading {
  margin: 1.7rem 0 0.9rem;
  color: var(--text-faint);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.social {
  display: flex;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.social a {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text-muted);
  transition: transform 260ms var(--ease-out), color var(--speed) var(--ease),
    border-color var(--speed) var(--ease), background-color var(--speed) var(--ease),
    box-shadow var(--speed) var(--ease);
}
.social a:hover {
  color: var(--accent);
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--accent-soft);
  box-shadow: 0 12px 26px -16px color-mix(in srgb, var(--accent) 90%, transparent);
}
.social a:active { transform: translateY(0) scale(0.94); }

.social svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* -------------------------------------------------------------------------
   11. Footer & floating bits
   ------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  z-index: 1;
  margin-top: clamp(2rem, 6vw, 4rem);
  padding: 1.6rem 0;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-soft) 70%, transparent);
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-faint);
}
.site-footer p { margin: 0; }
.site-footer__copy a { color: var(--text-muted); }
.site-footer__copy a:hover { color: var(--accent); }
.site-footer__dot { margin: 0 0.4rem; opacity: 0.6; }

.to-top {
  position: fixed;
  right: clamp(0.9rem, 3vw, 1.6rem);
  bottom: clamp(0.9rem, 3vw, 1.6rem);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.9);
  transition: opacity 260ms var(--ease), transform 320ms var(--ease-out),
    visibility 0s linear 320ms, border-color var(--speed) var(--ease);
  z-index: 55;
}
.to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.to-top:hover { border-color: var(--border-strong); transform: translateY(-3px); }
.to-top svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* -------------------------------------------------------------------------
   12. Reveal on scroll
   ------------------------------------------------------------------------- */
.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 620ms var(--ease-out) var(--d, 0ms),
    transform 720ms var(--ease-out) var(--d, 0ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* Page enter */
.js .site-main { animation: page-in 620ms var(--ease-out) both; }
@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------------------
   13. Utilities & layout helpers
   ------------------------------------------------------------------------- */
.text-muted { color: var(--text-muted) !important; }
.text-sm { font-size: 0.92rem; }
.measure { max-width: 44rem; }

.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }

/* Two-column splits (replaces the grid framework). */
.split {
  display: grid;
  gap: 1.5rem;
  align-items: start;
}
.split > * { min-width: 0; }

@media (min-width: 992px) {
  .split--7-5 {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(1.5rem, 3vw, 3rem);
  }
  .split--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* -------------------------------------------------------------------------
   14. Reduced motion — keep everything, kill the movement
   ------------------------------------------------------------------------- */
@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;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .hero::after { display: none; }
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none !important; }
}

/* -------------------------------------------------------------------------
   15. Print
   ------------------------------------------------------------------------- */
@media print {
  .site-header, .to-top, .scroll-progress, .site-footer { display: none !important; }
  body { background: #fff; color: #000; }
  .js .reveal { opacity: 1; transform: none; }
}
