/* Athena Deck: 3D tasarım taslağı */

/* ---------- Yazı tipleri (pakette, dışarıya istek yok) ---------- */
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-ext-500-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-500-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap;
  src: url(../fonts/ibm-plex-sans-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Marcellus'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/marcellus-latin-ext-400-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Marcellus'; font-style: normal; font-weight: 400; font-display: swap;
  src: url(../fonts/marcellus-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tasarım değişkenleri ---------- */
:root {
  color-scheme: dark light;
  --font-ui: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Marcellus', 'Iowan Old Style', Georgia, serif;

  /* Ege gecesi, mermer, bronz, zeytin */
  --bg: #161d24;
  --panel: rgba(27, 35, 43, 0.86);
  --ink: #e6e3dc;
  --ink-2: #a3aca6;
  --ink-3: #7e8882;
  --line: rgba(230, 227, 220, 0.11);
  --line-strong: rgba(230, 227, 220, 0.22);
  --accent: #c9a15a;
  --accent-soft: rgba(201, 161, 90, 0.15);
  --olive: #8d9566;
  --seg-bg: rgba(230, 227, 220, 0.06);
  --seg-on: rgba(230, 227, 220, 0.13);
  --tip-bg: #e6e3dc;
  --tip-ink: #161d24;
  --shadow: 0 10px 30px rgba(4, 8, 12, 0.35);

  --scene-bg: #161d24;
  --scene-floor: 201, 161, 90;
  --scene-floor-alpha: 0.07;
  --scene-shadow: 0.38;

  --gap: 20px;
  --toolbar-h: 58px;
  --side-w: 272px;
  --drawer-w: 344px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #e3e6e0;
    --panel: rgba(243, 245, 240, 0.9);
    --ink: #1d242b;
    --ink-2: #4f5a56;
    --ink-3: #6c7671;
    --line: rgba(29, 36, 43, 0.12);
    --line-strong: rgba(29, 36, 43, 0.24);
    --accent: #7a5c22;
    --accent-soft: rgba(122, 92, 34, 0.12);
    --olive: #5c6440;
    --seg-bg: rgba(29, 36, 43, 0.05);
    --seg-on: #ffffff;
    --tip-bg: #1d242b;
    --tip-ink: #eef0eb;
    --shadow: 0 10px 30px rgba(29, 36, 43, 0.12);

    --scene-bg: #e3e6e0;
    --scene-floor: 255, 255, 255;
    --scene-floor-alpha: 0.6;
    --scene-shadow: 0.2;
  }
}

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--font-ui);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, p, dl, dd { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage { position: fixed; inset: 0; touch-action: none; }
.stage canvas { display: block; width: 100%; height: 100%; }

/* ---------- Başlık ---------- */
.brand {
  position: fixed;
  top: calc(18px + var(--safe-t));
  left: calc(24px + var(--safe-l));
  pointer-events: none;
  max-width: min(64ch, calc(100vw - 48px));
}
.brand h1 {
  font: 400 30px/1.05 var(--font-display);
  letter-spacing: 0.01em;
}
.brand-sub { margin-top: 6px; color: var(--ink-2); font-size: 13px; }
.brand-dims { margin-top: 2px; color: var(--ink-3); font-size: 12.5px; }

/* ---------- Paneller ---------- */
.panel, .index {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.icon-btn {
  flex: none;
  width: 30px;
  height: 30px;
  margin: -4px -6px 0 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: 22px;
  line-height: 1;
}
.icon-btn:hover { background: var(--seg-bg); color: var(--ink); }

/* ---------- Parça listesi ---------- */
.index {
  position: fixed;
  top: calc(122px + var(--safe-t));
  bottom: calc(var(--toolbar-h) + 34px + var(--safe-b));
  left: calc(var(--gap) + var(--safe-l));
  width: var(--side-w);
  display: flex;
  flex-direction: column;
  border-radius: 12px;
  overflow: hidden;
}
.index-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); }
.index-head h2 { font: 400 19px/1.2 var(--font-display); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 12px;
}
.legend > span { display: inline-flex; align-items: center; gap: 6px; }

.part-list { overflow-y: auto; padding: 4px 8px 14px; scrollbar-width: thin; }
.group h3 {
  margin: 14px 8px 4px;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}
.part {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.35;
}
.part:hover { background: var(--seg-bg); }
.part[aria-current='true'] { background: var(--accent-soft); color: var(--ink); }
.part[aria-current='true'] .part-name { font-weight: 500; }
.part-missing { color: var(--ink-3); cursor: default; }
.part-missing small { display: block; font-size: 11.5px; }

.dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--olive);
}
.dot-in { background: transparent; box-shadow: inset 0 0 0 1.5px var(--olive); }
.dot-off { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); opacity: 0.6; }
.part[aria-current='true'] .dot { background: var(--accent); box-shadow: none; }

