/* =====================================================================
   shared/theme.css — 통합 디자인 시스템 (디지털 트윈 포트폴리오)
   다크 · 글래스모피즘 · 테크니컬.
   프로젝트별로 :root 또는 [data-theme]에서 --accent 계열만 override 하면
   같은 구조에 다른 컨셉 색을 입힐 수 있다.
   ===================================================================== */

:root {
  color-scheme: dark;

  /* --- Accent (프로젝트별 override 지점) --- */
  --accent:          #4cc9ff;            /* 강조: 시안 (woori 기본) */
  --accent-strong:   #2bb6f0;
  --accent-contrast: #041224;            /* accent 배경 위 글자색 */
  --accent-glow:     rgba(76, 201, 255, .35);
  --accent-ring:     rgba(76, 201, 255, .55);

  /* --- Surfaces --- */
  --bg-0: #0b0f16;
  --bg-1: #0d111a;
  --bg-2: #182132;
  --glass:        rgba(16, 20, 28, .70);
  --glass-solid:  rgba(12, 17, 26, .72);
  --fill-soft:    rgba(255, 255, 255, .08);
  --fill-mid:     rgba(255, 255, 255, .18);
  --fill-strong:  rgba(255, 255, 255, .32);
  --border-soft:  rgba(255, 255, 255, .08);
  --border-mid:   rgba(255, 255, 255, .18);

  /* --- Text --- */
  --text:      #e9eef5;
  --text-dim:  #c8d2e2;
  --text-mute: rgba(255, 255, 255, .68);
  --brand:     #f5f8ff;

  /* --- Type --- */
  --font-sans: 'Plus Jakarta Sans', 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Anton', 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  /* --- Radius --- */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --r-pill: 999px;

  /* --- Elevation --- */
  --shadow-1: 0 18px 40px rgba(0, 0, 0, .38);
  --shadow-accent: 0 10px 24px var(--accent-glow);

  /* --- FX --- */
  --blur: 16px;
}

/* ===================== Base ===================== */
html, body {
  height: 100%;
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(120% 140% at 20% 20%, rgba(37, 53, 82, .6), rgba(10, 12, 18, 1) 70%),
    linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 60%, var(--bg-0) 100%);
  background-attachment: fixed;
}
* { box-sizing: border-box; }

/* ===================== Surfaces ===================== */
.glass-panel {
  background: var(--glass);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-1);
}

/* ===================== Brand ===================== */
.brand-logo {
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--brand);
  font-family: var(--font-display);
  text-transform: uppercase;
  line-height: 1.1;
  font-size: clamp(16px, 3vw, 30px);
  letter-spacing: 1px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}
.brand-sub {
  font-family: var(--font-sans);
  text-transform: none;
  font-weight: 500;
  font-size: .62em;
  letter-spacing: .3px;
  color: var(--accent);
  opacity: .9;
}

/* ===================== Buttons ===================== */
.btn-ghost {
  padding: .45rem 1.1rem;
  border-radius: var(--r-pill);
  border: 1px solid var(--fill-mid);
  background: var(--fill-mid);
  color: var(--brand);
  font-family: var(--font-sans);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.btn-ghost:hover,
.btn-ghost:focus {
  background: var(--fill-strong);
  border-color: rgba(255, 255, 255, .4);
  color: var(--accent-contrast);
}
.btn-ghost:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 .2rem rgba(255, 255, 255, .25);
}

/* ===================== Viewer shell ===================== */
.vwr {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.vwr canvas {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* Toolbar */
.toolbar {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top));
  left: calc(16px + env(safe-area-inset-left));
  right: calc(16px + env(safe-area-inset-right));
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-radius: 22px;
  color: var(--brand);
  z-index: 30;
}
.toolbar .title { display: flex; align-items: center; }
.toolbar .hint { opacity: .82; font-size: .86rem; color: var(--text-dim); }
.toolbar-right { display: flex; align-items: center; gap: 10px; }

/* Back to portfolio link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: .82rem;
  font-weight: 500;
  padding: .4rem .85rem;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.back-link:hover {
  color: var(--brand);
  border-color: var(--fill-mid);
  background: var(--fill-soft);
}

/* Burger */
.burger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--fill-mid);
  background: var(--fill-mid);
  color: #fff;
  border-radius: 8px;
  width: 42px;
  height: 36px;
  cursor: pointer;
}
.burger { position: relative; display: block; width: 18px; height: 2px; background: var(--brand); border-radius: 2px; }
.burger::before, .burger::after {
  content: ""; position: absolute; left: 0; width: 18px; height: 2px;
  background: var(--brand); border-radius: 2px; transition: transform .2s ease;
}
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.burger-btn.is-open .burger { background: transparent; }
.burger-btn.is-open .burger::before { top: 0; transform: rotate(45deg); }
.burger-btn.is-open .burger::after  { top: 0; transform: rotate(-45deg); }

