/* ============================================================
   Base tokens
   ============================================================ */
:root {
  --bg:        #000000;
  --fg:        #ffffff;
  --muted:     rgba(255, 255, 255, 0.52);
  --faint:     rgba(255, 255, 255, 0.10);
  --surface:   #0e0e0e;
  --surface-2: #171717;
  --accent:    #0a84ff;

  --grad: linear-gradient(92deg, #ff3ba7 0%, #ff5ad9 38%, #9b6bff 100%);

  --nav-h: 66px;
  --pad-x: 44px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }

::selection { background: #ff3ba7; color: #fff; }

/* ============================================================
   Fixed nav - name left, avatar right
   ============================================================ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--pad-x);
  pointer-events: none;
}
.nav > * { pointer-events: auto; }

.nav__name {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition: opacity 0.25s var(--ease);
}
.nav__name:hover { opacity: 0.65; }

.nav__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--accent);
  background: var(--surface-2);
  transition: transform 0.35s var(--ease);
}
.nav__avatar img { width: 100%; height: 100%; object-fit: cover; }
.nav__avatar:hover { transform: scale(1.08); }

/* ============================================================
   Infinite grid plane (index.html)
   ============================================================ */
.plane {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  overscroll-behavior: none;
}
.plane.is-dragging { cursor: grabbing; }

.plane__layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  will-change: transform;
}

.cell {
  position: absolute;
  top: 0; left: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  will-change: transform, opacity;
  -webkit-user-drag: none;
}
.cell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  transition: transform 0.45s var(--ease), filter 0.45s var(--ease);
}
.plane:not(.is-dragging) .cell:hover img {
  transform: scale(var(--hover-scale, 1.06));
  filter: brightness(1.12);
}

/* tiles ease in on first paint */
.cell--enter { opacity: 0; }
.cell--in {
  opacity: 1;
  transition: opacity 0.7s var(--ease);
}

/* ============================================================
   Centred notice over the grid
   ------------------------------------------------------------
   pointer-events stay off so the grid can still be dragged from
   anywhere on screen, including across the card.
   ============================================================ */
.notice {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

/* settles the grid behind the card so the text always has contrast */
.notice::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 48% 42% at 50% 50%,
              rgba(0, 0, 0, 0.86) 0%,
              rgba(0, 0, 0, 0.55) 52%,
              rgba(0, 0, 0, 0) 80%);
}

.notice__box {
  position: relative;
  max-width: 560px;
  padding: 34px 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  background: rgba(12, 12, 14, 0.72);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: notice-in 0.9s var(--ease) 0.35s both;
}

.notice__text {
  margin: 0;
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: #fff;
}

@keyframes notice-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   Project detail (work.html)
   ============================================================ */
.work {
  display: grid;
  grid-template-columns: 300px 1fr;
  height: 100vh;
  overflow: hidden;
}

.rail {
  height: 100vh;
  overflow-y: auto;
  padding: calc(var(--nav-h) + 12px) 20px 40px var(--pad-x);
  scrollbar-width: thin;
  scrollbar-color: var(--surface-2) transparent;
}
.rail::-webkit-scrollbar { width: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 99px; }

.rail__item {
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  margin-bottom: 16px;
  border: 1px solid var(--faint);
  border-radius: 12px;
  padding: 22px;
  transition: border-color 0.3s var(--ease), transform 0.4s var(--ease);
}
.rail__item img { width: 100%; height: 100%; object-fit: contain; }
.rail__item:hover { border-color: rgba(255,255,255,0.3); transform: translateY(-2px); }
.rail__item.is-active { border-color: rgba(255,255,255,0.45); }

.stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: var(--nav-h) 6vw 120px;
  min-width: 0;
}
.stage__hero {
  max-width: 62vh;
  width: 100%;
  object-fit: contain;
  animation: rise 0.9s var(--ease) both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(26px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.stage__meta {
  position: absolute;
  left: 40px;
  bottom: 52px;
  max-width: 460px;
}
.stage__title {
  margin: 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stage__sub {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.stage__body {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--muted);
}

/* ============================================================
   Profile (me.html)
   ============================================================ */
.me {
  max-width: 560px;
  margin: 0 auto;
  padding: 76px 20px 100px;
  text-align: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border-radius: 99px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.pill:hover { background: #232323; transform: translateY(-1px); }
.pill--primary { background: var(--accent); }
.pill--primary:hover { background: #2b95ff; }

.me__back { position: fixed; top: 26px; left: 50%; transform: translateX(-330px); z-index: 9; }

.me__avatar {
  width: 100px; height: 100px;
  margin: 26px auto 0;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-2);
}
.me__avatar img { width: 100%; height: 100%; object-fit: cover; }

.me__name { margin: 18px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.me__role { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.me__actions { display: flex; gap: 8px; justify-content: center; margin-top: 20px; }

.me__stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 34px;
}
.me__stat b { display: block; font-size: 17px; font-weight: 600; }
.me__stat span { font-size: 12px; color: var(--muted); }

.tabs {
  display: inline-flex;
  gap: 4px;
  margin-top: 34px;
  padding: 5px;
  border-radius: 99px;
  background: var(--surface);
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 99px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}
.tab:hover { color: var(--fg); }
.tab.is-active { background: var(--surface-2); color: var(--fg); }

.panel { margin-top: 34px; text-align: left; }
.panel[hidden] { display: none !important; }

.mosaic { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.mosaic img { aspect-ratio: 1 / 1; object-fit: cover; width: 100%; }

.prose { font-size: 14px; line-height: 1.7; color: var(--muted); }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  padding: 16px 0;
  border-bottom: 1px solid var(--faint);
}
.list b { display: block; font-size: 14px; font-weight: 500; color: var(--fg); }
.list span { font-size: 13px; color: var(--muted); }
.list a:hover { color: var(--fg); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 860px) {
  :root { --pad-x: 20px; }
  .work { grid-template-columns: 1fr; height: auto; overflow: visible; }
  .rail {
    display: flex;
    gap: 12px;
    height: auto;
    overflow-x: auto;
    padding: calc(var(--nav-h) + 10px) var(--pad-x) 10px;
  }
  .rail__item { flex: 0 0 108px; margin: 0; padding: 14px; }
  .stage { padding: 20px var(--pad-x) 40px; }
  .stage__meta { position: static; margin-top: 28px; }
  .me__back { left: 20px; transform: none; }
  .me__stats { gap: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