/* ---------- Bilgi çekmecesi ---------- */
.drawer {
  position: fixed;
  top: calc(var(--gap) + var(--safe-t));
  right: calc(var(--gap) + var(--safe-r));
  width: var(--drawer-w);
  max-height: calc(100dvh - var(--toolbar-h) - 60px - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
  padding: 18px 20px 20px;
  border-radius: 12px;
}
.drawer-name { font: 400 22px/1.2 var(--font-display); }
.drawer-meta { margin-top: 6px; color: var(--ink-3); font-size: 12.5px; }
.drawer-what { margin-top: 12px; font-size: 15px; line-height: 1.55; max-width: 60ch; }
.facts { margin-top: 14px; border-top: 1px solid var(--line); }
.facts dt { margin-top: 10px; color: var(--ink-3); font-size: 12px; }
.facts dd { margin-top: 1px; font-size: 14px; }
.btn {
  margin-top: 16px;
  padding: 8px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: transparent;
  font-weight: 500;
  font-size: 13.5px;
}
.btn:hover { border-color: var(--accent); }

/* ---------- Güneş ve pil ---------- */
.energy {
  position: fixed;
  right: calc(var(--gap) + var(--safe-r));
  bottom: calc(var(--toolbar-h) + 34px + var(--safe-b));
  width: var(--drawer-w);
  max-height: calc(100dvh - var(--toolbar-h) - 60px - var(--safe-t) - var(--safe-b));
  overflow-y: auto;
  padding: 16px 20px 18px;
  border-radius: 12px;
}
.energy h2 { font: 400 20px/1.2 var(--font-display); }
.orient { margin-top: 4px; color: var(--ink-3); font-size: 12.5px; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.presets button {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 12.5px;
}
.presets button:hover { border-color: var(--accent); }
.range { display: block; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.range span { display: flex; justify-content: space-between; gap: 8px; }
.range output { color: var(--ink); }
.range input { width: 100%; margin: 6px 0 0; accent-color: var(--accent); }

.faces { margin-top: 14px; display: grid; gap: 6px; }
.face-row {
  display: grid;
  grid-template-columns: 44px 1fr 62px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.face-name { color: var(--ink-2); }
.bar { height: 6px; border-radius: 3px; background: var(--seg-bg); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width 0.25s ease; }
.face-w { text-align: right; }
.total {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
}
.total strong { font-weight: 600; }
.fine { margin-top: 6px; color: var(--ink-3); font-size: 11.5px; line-height: 1.4; }
.battery {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 5px 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
}
.battery dt { color: var(--ink-2); }
.battery dd { text-align: right; }

body.has-drawer .energy { right: calc(var(--gap) * 1.6 + var(--drawer-w) + var(--safe-r)); }

/* ---------- Araç çubuğu ---------- */
.toolbar {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 24px);
  min-height: var(--toolbar-h);
  padding: 7px;
  overflow-x: auto;
  scrollbar-width: none;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(16px) saturate(1.1);
  backdrop-filter: blur(16px) saturate(1.1);
}
.toolbar::-webkit-scrollbar { display: none; }
.seg {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 9px;
  background: var(--seg-bg);
}
.seg-label { padding: 0 6px 0 8px; color: var(--ink-3); font-size: 12px; }
.seg button, .tb-btn {
  flex: none;
  padding: 7px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap;
}
.seg button:hover, .tb-btn:hover { color: var(--ink); }
.seg button[aria-pressed='true'], .tb-btn[aria-pressed='true'] {
  background: var(--seg-on);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--accent-soft), inset 0 -2px 0 var(--accent);
}
.tb-btn { padding: 10px 12px; }
.tb-quiet { color: var(--ink-3); }
.tb-index { display: none; }

/* ---------- Küçük öğeler ---------- */
.tooltip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--tip-bg);
  color: var(--tip-ink);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
}
.tooltip small { display: block; font-weight: 400; opacity: 0.75; font-size: 11.5px; }

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(var(--toolbar-h) + 40px + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  color: var(--ink-2);
  font-size: 13px;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.hint.is-gone { opacity: 0; }
body.has-drawer .hint, body.has-energy .hint { opacity: 0; }

.loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: var(--bg);
  color: var(--ink-2);
  font: 400 18px var(--font-display);
  transition: opacity 0.7s ease, visibility 0.7s;
}
body.is-ready .loading { opacity: 0; visibility: hidden; }

.fatal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 40;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100vw - 32px));
  padding: 20px 22px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
}
[hidden] { display: none !important; }

/* ---------- Orta genişlik ---------- */
@media (max-width: 1180px) {
  :root { --side-w: 236px; --drawer-w: 316px; }
  body.has-drawer .energy { right: calc(var(--gap) + var(--safe-r)); }
  body.has-drawer.has-energy .drawer { max-height: 38dvh; }
}

/* ---------- Telefon ---------- */
@media (max-width: 760px) {
  :root { --gap: 10px; --toolbar-h: 52px; }
  body { font-size: 14px; }
  .brand { top: calc(12px + var(--safe-t)); left: calc(16px + var(--safe-l)); }
  .brand h1 { font-size: 24px; }
  .brand-dims { display: none; }
  .brand { transition: opacity 0.3s ease; }
  body.has-drawer .brand, body.has-energy .brand, body.index-open .brand { opacity: 0; }

  .index {
    top: auto;
    left: var(--gap);
    right: var(--gap);
    width: auto;
    height: min(62dvh, 520px);
    bottom: calc(var(--toolbar-h) + 26px + var(--safe-b));
    transform: translateY(calc(100% + var(--toolbar-h) + 60px));
    transition: transform 0.35s ease;
    z-index: 12;
  }
  body.index-open .index { transform: none; }

  .drawer, .energy {
    top: auto;
    left: var(--gap);
    right: var(--gap);
    width: auto;
    bottom: calc(var(--toolbar-h) + 26px + var(--safe-b));
    max-height: 48dvh;
    z-index: 11;
  }
  body.has-drawer .energy { right: var(--gap); }
  body.has-drawer.has-energy .energy { display: none; }

  .toolbar {
    left: var(--gap);
    right: var(--gap);
    transform: none;
    max-width: none;
    bottom: calc(10px + var(--safe-b));
  }
  .tb-index { display: block; }
  .tb-index[aria-expanded='true'] { background: var(--seg-on); color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
  .seg-label { padding: 0 4px 0 6px; font-size: 11px; }
  .tb-quiet { display: none; }
  .hint { bottom: calc(var(--toolbar-h) + 30px + var(--safe-b)); font-size: 12.5px; }
}

/* ---------- Hareket hassasiyeti ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