/* Overlay */
.overlay {
  position: fixed; inset: 0;
  background: rgba(4, 8, 14, .55);
  opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
  z-index: 15;
}
.overlay.is-visible { opacity: 1; pointer-events: auto; }

/* Object list (side panel → bottom sheet on mobile) */
.mesh-list {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  top: calc(100px + env(safe-area-inset-top));
  width: 260px;
  max-height: calc(100% - 160px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px 18px;
  border-radius: var(--r-lg);
  color: var(--text);
  overflow: hidden;
  z-index: 20;
}
.mesh-list h4 {
  margin: 0;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .3px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mesh-items {
  margin-top: 10px;
  overflow-y: auto;
  padding-right: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mesh-items::-webkit-scrollbar { width: 6px; }
.mesh-items::-webkit-scrollbar-thumb { background: var(--fill-mid); border-radius: 12px; }
.mesh-item {
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 9px 12px;
  background: var(--fill-soft);
  color: inherit;
  font-family: var(--font-sans);
  font-size: .85rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all .2s ease;
}
.mesh-item:hover:not(:disabled) { background: var(--fill-mid); color: #101420; }
.mesh-item:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
.mesh-item.is-active {
  background: var(--accent);
  border-color: rgba(255, 255, 255, .4);
  color: var(--accent-contrast);
  box-shadow: var(--shadow-accent);
}
.mesh-item:disabled { opacity: .35; cursor: not-allowed; }

/* Info panel */
.panel {
  position: absolute;
  right: 24px;
  top: 100px;
  width: 340px;
  max-width: calc(100% - 48px);
  border-radius: var(--r-lg);
  padding: 22px;
  color: var(--text);
  display: none;
  z-index: 25;
}
.panel h3 { margin: 0 0 .75rem; font-size: 1.1rem; font-weight: 600; letter-spacing: .3px; }
.panel .row {
  display: flex;
  gap: 12px;
  padding: 6px 0;
  font-size: .88rem;
  border-bottom: 1px solid var(--border-soft);
}
.panel .row:last-of-type { border-bottom: 0; }
.panel .row > div:first-child { opacity: .68; min-width: 90px; }
.panel .close { margin-top: 14px; }

/* Status pill */
.status {
  position: absolute;
  left: calc(24px + env(safe-area-inset-left));
  bottom: calc(24px + env(safe-area-inset-bottom));
  padding: 10px 16px;
  border-radius: var(--r-md);
  background: var(--glass-solid);
  border: 1px solid var(--border-soft);
  font-size: .8rem;
  letter-spacing: .25px;
  color: var(--text-dim);
  z-index: 20;
}

/* CSS2D floor label */
.floor-label {
  color: #fff;
  background: rgba(0, 0, 0, .55);
  padding: 2px 8px;
  border-radius: 4px;
  font: 600 12px/1.2 var(--font-sans);
  white-space: nowrap;
  pointer-events: none;
}

/* Mobile notice */
.mobile-notice {
  position: fixed;
  left: 50%;
  top: 16px;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: var(--r-md);
  display: none;
  z-index: 9999;
}
.mobile-notice.is-visible { display: flex; align-items: center; gap: 12px; }
.mobile-notice__text { font-size: .85rem; color: var(--text-dim); }

/* ===================== Responsive ===================== */
@media (max-width: 992px) {
  .toolbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .burger-btn { display: inline-flex; }

  .mesh-list {
    position: fixed;
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(12px + env(safe-area-inset-bottom));
    top: auto;
    width: auto;
    max-height: min(60vh, calc(100vh - 140px - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
    transform: translateY(110%);
    transition: transform .25s ease;
    border-radius: 18px 18px 22px 22px;
    z-index: 30;
  }
  .mesh-list.is-open { transform: translateY(0); }
  .mesh-list .sheet-handle {
    width: 38px; height: 4px; border-radius: var(--r-pill);
    background: rgba(255, 255, 255, .35); margin: 4px auto 8px;
  }

  .panel {
    position: fixed;
    right: 16px; left: 16px; top: auto; bottom: 16px;
    width: auto;
    max-height: calc(100vh - 120px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow: auto;
  }
  .status { left: 16px; right: 16px; bottom: 16px; }
}

@media (max-width: 576px) {
  .toolbar { padding: 10px 14px; border-radius: var(--r-md); }
  .toolbar .hint { display: none; }
  .mesh-list { padding: 10px 12px 14px; border-radius: var(--r-md); }
  .mesh-items { padding-right: 4px; }
  .panel { padding: 16px; border-radius: var(--r-md); }
  .status { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); }
}
