/*
  styles.css
  - Glassmorphic UI and responsive layout for the 3D Visualizer
  - Keep styles modular and document important rules for maintainability
*/

:root {
  --bg: #0b0f15; /* app background */
  --glass-bg: rgba(255,255,255,0.06); /* panel background */
  --accent: #cec004; /* highlight */
  --muted: #9fb4ff;
  --ui-space: 96px; /* reserved space at bottom for control pill menu */
  --header-space: 84px; /* approximate fixed header height */
}

/* Base layout */
html, body {
  height: 100%;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  background: linear-gradient(180deg, #07101a 0%, #0b0f15 100%);
  color: #e6eef8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Full-viewport app container */
body {
  width: 100%;
  height: 100vh;
  display: block;
  overflow: hidden; /* viewer handles its own scrolling */
}

/* Viewer wrapper ensures the model area is centered and scales nicely */
.viewer-wrapper {
  /* place the viewer area between header and bottom controls
     use top/bottom offsets so inner elements can size with 100% height */
  position: absolute;
  top: var(--header-space);
  left: 0;
  right: 0;
  bottom: 0;
  padding-bottom: var(--ui-space);
  display: block;
}

/* Header: glassmorphic panel that sits above the viewer */
.header {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 16px;
  z-index: 40;
  width: calc(100% - 32px);
  max-width: 1200px;
  border-radius: 14px;
  background: var(--glass-bg);
  box-shadow: 0 8px 24px rgba(2,6,23,0.6);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Inner header content layout */
.header .header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  justify-content: space-between;
}

/* Logo sizing and accessible layout */
#logo {
  height: 56px; /* optimized for header */
  width: auto;
  display: block;
}

.site-title {
  color: #e6eef8;
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
}

/* Small descriptive text beside title */
.site-subtitle {
  color: rgba(230,238,248,0.7);
  font-size: 0.85rem;
  margin-left: 8px;
}

/* model-viewer fills remaining area and keeps aspect */
model-viewer {
  width: 100%;
  height: 100%; /* fill the viewer-wrapper which already accounts for top/bottom space */
  display: block;
}

/* UI control panel (glass) - bottom horizontal pill menu
   - placed at bottom center to avoid covering the main model area
   - horizontally scrollable on very small screens for accessibility */
#ui {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  padding: 8px 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  box-shadow: 0 10px 30px rgba(2,6,23,0.55);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  max-width: calc(100% - 48px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Buttons: tactile glass buttons */
button {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.06);
  color: #e6eef8;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  flex: 0 0 auto;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(2,6,23,0.5);
}

.selected {
  color: var(--bg);
  background: linear-gradient(90deg, var(--accent), #ffd84d);
  border: none;
}

/* removed description panel - controls are compact and ARIA-enabled */

/* Responsive adjustments */
@media (max-width: 900px) {
  .header { width: calc(100% - 24px); padding: 10px 12px; }
  /* #ui { left: 12px; top: 90px; width: 190px; } */
  #logo { height: 44px; }
}

@media (max-width: 600px) {
  :root { --ui-space: 110px; }
  /* Mobile: keep bottom pill, but make buttons slightly larger and allow scrolling */
  /* #ui {
    left: 50%;
    bottom: 14px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 720px;
    padding: 10px;
    gap: 10px;
  } */

  .header { top: 10px; }
}

@media (max-width: 420px) {
  /* hide the inline description to keep pill compact on very small screens */
  #description { display: none; }
}

/* Utility: visually hidden (for accessibility messages) */
.sr-only { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }
