@import url('assets/inter.css');

:root {
  color-scheme: light;
  --page: #e9eef5;
  --ink: #202c43;
  --muted: #5e6c80;
  --soft: #697990;
  --accent: #315ac4;
  --glass: rgba(247, 250, 254, .90);
  --drawer: rgba(245, 248, 253, .97);
  --line: rgba(44, 64, 102, .16);
  --wash: rgba(49, 90, 196, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body {
  background: radial-gradient(ellipse at 46% 44%, #fff 0%, var(--page) 74%);
  color: var(--ink);
  font-family: 'Inter', 'Microsoft YaHei', sans-serif;
  isolation: isolate;
  -webkit-text-size-adjust: 100%;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
#canvas-container { position: absolute; inset: 0; z-index: 1; }
#canvas-container canvas { display: block; touch-action: none; outline: none; }
#ui-layer { position: absolute; inset: 0; padding: 32px; pointer-events: none; z-index: 10; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.brand { display: flex; align-items: center; gap: 16px; pointer-events: auto; }
.brand-mark { width: 72px; height: 72px; padding: 9px; background: #fff; border-radius: 50%; object-fit: cover; }
.brand h1 { font-size: 23px; font-weight: 700; letter-spacing: .06em; line-height: 1.4; }
.brand p { font-size: 23px; font-weight: 700; letter-spacing: .14em; margin-top: 8px; }
.brand span { color: var(--soft); font-weight: 300; }
.glass-panel { background: var(--glass); border: 1px solid var(--line); border-radius: 16px; backdrop-filter: blur(12px); }
.instruction { font-size: 12px; line-height: 1.5; letter-spacing: .04em; color: var(--muted); padding: 8px 16px; border-radius: 99px; pointer-events: auto; }
.mobile-instruction, .drawer-backdrop { display: none; }
#details-drawer {
  position: absolute; inset: 0 0 0 auto; width: 38.2%; padding: 48px 32px 28px;
  display: flex; flex-direction: column; pointer-events: auto;
  background: var(--drawer); border-left: 1px solid var(--line);
  backdrop-filter: blur(20px); box-shadow: -20px 0 90px rgba(31, 52, 88, .07);
  transform: translateX(100%); visibility: hidden;
  transition: transform .6s cubic-bezier(.2,.8,.2,1), visibility .6s;
}
#details-drawer.open { transform: translateX(0); visibility: visible; }
.drawer-close {
  position: absolute; top: 32px; right: 32px; width: 40px; height: 40px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--wash); border: 1px solid var(--line); color: var(--ink);
  transition: background .2s;
}
.drawer-close:hover { background: var(--line); }
.drawer-header { margin-top: 48px; flex-shrink: 0; }
.drawer-content { flex: 1; min-height: 0; overflow-y: auto; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .2em; color: var(--accent); margin-bottom: 12px; }
#drawer-title { font-size: clamp(28px, 3vw, 42px); letter-spacing: -.04em; line-height: 1.12; color: var(--accent); margin-bottom: 24px; overflow-wrap: anywhere; }
#drawer-tags { margin-bottom: 24px; }
.tech-tag { display: inline-block; padding: 4px 12px; margin: 0 8px 8px 0; font-size: 13px; line-height: 1.5; border-radius: 99px; color: var(--accent); background: rgba(49,90,196,.065); border: 1px solid rgba(49,90,196,.23); }
#drawer-desc { font-size: 16px; line-height: 1.9; color: var(--muted); margin-bottom: 32px; }
.features-panel { padding: 16px; margin-bottom: 32px; }
.features-panel h3 { font-size: 14px; line-height: 1.5; margin-bottom: 8px; }
#drawer-features { margin: 0; padding-left: 16px; font-size: 14px; line-height: 1.5; color: var(--muted); }
#drawer-features li + li { margin-top: 8px; }
.drawer-footer { padding-top: 24px; border-top: 1px solid var(--line); }
#drawer-link { display: block; width: 100%; padding: 13px 16px; background: var(--accent); color: #fff; border-radius: 10px; font-weight: 700; text-align: center; transition: filter .2s; }
#drawer-link:hover { filter: brightness(1.08); }
#drawer-link[aria-disabled="true"] { background: #dce4f2; color: #66748c; cursor: default; filter: none; }
#drawer-link-note { margin-top: 10px; color: var(--soft); font-size: 12px; text-align: center; }
.project-nav { position: absolute; z-index: 5; left: 32px; bottom: 30px; display: flex; flex-wrap: wrap; gap: 8px; }
.project-nav button { border: 1px solid transparent; color: var(--muted); background: transparent; padding: 9px 11px; border-radius: 9px; font-size: 12px; }
.project-nav button span { color: var(--soft); font-size: 10px; margin-right: 4px; }
.project-nav button:hover, .project-nav button[aria-current="true"] { background: var(--glass); color: var(--accent); border-color: var(--line); }
.stage-caption { position: absolute; bottom: 35px; right: 32px; z-index: 5; font-size: 11px; letter-spacing: .13em; color: var(--soft); }
.site-footer { position: absolute; left: 0; right: 0; bottom: max(8px, env(safe-area-inset-bottom)); z-index: 5; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.5; pointer-events: none; }
.site-footer a { display: inline-block; pointer-events: auto; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
.no-script { position: absolute; z-index: 50; inset: 40% 20% auto; padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 16px; line-height: 1.8; }
.no-script a { color: var(--accent); text-decoration: underline; }
.is-preview .instruction, .is-preview .stage-caption, .is-preview .project-nav { display: none; }
.is-preview #details-drawer { transition: none; }
@media (max-width: 1000px) { .stage-caption { display: none; } .project-nav { max-width: 56%; } }
@media (max-width: 767px), (max-width: 1000px) and (max-height: 500px) {
  body {
    height: 100svh; height: 100dvh;
    --mobile-gutter: 20px;
    --mobile-top: max(24px, env(safe-area-inset-top));
    --mobile-bottom: max(20px, env(safe-area-inset-bottom));
    background: radial-gradient(ellipse at 50% 40%, #fff 0%, var(--page) 78%);
  }
  #ui-layer { padding: var(--mobile-top) max(var(--mobile-gutter), env(safe-area-inset-right)) 0 max(var(--mobile-gutter), env(safe-area-inset-left)); }
  header { display: block; }
  .brand { gap: 12px; }
  .brand-mark { flex: none; width: 52px; height: 52px; padding: 7px; }
  .brand h1 { font-size: clamp(15px, 4.4vw, 19px); letter-spacing: .025em; }
  .brand p { font-size: 19px; margin-top: 4px; }
  #canvas-container { top: calc(var(--mobile-top) + 80px); bottom: calc(var(--mobile-bottom) + 230px); }
  .instruction {
    position: absolute; left: 0; right: 0; bottom: calc(var(--mobile-bottom) + 190px);
    width: fit-content; margin: auto; padding: 8px 14px; font-size: 12px;
    pointer-events: none;
  }
  .desktop-instruction { display: none; }
  .mobile-instruction { display: inline; }
  .project-nav {
    left: max(var(--mobile-gutter), env(safe-area-inset-left));
    right: max(var(--mobile-gutter), env(safe-area-inset-right));
    bottom: calc(var(--mobile-bottom) + 28px); max-width: none;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
  }
  .project-nav button {
    min-height: 68px; min-width: 0; padding: 12px 14px; text-align: left;
    display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px;
    background: var(--glass); border-color: var(--line); border-radius: 16px;
    color: var(--ink); font-size: 13px; font-weight: 500;
    box-shadow: 0 4px 16px rgba(31, 52, 88, .025);
    touch-action: manipulation;
  }
  .project-nav button span { font-size: 10px; font-weight: 500; letter-spacing: .08em; margin: 0; color: var(--accent); }
  .project-nav button:active { background: #dce5f5; }
  .drawer-backdrop {
    display: block; position: absolute; inset: 0; z-index: 8; border: 0; padding: 0;
    background: rgba(26, 41, 68, .24); opacity: 0; visibility: hidden;
    transition: opacity .35s, visibility .35s;
  }
  .drawer-open .drawer-backdrop { opacity: 1; visibility: visible; }
  .drawer-open .instruction { visibility: hidden; }
  #details-drawer {
    inset: auto 0 0; width: 100%; height: min(78%, 640px);
    padding: 24px max(24px, env(safe-area-inset-right)) var(--mobile-bottom) max(24px, env(safe-area-inset-left));
    border: 1px solid var(--line); border-bottom: 0; border-radius: 28px 28px 0 0;
    box-shadow: 0 -12px 60px rgba(31, 52, 88, .12);
    transform: translateY(100%);
    transition: transform .4s cubic-bezier(.2,.8,.2,1), visibility .4s;
  }
  #details-drawer.open { transform: translateY(0); }
  .drawer-close { top: 16px; right: max(20px, env(safe-area-inset-right)); width: 44px; height: 44px; }
  .drawer-header { margin-top: 0; padding: 8px 2px 0; }
  .drawer-content { padding: 0 2px; overscroll-behavior-y: contain; scrollbar-width: thin; }
  .eyebrow { min-height: 28px; margin-right: 48px; margin-bottom: 10px; }
  #drawer-title { font-size: clamp(28px, 8vw, 34px); margin-bottom: 18px; }
  #drawer-tags { margin-bottom: 12px; }
  .tech-tag { font-size: 12px; padding: 4px 10px; }
  #drawer-desc { font-size: 15px; line-height: 1.85; margin-bottom: 20px; }
  .features-panel { margin-bottom: 20px; }
  #drawer-features { line-height: 1.7; }
  .drawer-footer { flex-shrink: 0; padding-top: 16px; }
  #drawer-link { min-height: 48px; padding: 14px 12px; font-size: 14px; border-radius: 14px; }
  #drawer-link-note { line-height: 1.5; }
  .no-script { inset: 25% 20px auto; }
}
@media (max-width: 767px) and (max-height: 620px), (max-width: 1000px) and (max-height: 500px) {
  body { --mobile-top: max(14px, env(safe-area-inset-top)); --mobile-bottom: max(12px, env(safe-area-inset-bottom)); }
  #canvas-container { top: calc(var(--mobile-top) + 64px); bottom: calc(var(--mobile-bottom) + 196px); }
  .project-nav { gap: 8px; }
  .project-nav button { min-height: 56px; padding: 8px 12px; gap: 4px; }
  .instruction { bottom: calc(var(--mobile-bottom) + 160px); font-size: 11px; padding: 6px 12px; }
  #details-drawer { height: calc(100% - var(--mobile-top) - 8px); padding-top: 16px; }
}
@media (max-width: 1000px) and (max-height: 500px) and (orientation: landscape) {
  #canvas-container { top: calc(var(--mobile-top) + 58px); right: 46%; bottom: var(--mobile-bottom); }
  .project-nav { left: 56%; top: 50%; bottom: auto; transform: translateY(-20%); }
  .instruction { left: 56%; right: var(--mobile-gutter); top: calc(50% - 66px); bottom: auto; padding: 6px 8px; font-size: 10px; }
  .project-nav button { font-size: clamp(11px, 1.7vw, 13px); padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; } }
