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

:root {
  --text: #000;
  --text-on-dark: #fff;
  --text-muted: #828282;
  --ease-damp: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-close: cubic-bezier(0.4, 0, 0.68, 0.36);
  --dur-nav-frame: 0.26s;
  --dur-content: 0.26s;
}

html {
  font-size: 16px;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
}

html, body {
  width: 100%; height: 100%;
  font-family: -apple-system, "SF Pro Display", BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.page { width: 100%; height: 100%; position: relative; background: #fff; overflow: hidden; }

@keyframes frameNavOpen {
  from { opacity: 0; transform: scale(0.88); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes frameNavClose {
  from { opacity: 1; transform: scale(1); }
  to   { opacity: 0; transform: scale(0.88); }
}
@keyframes subContentLine {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@supports (view-transition-name: none) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.14s;
    animation-timing-function: var(--ease-damp);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page--frame-center.subpage-active .frame,
  .page--frame-close.subpage-active .frame,
  .page--frame-close.subpage-active .sub-scroll,
  .page--frame-close.subpage-active .expand-btn { animation: none !important; }
  .page.subpage-active:not(.expanded) .frame,
  .page.subpage-active.expanded .frame,
  .page.subpage-active:not(.expanded) .sub-scroll,
  .page.subpage-active.expanded .sub-scroll,
  .page.subpage-active:not(.expanded) .expand-btn,
  .page.subpage-active.expanded .expand-btn { transition: none !important; }
  .sub-content--anim > * { animation: none !important; }
}

/* ══ Home layout ══ */
.home-content {
  width: 640px; margin: 0 auto;
  padding: 72px 0;
  display: flex; flex-direction: column; gap: 48px;
}
.home-content.home-content--entered > * { animation: none !important; opacity: 1; transform: translateY(0); }

/* Staggered reveal */
.sub-content--anim > *,
.home-content.sub-content--anim > * { animation: subContentLine var(--dur-content) var(--ease-damp) both; }

/* Nav is identical across pages — keep it static, only animate content below */
.home-content.sub-content--anim > .home-nav { animation: none !important; opacity: 1 !important; transform: translateY(0) !important; }
.sub-content--anim > *:nth-child(1),  .home-content.sub-content--anim > *:nth-child(1)  { animation-delay: 0.02s; }
.sub-content--anim > *:nth-child(2),  .home-content.sub-content--anim > *:nth-child(2)  { animation-delay: 0.04s; }
.sub-content--anim > *:nth-child(3),  .home-content.sub-content--anim > *:nth-child(3)  { animation-delay: 0.06s; }
.sub-content--anim > *:nth-child(4),  .home-content.sub-content--anim > *:nth-child(4)  { animation-delay: 0.08s; }
.sub-content--anim > *:nth-child(5),  .home-content.sub-content--anim > *:nth-child(5)  { animation-delay: 0.1s; }
.sub-content--anim > *:nth-child(6),  .home-content.sub-content--anim > *:nth-child(6)  { animation-delay: 0.12s; }
.sub-content--anim > *:nth-child(7),  .home-content.sub-content--anim > *:nth-child(7)  { animation-delay: 0.14s; }
.sub-content--anim > *:nth-child(8),  .home-content.sub-content--anim > *:nth-child(8)  { animation-delay: 0.16s; }
.sub-content--anim > *:nth-child(9),  .home-content.sub-content--anim > *:nth-child(9)  { animation-delay: 0.18s; }
.sub-content--anim > *:nth-child(10), .home-content.sub-content--anim > *:nth-child(10) { animation-delay: 0.2s;  }
.sub-content--anim > *:nth-child(11), .home-content.sub-content--anim > *:nth-child(11) { animation-delay: 0.22s; }
.sub-content--anim > *:nth-child(12), .home-content.sub-content--anim > *:nth-child(12) { animation-delay: 0.24s; }
.sub-content--anim > *:nth-child(13), .home-content.sub-content--anim > *:nth-child(13) { animation-delay: 0.26s; }
.sub-content--anim > *:nth-child(14), .home-content.sub-content--anim > *:nth-child(14) { animation-delay: 0.28s; }
.sub-content--anim > *:nth-child(15), .home-content.sub-content--anim > *:nth-child(15) { animation-delay: 0.3s; }

/* ══ Nav ══ */
.home-nav { display: flex; justify-content: space-between; align-items: flex-start; }
.home-nav-left { display: flex; align-items: center; gap: 8px; cursor: pointer; transition: opacity 0.15s ease-out; }
.home-nav-left:hover { opacity: 0.7; }
.home-nav-avatar { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; display: block; flex-shrink: 0; }
.avatar-wrap { position: relative; flex-shrink: 0; }
.avatar-tooltip {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #000; color: #fff;
  font-size: 12px; font-weight: 500;
  padding: 3px 7px; border-radius: 4px;
  white-space: nowrap; pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease-out;
}
.home-nav-left:hover .avatar-tooltip { opacity: 1; }
.home-nav-identity { display: flex; flex-direction: column; gap: 6px; }
.home-pname { color: var(--text); }
.home-updated { color: var(--text-muted); }
.home-nav-right { display: flex; align-items: center; }
.home-nav-links { position: relative; display: flex; gap: 2px; background: #F6F6F6; padding: 3px; border-radius: 8px; }
.nav-pill {
  position: absolute; pointer-events: none;
  background: rgba(232, 232, 232, 0.5); border-radius: 5px;
  transition:
    left   0.22s cubic-bezier(0.33, 1, 0.68, 1),
    top    0.22s cubic-bezier(0.33, 1, 0.68, 1),
    width  0.22s cubic-bezier(0.33, 1, 0.68, 1),
    height 0.22s cubic-bezier(0.33, 1, 0.68, 1);
}
.home-nav-link {
  position: relative; z-index: 1;
  padding: 5px 10px; border-radius: 5px;
  color: var(--text-muted); text-decoration: none; cursor: pointer;
  font-family: inherit; font-size: inherit; font-weight: inherit; border: none; background: transparent;
  transition: color 0.15s cubic-bezier(0.33, 1, 0.68, 1);
}
.home-nav-link:hover { color: var(--text); }
.home-nav-link.active { color: var(--text); }

.home-bio { color: var(--text-muted); line-height: 1.6; }

/* ══ Cards ══ */
.home-card { cursor: pointer; display: flex; flex-direction: column; }
.home-thumb-wrap {
  width: 640px; background: #080808;
  border-radius: 20px; padding: 16px 16px 0 16px;
  display: flex; flex-direction: column; overflow: hidden;
}
.home-thumb { width: 608px; border-radius: 12px; object-fit: cover; display: block; transition: opacity 0.2s ease-out; }
.home-card:hover .home-thumb { opacity: 0.88; }
.home-card-labels { padding: 14px 0 16px 0; display: flex; flex-direction: column; gap: 4px; }
.home-ctitle { color: var(--text-on-dark); }
.home-csub   { color: var(--text-muted); }

.home-footer { display: flex; gap: 24px; }
.home-footer a { color: var(--text-muted); text-decoration: none; transition: color 0.15s ease-out; }
.home-footer a:hover { color: var(--text); }

/* ══ Subpage frame ══ */
.frame {
  position: absolute;
  top: 56px; bottom: 56px;
  left: calc(50% - 376px); right: calc(50% - 376px);
  border-radius: 20px; background: #080808;
  pointer-events: none; display: none;
  transform-origin: center center;
}
.subpage-active .frame { display: block; }
.page.subpage-active:not(.expanded) .frame {
  transition:
    top var(--dur-nav-frame) var(--ease-close), bottom var(--dur-nav-frame) var(--ease-close),
    left var(--dur-nav-frame) var(--ease-close), right var(--dur-nav-frame) var(--ease-close),
    border-radius var(--dur-nav-frame) var(--ease-close);
}
.page.subpage-active.expanded .frame {
  transition:
    top var(--dur-nav-frame) var(--ease-damp), bottom var(--dur-nav-frame) var(--ease-damp),
    left var(--dur-nav-frame) var(--ease-damp), right var(--dur-nav-frame) var(--ease-damp),
    border-radius var(--dur-nav-frame) var(--ease-damp);
}
@media (min-width: 753px) {
  .page--frame-center.subpage-active .frame         { animation: frameNavOpen  var(--dur-nav-frame) var(--ease-damp)  both; }
  .page--frame-close.subpage-active  .frame         { animation: frameNavClose var(--dur-nav-frame) var(--ease-close) both; }
  .page--frame-close.subpage-active  .sub-scroll    { animation: frameNavClose var(--dur-nav-frame) var(--ease-close) both; }
  .page--frame-close.subpage-active  .expand-btn    { animation: frameNavClose var(--dur-nav-frame) var(--ease-close) both; }
}
.page.expanded .frame { top: 0; bottom: 0; left: 0; right: 0; border-radius: 0; }

/* ══ Sub-scroll ══ */
.sub-scroll {
  position: absolute;
  top: 56px; bottom: 56px;
  left: calc(50% - 376px); width: 752px;
  overflow-y: auto; overflow-x: hidden;
  clip-path: inset(0 round 20px);
  display: none;
  transform-origin: center center;
  scrollbar-width: thin; scrollbar-color: #252525 transparent;
}
.page.subpage-active:not(.expanded) .sub-scroll {
  transition:
    top var(--dur-nav-frame) var(--ease-close), bottom var(--dur-nav-frame) var(--ease-close),
    clip-path var(--dur-nav-frame) var(--ease-close);
}
.page.subpage-active.expanded .sub-scroll {
  transition:
    top var(--dur-nav-frame) var(--ease-damp), bottom var(--dur-nav-frame) var(--ease-damp),
    clip-path var(--dur-nav-frame) var(--ease-damp);
}
.subpage-active .sub-scroll { display: block; }
.page.expanded .sub-scroll { top: 0; bottom: 0; clip-path: inset(0 round 0px); }
.sub-scroll::-webkit-scrollbar { width: 4px; }
.sub-scroll::-webkit-scrollbar-thumb { background: #252525; border-radius: 2px; }

.sub-content { width: 640px; margin: 0 auto; padding: 56px 0; color: var(--text-on-dark); }

/* ══ Expand btn ══ */
.expand-btn {
  position: absolute; top: calc(56px + 20px); right: calc(50% - 376px + 20px);
  z-index: 10; background: #272727; border: none; border-radius: 4px;
  cursor: pointer; padding: 4px 8px;
  display: none; align-items: center; justify-content: center;
  color: var(--text-muted); font-family: inherit;
  transition: background 0.15s ease-out, color 0.15s ease-out;
}
.page.subpage-active:not(.expanded) .expand-btn {
  transition:
    background 0.15s ease-out, color 0.15s ease-out,
    top var(--dur-nav-frame) var(--ease-close), right var(--dur-nav-frame) var(--ease-close);
}
.page.subpage-active.expanded .expand-btn {
  transition:
    background 0.15s ease-out, color 0.15s ease-out,
    top var(--dur-nav-frame) var(--ease-damp), right var(--dur-nav-frame) var(--ease-damp);
}
.subpage-active .expand-btn { display: flex; }
.page.expanded .expand-btn { top: 20px; right: 20px; }
.expand-btn:hover { background: #333; color: var(--text-on-dark); }
.expand-btn svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ══ Back btn ══ */
.back-btn {
  display: flex; align-items: center; gap: 10px;
  color: var(--text-on-dark); cursor: pointer;
  margin-bottom: 48px; width: fit-content; transition: opacity 0.2s ease-out;
}
.back-btn:hover { opacity: 0.55; }
.back-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.cs-brand-logo { display: block; width: 32px; height: 23px; margin-bottom: 32px; }

.coming-soon { height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }

.pg { display: none; }
.pg.active { display: block; }

/* ══ Mobile ══ */
@media (max-width: 752px) {
  html, body { overflow: auto; background: #fff; }
  .page { overflow: visible; height: auto; min-height: 100%; }
  .frame { display: none !important; }
  .expand-btn { display: none !important; }
  .home-content { width: 100%; padding: 48px 20px; gap: 32px; }
  .home-thumb-wrap { width: 100%; }
  .home-thumb { width: 100%; }
  .sub-scroll {
    position: static !important; width: 100% !important;
    height: auto !important; clip-path: none !important;
    overflow: visible !important; display: block !important;
    background: #080808;
  }
  .sub-content { width: 100%; padding: 40px 20px; }
  .coming-soon { height: 50vh; }
  .subpage-active { background: #080808 !important; }
}

@media (max-width: 480px) {
  .home-nav-identity { display: none; }
}
