/* Device frame and screen geometry. The screen holds a strict portrait aspect ratio
   driven by the selected Fairphone model. */

.stage-controls {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  background: rgba(20, 20, 22, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  backdrop-filter: blur(6px);
}

.stage-controls-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

.stage-controls-label {
  font-size: var(--fs-caption);
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.stage-controls-hint {
  font-size: var(--fs-caption);
  color: var(--text-faint);
  line-height: 1.35;
  margin: 0;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: var(--fs-caption);
  padding: 5px 12px;
  border-radius: var(--r-pill);
  line-height: 1;
}

.segmented button[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-on);
}

/* Phone body */
.device {
  --ar: 1224 / 2700;
  position: relative;
  display: grid;
  place-items: center;
}

.device[data-frame="on"] {
  padding: 14px;
  border-radius: 44px;
  background: linear-gradient(160deg, #3a3a40, #202024 60%, #141416);
  box-shadow:
    var(--elev-3),
    inset 0 0 0 2px rgba(255, 255, 255, 0.04),
    inset 0 0 0 8px #0c0c0e;
}

.device[data-frame="off"] {
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.device-screen {
  position: relative;
  height: clamp(652px, calc(100vh - 190px), 662px);
  width: auto;
  max-width: calc(100vw - 40px);
  aspect-ratio: var(--ar);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-radius: 30px;
}

.device[data-frame="off"] .device-screen {
  border-radius: 14px;
  box-shadow: var(--elev-2), 0 0 0 1px var(--border);
}

.notch {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 5;
}

.notch-cut {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 26px;
  background: #05050a;
  border-radius: 0 0 14px 14px;
  display: none;
}

.camera {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #05050a;
  box-shadow: inset 0 0 0 1.5px #1c1c26, inset 0 0 3px rgba(80, 120, 200, 0.4);
}

/* The Fairphone 4 carries a teardrop cut. The 5 and 6 dropped it for a punch hole. */
.device[data-notch="teardrop"] .notch-cut { display: block; }
.device[data-notch="teardrop"] .notch { height: 26px; }
.device[data-notch="punch"] .camera { box-shadow: inset 0 0 0 1.5px #23232c, inset 0 0 3px rgba(80, 120, 200, 0.4), 0 0 0 2px var(--bg); }

.device[data-frame="off"] .notch { display: none; }

/* Hardware side buttons */
.device-buttons {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

.device-buttons-left { left: -3px; top: 128px; }
.device-buttons-right { right: -3px; top: 150px; }

.device[data-frame="off"] .device-buttons { display: none; }

.hw-btn {
  border: 0;
  background: #2c2c31;
  box-shadow: var(--elev-1), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  display: grid;
  place-items: center;
}

.hw-vol-up, .hw-vol-down {
  width: 8px;
  height: 46px;
  border-radius: 4px 0 0 4px;
}

.hw-power {
  width: 8px;
  height: 66px;
  border-radius: 0 4px 4px 0;
}

.hw-btn:active { background: var(--accent); color: var(--accent-on); }
.hw-glyph { font-size: 10px; line-height: 1; opacity: 0; }

/* Status bar at the very top of the screen */
.statusbar {
  flex: 0 0 auto;
  height: 26px;
  padding: 0 14px 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-status);
  color: var(--text-dim);
  background: var(--bg-status);
}

.statusbar-center { color: var(--text-faint); letter-spacing: 0.06em; text-transform: uppercase; font-size: 10px; }
.statusbar-right { display: inline-flex; gap: 8px; align-items: center; }
.statusbar-mode { color: var(--accent-bright); font-family: var(--font-mono); font-size: 10px; }

/* Header bar, Adwaita style */
.headerbar {
  flex: 0 0 auto;
  height: 48px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
}

.headerbar-title {
  flex: 1 1 auto;
  font-size: var(--fs-title);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.headerbar-back, .headerbar-action {
  min-width: 40px;
  height: 34px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
  padding: 0 10px;
  font-size: var(--fs-body);
}

.headerbar-action { color: var(--accent-bright); font-weight: 600; }
.headerbar-back:hover, .headerbar-action:hover { background: var(--state-hover); }
.headerbar-back[hidden], .headerbar-action[hidden] { display: none; }

/* Scrollable content area */
.viewport {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.viewport::-webkit-scrollbar { width: 6px; }
.viewport::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

@media (max-width: 380px) {
  .stage { padding: var(--sp-2); }
  .device[data-frame="on"] { padding: 10px; border-radius: 34px; }
}

/* Phone access: drop the stage chrome and fill the display. */
body.mobile .stage { padding: 0; gap: 0; min-height: 100vh; min-height: 100dvh; justify-content: flex-start; }
body.mobile .stage-controls { display: none; }
body.mobile .device,
body.mobile .device[data-frame="on"],
body.mobile .device[data-frame="off"] {
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  width: 100%;
  height: 100vh;
  height: 100dvh;
}
body.mobile .device-buttons { display: none; }
body.mobile .notch { display: none; }
body.mobile .device-screen {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  box-shadow: none;
}
