@import url('fonts.css');

/* ── Reset & Variables ──────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Deep forest palette with warm white type and muted blue accents. */
  --bg:            #142c25;
  --panel-bg:      rgba(30, 56, 46, 0.97);
  --panel-border:  rgba(165, 197, 155, 0.22);  /* Accessible warm neutral */
  --accent:        #a5c59b;                    /* Apex forest green */
  --accent-glow:   rgba(165, 197, 155, 0.11);
  --accent-2:      #9fc1d2;                    /* Apex blue */
  --text:          #f3f1e9;
  --text-muted:    #c1cdbf;                    /* Accessible warm neutral */
  --text-dim:      #a9bcad;                    /* Secondary text */
  --green:         #a5c59b;                    /* Apex forest green */
  --ui-font:       'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif:         Georgia, 'Times New Roman', serif;
  --header-h:      56px;
  --panel-w:       272px;
  --radius:        10px;
  --radius-lg:     14px;
  --transition:    0.22s ease;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui-font);
  -webkit-font-smoothing: antialiased;
}

/* ── Loading Screen ─────────────────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}

#loading-screen.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.loading-logo {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: linear-gradient(135deg, #a5c59b 0%, #9fc1d2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 6px;
  box-shadow: 0 0 48px rgba(165, 197, 155, 0.28);
}

.loading-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: normal;
  letter-spacing: 0.04em;
  color: var(--text);
}

.loading-subtitle {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.loading-bar {
  width: 180px;
  height: 2px;
  background: rgba(165, 197, 155, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}

.loading-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a5c59b, #426e82);
  border-radius: 2px;
  transition: width 0.35s ease;
}

.loading-status {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  margin-top: 2px;
}

/* ── App Shell ──────────────────────────────────────────────────────────── */
#app {
  position: fixed;
  inset: 0;
  transition: opacity 0.5s ease;
}

#app.hidden {
  opacity: 0;
  pointer-events: none;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 60%, transparent 40%, rgba(165, 197, 155, 0.10) 100%);
  pointer-events: none;
  z-index: 1;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
#header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  background: linear-gradient(to bottom, rgba(30, 56, 46, 0.96) 0%, transparent 100%);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: linear-gradient(135deg, #a5c59b, #9fc1d2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: bold;
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.brand-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: normal;
  color: var(--text);
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 7px;
}

/* Icon buttons */
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn:hover {
  color: var(--text);
  border-color: rgba(165, 197, 155, 0.4);
  background: var(--accent-glow);
}

.icon-btn[aria-pressed="true"] {
  color: var(--accent);
  border-color: rgba(165, 197, 155, 0.35);
  background: var(--accent-glow);
}

/* ── Info Panel ─────────────────────────────────────────────────────────── */
#info-panel {
  position: absolute;
  top: calc(var(--header-h) + 10px);
  left: 14px;
  width: var(--panel-w);
  z-index: 10;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  max-height: calc(100dvh - var(--header-h) - 90px);
  overflow-y: auto;
  scrollbar-width: none;
  transform-origin: top left;
  transition: opacity var(--transition), transform var(--transition);
}

#info-panel::-webkit-scrollbar { display: none; }

#info-panel.collapsed {
  opacity: 0;
  transform: scale(0.96) translateY(-6px);
  pointer-events: none;
}

.panel-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--panel-border);
}

.panel-section:last-child {
  border-bottom: none;
}

.panel-section h2 {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: normal;
  color: var(--text);
  margin-bottom: 9px;
}

.panel-section h3 {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 11px;
}

.panel-section p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 7px;
}

.panel-section p:last-child { margin-bottom: 0; }

/* Navigation guide */
.nav-guide {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nav-guide li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--text-muted);
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 9px;
  min-width: 88px;
  border-radius: 5px;
  background: rgba(165, 197, 155, 0.05);
  border: 1px solid rgba(165, 197, 155, 0.22);
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
}

/* Status items */
.status-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(165, 197, 155, 0.04);
}

.status-item:last-child { border-bottom: none; }

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.active  { background: #a5c59b; box-shadow: 0 0 7px rgba(165, 197, 155,0.7); }
.status-dot.pending { background: var(--text-dim); }

.status-badge {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.status-badge.available {
  background: rgba(165, 197, 155, 0.12);
  color: #a5c59b;
  border: 1px solid rgba(165, 197, 155, 0.28);
}

.status-badge.soon {
  background: rgba(86, 79, 72, 0.25);
  color: var(--text-dim);
  border: 1px solid rgba(86, 79, 72, 0.35);
}

/* ── Wall Selector ──────────────────────────────────────────────────────── */
#wall-selector {
  position: absolute;
  bottom: 52px;
  right: 16px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 11px 15px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.wall-label {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.wall-buttons {
  display: flex;
  gap: 6px;
}

.wall-btn {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(165, 197, 155, 0.12);
  background: rgba(165, 197, 155, 0.03);
  color: var(--text-dim);
  cursor: not-allowed;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: none;
  user-select: none;
}

.wall-btn:disabled {
  opacity: 0.55;
}

.wall-id {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1;
}

.wall-soon {
  font-size: 8px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.65;
}

/* ── Controls Hint ──────────────────────────────────────────────────────── */
#controls-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 17px;
  background: rgba(30, 56, 46, 0.96);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

#controls-hint.hint-hidden {
  opacity: 0;
}

.sep {
  color: var(--text-dim);
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  :root { --panel-w: calc(100vw - 28px); }

  #info-panel {
    left: 8px;
    max-height: 52vh;
  }

  #wall-selector {
    right: 8px;
    bottom: 54px;
    padding: 9px 12px;
    gap: 8px;
  }

  .wall-btn {
    width: 40px;
    height: 40px;
  }

  #controls-hint {
    font-size: 11px;
    padding: 6px 13px;
    gap: 7px;
    bottom: 16px;
  }
}
/* Handprint close-ups */
.wall-btn:not(:disabled) { color: var(--text); cursor: pointer; transition: background .2s, border-color .2s; }
.wall-btn:not(:disabled):hover, .wall-btn[aria-expanded="true"] { background: rgba(165, 197, 155,.12); border-color: #a5c59b; }
.wall-btn:focus-visible, #panel-dialog button:focus-visible, #panel-zoom:focus-visible { outline: 2px solid #9fc1d2; outline-offset: 4px; }
#panel-dialog { width: min(1280px, 94vw); max-width: 94vw; max-height: 94dvh; margin: auto; padding: 0; border: 1px solid rgba(165, 197, 155,.22); border-radius: 16px; color: #f3f1e9; background: #203c32; box-shadow: 0 24px 100px #000a; overflow: auto; }
#panel-dialog::backdrop { background: rgba(24,39,29,.68); backdrop-filter: blur(7px); }
.panel-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 24px; }
.panel-modal-header h2 { margin: 0; font-size: clamp(18px, 3vw, 25px); }
.panel-modal-eyebrow { margin: 0 0 6px; color: #a5c59b; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
#panel-close { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #a5c59b44; background: #a5c59b0d; color: inherit; font-size: 30px; line-height: 1; cursor: pointer; }
#panel-close:hover { background: #a5c59b20; }
#panel-image-viewport { max-height: 70dvh; overflow: auto; background: #142c25; overscroll-behavior: contain; }
#panel-image { display: block; height: auto; max-width: none; }
#panel-image[hidden] { display: none; }
#panel-image-status { padding: 40px 24px; text-align: center; color: #c1cdbf; }
.panel-modal-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; padding: 16px 24px; color: #c1cdbf; font-size: 13px; }
.panel-modal-footer p { margin: 0; }
.panel-zoom-control { display: flex; align-items: center; gap: 10px; }
#panel-zoom { width: 110px; accent-color: #a5c59b; }
#panel-zoom-value { min-width: 4ch; }
@media (max-width: 640px) { .panel-modal-header { padding: 14px; } .panel-modal-footer { padding: 14px; } #panel-dialog { width: 96vw; max-width: 96vw; } #controls-hint { max-width: 94vw; white-space: normal; flex-wrap: wrap; justify-content: center; } }

/* Keep the viewer and close-up dialog in the same local palette. */
#header { background: rgba(26,50,41,.97); border-bottom: 1px solid var(--panel-border); }
.brand-mark, .loading-logo { background: #a5c59b; }
#info-panel, #wall-selector { box-shadow: 0 4px 20px rgba(42,43,42,.06); }
#panel-image-viewport { background: #28473a; }
#panel-dialog { box-shadow: 0 24px 100px rgba(24,39,29,.28); }
.panel-modal-header { border-bottom: 1px solid var(--panel-border); }
.panel-modal-footer { border-top: 1px solid var(--panel-border); background: #142c25; }

/* Form and navigation controls share the body typeface. */
button, input, select, textarea { font-family: var(--ui-font); }
.wall-id { font-family: var(--ui-font); }

/* Deep forest viewer and close-ups. */
.brand-mark, .loading-logo { background: #365e70; color: #f3f1e9; }
.loading-fill { background: linear-gradient(90deg, #709ba9, #a5c59b); }
#panel-close { background: rgba(165,197,155,.08); border-color: rgba(165,197,155,.3); }
#panel-close:hover { background: rgba(165,197,155,.18); }
