/* ---------- Theme tokens ---------- */
:root {
  --bg-top: #f8f8f8;
  --bg-bottom: #e8e8e8;
  --text: #111;
  --text-2: #444;
  --muted: #888;
  --line: #d4d4d4;
  --card: rgba(255, 255, 255, 0.45);
  --card-border: #fff;
  --card-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
  --avatar: linear-gradient(160deg, #e9e9e9, #d2d2d2);
  --win: #fbfbfb;
  --win-bar: #f1f1f1;
  --soft: #efefef;
  --scrim: rgba(20, 20, 20, 0.25);
  --link-line: #b9b9b9;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg-top: #161616;
  --bg-bottom: #0c0c0c;
  --text: #f1f1f1;
  --text-2: #c4c4c4;
  --muted: #8a8a8a;
  --line: #333;
  --card: rgba(255, 255, 255, 0.05);
  --card-border: rgba(255, 255, 255, 0.09);
  --card-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  --avatar: linear-gradient(160deg, #2c2c2c, #1d1d1d);
  --win: #1b1b1b;
  --win-bar: #232323;
  --soft: #262626;
  --scrim: rgba(0, 0, 0, 0.55);
  --link-line: #555;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%) fixed;
  background-color: var(--bg-bottom);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: color .35s ease, background-color .35s ease;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }

/* ---------- Top pill (sticky on every view) ---------- */
.pill {
  position: sticky; top: 16px; z-index: 30;
  margin-top: 40px;
  background: color-mix(in srgb, var(--bg-top) 70%, transparent);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  font-size: 18px;
  color: var(--text-2);
  backdrop-filter: blur(8px);
}
.pill-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 16px;
  border-radius: 999px;
  transition: background .2s ease, color .2s ease;
}
.pill-btn:hover { background: var(--soft); }
.pill-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pill-btn svg.solid { fill: currentColor; stroke: none; width: 14px; height: 14px; }
.i-moon { display: none; }
.i-pause { display: none; }
.playing .i-play { display: none; }
.playing .i-pause { display: block; }
.player { display: flex; align-items: center; position: relative; }
.player::after { content: ""; position: absolute; right: 0; top: 9px; bottom: 9px; width: 1px; background: var(--line); }
.player::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 1px; background: var(--line); }
.track {
  width: 0; height: 4px; border-radius: 4px; background: var(--line);
  overflow: hidden; opacity: 0; cursor: pointer;
  transition: width .45s cubic-bezier(.2,.8,.2,1), opacity .3s ease, margin .45s ease;
}
.player.open .track { width: 110px; opacity: 1; margin-right: 14px; }
.track-fill { height: 100%; width: 0; background: var(--text); border-radius: 4px; }

[data-theme="dark"] .i-sun { display: none; }
[data-theme="dark"] .i-moon { display: block; }
.pill-btn:focus-visible, .app:focus-visible, .light:focus-visible, .btn:focus-visible { outline: 2px solid #2a8cff; outline-offset: 2px; }

/* ---------- Hero ---------- */
.hero { text-align: center; margin-top: 12vh; padding: 0 16px; }
.avatar {
  width: 120px; height: 120px; margin: 0 auto;
  border-radius: 50%;
  background: var(--avatar);
  background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.name { margin-top: 18px; font-size: 18px; color: var(--text-2); }
h1 {
  margin-top: 48px;
  font-weight: 400;
  font-size: clamp(34px, 5vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.02em;
}
h1 svg { width: 0.8em; height: 0.8em; vertical-align: -0.06em; margin: 0 0.08em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
h1 .word { display: inline-block; }

/* Entrance + showreel intro animation */
.reveal { opacity: 0; transform: translateY(14px); animation: rise .8s cubic-bezier(.2,.7,.2,1) forwards; }
@keyframes rise { to { opacity: 1; transform: none; } }

/* ---------- Dock ---------- */
.dock {
  margin: auto 0 50px;
  padding-top: 40px;
  display: flex;
  align-items: stretch;
  gap: 20px;
}
.group {
  display: flex; flex-direction: column; align-items: center;
  padding: 14px 12px 16px;
  background: var(--card);
  border: 1.5px solid var(--card-border);
  border-radius: 26px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.group-title {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}
.apps { display: flex; gap: 6px; }
.app {
  width: 76px;
  display: flex; flex-direction: column; align-items: center;
  text-decoration: none; color: var(--text-2);
  cursor: pointer;
}
.tile {
  width: 64px; height: 64px; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: transform .22s cubic-bezier(.3,.7,.3,1.3);
  transform-origin: 50% 100%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.tile svg { width: 32px; height: 32px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile.dark-icon svg { stroke: #111; }
[data-theme="dark"] .tile { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12); }
.tile .glyph { color: #fff; font-weight: 600; font-size: 28px; letter-spacing: -0.03em; }
.app span.label { display: block; margin-top: 8px; font-size: 13px; white-space: nowrap; }
.app:active .tile { transform: scale(.92); }
.app.bounce .tile { animation: bounce .6s ease; }
@keyframes bounce { 0%,100% { transform: none; } 35% { transform: translateY(-14px); } 65% { transform: translateY(-4px); } }

/* ---------- Views ---------- */
.view { width: 100%; display: flex; flex-direction: column; align-items: center; flex: 1; }
.view[hidden] { display: none; }
.view.enter { animation: viewIn .45s cubic-bezier(.2,.7,.2,1) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Skills (tags that pop around the hero) ---------- */
.hero { position: relative; }
h1 .skills-btn {
  display: inline-flex; vertical-align: -0.06em; margin: 0 0.08em;
  border-radius: 12px; padding: 0.02em; transition: transform .25s ease, background .2s ease;
}
h1 .skills-btn:hover { background: var(--soft); transform: rotate(-6deg); }
h1 .skills-btn svg { margin: 0; }
.skills { position: absolute; top: -40px; bottom: -40px; left: 50%; width: min(1180px, calc(100vw - 32px)); transform: translateX(-50%); pointer-events: none; z-index: 2; }
.tag {
  position: absolute; display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  color: var(--tag-ink); background: var(--tag-bg);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
  opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(0deg);
  transition: opacity .35s ease, transform .55s cubic-bezier(.3,1.4,.4,1);
  pointer-events: auto; cursor: default;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.skills.show .tag { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(var(--r)); }
.tag:hover { transform: translate(-50%, -50%) scale(1.08) rotate(0deg) !important; }

/* ---------- Pages (about + company) ---------- */
.page-wrap { width: min(640px, calc(100% - 32px)); margin: 0 auto; padding: 56px 0 80px; }
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 14px 0 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-2); font-size: 14px; text-decoration: none;
  transition: background .2s ease;
}
.back-btn:hover { background: var(--soft); }
.back-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.center { display: flex; justify-content: center; }

/* Company page */
.co-head { text-align: center; margin-top: 36px; }
.co-logo { max-width: 220px; max-height: 90px; margin: 0 auto; display: block; }
.co-name { font-size: clamp(44px, 8vw, 72px); font-weight: 600; letter-spacing: -0.04em; line-height: 1; }
.co-mark { width: 84px; height: 84px; border-radius: 22px; margin: 0 auto 18px; }
.co-mark svg { width: 42px; height: 42px; }
.chip-role {
  display: inline-block; margin-top: 20px; padding: 7px 14px; border-radius: 999px;
  background: var(--soft); font-size: 14px; color: var(--text-2);
}
.co-period { margin-top: 12px; font-size: 14px; color: var(--muted); }
.co-text { margin-top: 28px; text-align: center; }
.co-text p { font-size: 18px; line-height: 1.55; color: var(--text-2); }
.co-text p + p { margin-top: 18px; }
.media { width: min(960px, calc(100vw - 32px)); margin: 56px auto 0; display: grid; gap: 24px; }
.media > * {
  width: 100%; border-radius: 14px; overflow: hidden; display: block;
  background: var(--soft); box-shadow: var(--card-shadow);
}
.media video, .media img { width: 100%; display: block; }
.media iframe { width: 100%; aspect-ratio: 16/9; border: 0; display: block; }
.media .ph {
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; border: 1px dashed var(--line); box-shadow: none; background: transparent;
}
.page-foot { margin-top: 48px; }

/* About page */
.about { margin-top: 12px; font-size: 18px; line-height: 1.6; color: var(--text); }
.about p { min-height: 1.6em; }
.about p + p { margin-top: 20px; }
.about a {
  color: inherit; text-decoration: none;
  border-bottom: 1px solid var(--link-line); transition: border-color .2s ease;
}
.about a:hover { border-color: var(--text); }
.caret { display: inline-block; width: 2px; height: 1.1em; vertical-align: -0.18em; background: var(--text); margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.about-hint { margin-top: 32px; font-size: 13px; color: var(--muted); }

/* ---------- Phone ---------- */
@media (max-width: 700px) {
  .pill { margin-top: 28px; font-size: 16px; }
  .pill-btn { height: 32px; padding: 0 14px; }
  .hero { margin-top: 70px; }
  .avatar { width: 100px; height: 100px; }
  .name { font-size: 17px; }
  h1 { margin-top: 40px; font-size: min(8.2vw, 36px); }

  .dock {
    margin: 50px 16px 60px; padding-top: 0;
    flex-direction: column; align-items: stretch; gap: 28px;
    width: calc(100% - 32px); max-width: 360px;
  }
  .contact { order: -1; }
  .group { box-shadow: none; border-width: 1px; border-radius: 22px; padding: 14px 8px 18px; }
  .apps { flex-wrap: wrap; justify-content: center; gap: 20px 0; width: 100%; }
  .app { width: 33.33%; }
  .tile { width: 62px; height: 62px; }
  .app span.label { margin-top: 7px; }

  .contact { align-self: center; padding: 10px 12px 12px; border-radius: 18px; }
  .contact .group-title { margin-bottom: 10px; }
  .contact .apps { flex-wrap: nowrap; gap: 0; }
  .contact .app { width: 72px; }
  .contact .tile { width: 46px; height: 46px; border-radius: 12px; }
  .contact .tile svg { width: 22px; height: 22px; }
  .contact .app span.label { font-size: 12px; margin-top: 5px; }

  .pill { top: 10px; }
  .player.open .track { width: 70px; margin-right: 10px; }
  /* phone: tags wrap into a neat cluster under the headline */
  .skills {
    position: static; transform: none; width: auto; pointer-events: auto;
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 6px;
    max-height: 0; overflow: hidden; padding: 0 4px;
    transition: max-height .5s ease, margin .5s ease;
  }
  .skills.show { max-height: 320px; margin-top: 26px; overflow: visible; }
  .tag { position: static; transform: scale(.3) rotate(0deg); }
  .skills.show .tag { transform: scale(1) rotate(var(--r)); }
  .tag:hover { transform: scale(1.05) !important; }
  .tag { font-size: 12px; padding: 6px 11px; }
  .page-wrap { padding-top: 40px; }
  .co-text p, .about { font-size: 16px; }
  .media { margin-top: 40px; gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
