:root {
  --bg: #f9f9f8;
  --fg: #111113;
  --soft: #5c5c66;
  --muted: #6b6b73;
  --line: #e4e4e2;
  --card: #ffffff;
  --ink-tile: #111113;
  --ink-glyph: #ffffff;

  --blue: #2a6cf6;
  --purple: #9a4cf7;
  --orange: #fa6a1e;
  --green: #1f7a58;
  --indigo: #4f46e5;

  --green-bg: #e3f4e8; --green-fg: #137a3a;
  --blue-bg: #e5eeff;  --blue-fg: #1c5fd8;
  --gray-bg: #ececea;  --gray-fg: #55555c;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e0e10;
  --fg: #f3f3f4;
  --soft: #9a9aa3;
  --muted: #8a8a93;
  --line: #26262b;
  --card: #17171a;
  --ink-tile: #f3f3f4;
  --ink-glyph: #0e0e10;

  --green-bg: #12301f; --green-fg: #5fd68c;
  --blue-bg: #14264a;  --blue-fg: #7fa8ff;
  --gray-bg: #232327;  --gray-fg: #a5a5ad;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s, color .2s;
}

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

.ic {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex: none;
}

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }

.wrap {
  max-width: 744px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  font-size: 13px;
}

.theme-toggle {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--fg);
  cursor: pointer;
}
.theme-toggle .ic { width: 18px; height: 18px; }
.ic-sun { display: none; }
[data-theme="dark"] .ic-moon { display: none; }
[data-theme="dark"] .ic-sun { display: block; }

/* Hero */
.hero {
  padding: 80px 0 64px;
  font-size: clamp(27px, 5.4vw, 40px);
  letter-spacing: -0.035em;
  line-height: 1.2;
  font-weight: 700;
}
.line { margin: 0 0 .52em; font: inherit; }
.line:last-child { margin-bottom: 0; }
.soft { color: var(--soft); font-weight: 500; }

.tiles {
  display: inline-flex; gap: .14em;
  vertical-align: middle;
  margin-left: .1em;
  position: relative; top: -.06em;
}
.tile {
  width: 1.24em; height: 1.24em;
  display: grid; place-items: center;
  border-radius: .3em;
  background: var(--c);
  color: #fff;
  transition: transform .15s;
}
.tile .ic { width: .58em; height: .58em; }
.tile-ink { background: var(--ink-tile); color: var(--ink-glyph); }
a.tile:hover { transform: translateY(-2px); }

.avatar {
  position: relative;
  display: inline-grid; place-items: center;
  width: 1.9em; height: 1.9em;
  margin-left: .1em;
  vertical-align: middle;
  top: -.06em;
  border-radius: 50%;
  border: 2px solid var(--indigo);
  background: var(--gray-bg);
  padding: 3px;
  background-clip: content-box;
  color: var(--soft);
}
.avatar > .ic { width: .8em; height: .8em; stroke-width: 1.6; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar-badge {
  position: absolute; right: -.06em; bottom: -.06em;
  width: .56em; height: .56em;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 0 0 2px var(--bg);
}
.avatar-badge .ic { width: .34em; height: .34em; stroke-width: 2.5; }

/* Sections */
.section {
  border-top: 1px solid var(--line);
  padding: 44px 0 48px;
}
.section-head {
  display: flex; justify-content: space-between;
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 18px;
}

/* Apps */
.apps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.app {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 0;
  border-radius: 14px;
}
.app { position: relative; }
.app-link::after { content: ""; position: absolute; inset: 0; border-radius: 14px; }
.app:hover .app-name { text-decoration: underline; text-underline-offset: 3px; }
.app:hover .chevron { transform: translateX(2px); }
a.badge { position: relative; z-index: 1; transition: filter .15s; }
a.badge:hover { filter: brightness(.94); }
[data-theme="dark"] a.badge:hover { filter: brightness(1.25); }

.app-icon {
  width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
  border-radius: 13px;
  background: var(--c);
  color: #fff;
}
.app-icon .ic { width: 26px; height: 26px; }
.app-icon-empty {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--soft);
}
.app-icon-empty .ic { width: 22px; height: 22px; stroke-width: 1.6; }

.app-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.app-name { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.app-desc { font-size: 14.5px; color: var(--soft); }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-green { background: var(--green-bg); color: var(--green-fg); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue-fg); }
.badge-gray  { background: var(--gray-bg);  color: var(--gray-fg); }

.chevron {
  width: 18px; height: 18px; flex: none;
  color: var(--soft);
  margin-left: 6px;
  transition: transform .15s;
}

/* Links */
.links { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.link {
  display: flex; align-items: center; gap: 10px;
  height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  font-size: 15.5px; font-weight: 500;
  transition: border-color .15s, transform .15s;
}
.link .ic { width: 19px; height: 19px; }
.link .arrow { width: 13px; height: 13px; margin-left: auto; margin-right: 18%; color: var(--soft); }
.link:hover { border-color: var(--soft); transform: translateY(-1px); }

/* Footer */
.foot {
  display: flex; justify-content: space-between; gap: 8px;
  border-top: 1px solid var(--line);
  padding: 28px 0 48px;
  font-size: 12px;
}

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

/* Mobile */
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .top { padding: 10px 0; }
  .hero { padding: 40px 0 44px; }
  .line { margin-bottom: .75em; }
  .tiles { gap: .18em; }
  .chevron { display: none; }
  .section { padding: 28px 0 32px; }
  .links { grid-template-columns: 1fr 1fr; }
  .link .arrow { margin-right: 22%; }
  .foot { flex-direction: column; gap: 12px; padding-top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Real app icons (images) fill their tile */
.tile img, .app-icon img {
  width: 100%; height: 100%;
  display: block;
  border-radius: inherit;
  object-fit: cover;
}
.app-icon:has(img) { overflow: hidden; }

/* Theme-specific images */
.only-dark { display: none !important; }
[data-theme="dark"] .only-dark { display: block !important; }
[data-theme="dark"] .only-light { display: none !important; }
[data-theme="dark"] .tile:has(img),
[data-theme="dark"] .app-icon:has(img) { box-shadow: 0 0 0 1px rgba(255,255,255,.1); }

/* ---------- Icon motion ---------- */
:root { --spring: cubic-bezier(.34, 1.56, .64, 1); }

.tile, .app-icon {
  --glow: rgba(0,0,0,.35);
  transition: transform .45s var(--spring), box-shadow .3s ease;
  will-change: transform;
}
.tile-ink { --glow: rgba(0,0,0,.4); }
[data-theme="dark"] .tile-ink { --glow: rgba(255,255,255,.25); }

/* 1. Pop in on load, one after another */
.tiles .tile {
  animation: pop-in .7s var(--spring) backwards;
  animation-delay: calc(150ms + var(--i, 0) * 70ms);
}
/* App list icons pop in when scrolled into view (JS adds .in-view) */
.js .apps .app-icon:not(.in-view) { opacity: 0; scale: .5; }
.js .apps .app-icon.in-view {
  animation: pop-in .7s var(--spring) backwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}
@keyframes pop-in {
  from { opacity: 0; scale: .4; rotate: -12deg; }
}

/* 2. Idle wave across the hero icons every few seconds */
.hero .tile {
  animation: pop-in .7s var(--spring) backwards, wave 7s ease-in-out 3;
  animation-delay: calc(150ms + var(--i, 0) * 70ms), calc(2.5s + var(--i, 0) * 90ms);
}
@keyframes wave {
  0%, 10%, 100% { translate: 0 0; }
  4%  { translate: 0 -7px; }
  7%  { translate: 0 1px; }
}

/* 3. Hover: lift, tilt, glow (pointer devices only) */
@media (hover: hover) {
  .tile:hover, a.tile:hover {
    transform: translateY(-5px) rotate(-7deg) scale(1.1);
    box-shadow: 0 12px 26px -8px var(--glow);
  }
  .tile:nth-child(even):hover { transform: translateY(-5px) rotate(7deg) scale(1.1); }
  .app:hover .app-icon {
    transform: translateY(-3px) rotate(-5deg) scale(1.06);
    box-shadow: 0 10px 22px -8px var(--glow);
  }
  .avatar:hover .avatar-badge { transform: rotate(90deg) scale(1.15); }
  .avatar:hover img { transform: scale(1.06); }
}
.avatar img { transition: transform .45s var(--spring); }
.avatar-badge { transition: transform .45s var(--spring); }

/* 4. Tap / click squish runs via the Web Animations API in script.js */

@media (prefers-reduced-motion: reduce) {
  .tile, .app-icon, .hero .tile, .tiles .tile, .apps .app-icon { animation: none !important; }
  .js .apps .app-icon:not(.in-view) { opacity: 1; scale: 1; }
}

/* ---------- Brand social tiles ---------- */
.tile-brand .ic { width: .6em; height: .6em; }
.tile-youtube { background: #ff0033; color: #fff; }
.tile-youtube .ic { width: .95em; height: .95em; }
.tile-tiktok { background: #000; color: #fff; }
.tile-tiktok .ic { width: .54em; height: .54em; filter: drop-shadow(-1.5px -1px 0 #25f4ee) drop-shadow(1.5px 1px 0 #fe2c55); }
.tile-x { background: #000; color: #fff; --glow: rgba(0,0,0,.45); }
.tile-x .ic { width: .5em; height: .5em; }
[data-theme="dark"] .tile-tiktok,
[data-theme="dark"] .tile-x { box-shadow: 0 0 0 1px rgba(255,255,255,.14); --glow: rgba(255,255,255,.25); }

/* Elsewhere: two links */
.links { grid-template-columns: repeat(2, 1fr); }
.link .ic:first-child { width: 17px; height: 17px; }
.link .arrow { margin-right: 4px; }
.section-head .handle { text-transform: none; letter-spacing: .04em; }

/* "Coming soon" bubble for not-yet-live socials */
[data-tip] { position: relative; }
span[data-tip] { cursor: default; }
[data-tip]::after { z-index: 2; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 10px); left: 50%;
  translate: -50% 4px;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--fg); color: var(--bg);
  font: 500 11px/1 var(--mono);
  letter-spacing: .02em;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity .15s, translate .25s var(--spring);
}
[data-tip]:focus-visible::after, [data-tip].show-tip::after {
  opacity: 1; translate: -50% 0;
}
@media (hover: hover) { [data-tip]:hover::after { opacity: 1; translate: -50% 0; } }

/* Jump to data projects from the hero */
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
#data { scroll-margin-top: 24px; }
#data:target .section-head span:first-child { animation: flash 1.6s ease .3s; }
@keyframes flash {
  0%, 100% { color: var(--muted); }
  25%, 60% { color: #6366f1; }
}

/* Keep the last word of each hero line attached to its icons */
.glue { white-space: nowrap; }

/* ---------- Touch devices: press + peek instead of hover ---------- */
@media (hover: none) {
  /* iOS-style press: sink while the finger is down, spring back on release */
  .tile:active { transform: scale(.88); transition-duration: .12s; }
  .app { padding: 10px; margin: 0 -10px; transition: background-color .2s; -webkit-tap-highlight-color: transparent; }
  .app:active { background: var(--gray-bg); }
  .app:active .app-icon { transform: scale(.92); transition-duration: .12s; }
  a.badge:active { filter: brightness(.9); }
  .link:active { transform: scale(.97); }
  .tile, .link, .avatar { -webkit-tap-highlight-color: transparent; }
}
/* First tap on a hero icon = peek: lift, glow, show its name */
.tile.peek {
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 12px 26px -8px var(--glow);
}
.tile.peek:nth-child(even) { transform: translateY(-5px) rotate(6deg) scale(1.1); }
.tile.peek:nth-child(odd)  { transform: translateY(-5px) rotate(-6deg) scale(1.1); }

/* Tilt direction per icon; labels counter-rotate so they stay level */
.tile { --tilt: -7deg; }
.tile:nth-child(even) { --tilt: 7deg; }
@media (hover: hover) {
  .tile:hover, a.tile:hover, .tile:nth-child(even):hover {
    --tilt-now: var(--tilt);
    transform: translateY(-5px) rotate(var(--tilt)) scale(1.1);
  }
}
.tile.peek, .tile.peek:nth-child(even), .tile.peek:nth-child(odd) {
  --tilt-now: var(--tilt);
  transform: translateY(-5px) rotate(var(--tilt)) scale(1.1);
}
[data-tip]::after { rotate: calc(var(--tilt-now, 0deg) * -1); }

/* Once someone interacts, the idle wave stops for good (no dancing while tapping) */
.calm .hero .tile { translate: none !important; }

/* Never let anything widen the page (prevents iOS zoom-out / empty right edge) */
html, body { overflow-x: clip; }

/* Last icon of each row: right-align its label so it stays on screen */
.tiles > [data-tip]:last-child::after { left: auto; right: 0; translate: 0 4px; }
.tiles > [data-tip]:last-child:focus-visible::after,
.tiles > [data-tip]:last-child.show-tip::after { translate: 0 0; }
@media (hover: hover) { .tiles > [data-tip]:last-child:hover::after { translate: 0 0; } }
