/*
 * Furemu photo-frame flow — layout-only styles for the 4:3 Android panel.
 *
 * Colors, radii, and type come from furemu.css tokens so the frame mocks
 * stay consistent with the shipped FuremuButton/FuremuCard primitives.
 * The frame is an Android 8 kiosk app that plays assigned content on
 * motion; tapping reveals the HUD, whose gear opens the settings menu.
 * There is no phone status bar, tab bar, or browser chrome on the device.
 */

/* ============================================================= *
 * Full-bleed content surface (motion-detected playback)
 * ============================================================= */
.frame-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgb(15 12 10 / 0.55) 0%, rgb(15 12 10 / 0) 26%),
    linear-gradient(to top, rgb(15 12 10 / 0.4) 0%, rgb(15 12 10 / 0) 22%);
}

/* Video playback surface: a 3:4 clip on a black canvas, scaled to the
   panel height and centred horizontally so the letterbox bars are even. */
.frame-video {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.frame-video video {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}

/* Clock, connection icon, and settings gear revealed by tapping playback. */
.frame-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 30px 42px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  color: #fff;
  pointer-events: none;
}

.frame-hud__clock {
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 12px rgb(0 0 0 / 0.4);
}

.frame-hud__date {
  display: block;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 500;
  opacity: 0.85;
}

.frame-hud__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0.92;
  text-shadow: 0 2px 10px rgb(0 0 0 / 0.4);
}

.frame-hud__status svg {
  width: 20px;
  height: 20px;
}

.frame-hud__actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.frame-hud__settings {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  pointer-events: auto;
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / 0.45));
}

.frame-hud__settings:hover {
  color: rgb(255 255 255 / 0.76);
}

.frame-hud__settings:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.frame-hud__settings svg {
  width: 22px;
  height: 22px;
}

/* ============================================================= *
 * Centered status surface (empty / offline / signed-out)
 * ============================================================= */
.frame-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 130px;
  text-align: center;
  color: #fff;
}

.frame-center--onDark {
  background: #141110;
}

.frame-center__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
}

.frame-center__icon svg {
  width: 34px;
  height: 34px;
}

/* Success checkmark gets a subtle ring so it reads as a badge on the
   light wizard canvas. */
.frame-center__icon--success {
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
}

.frame-center h2 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.frame-center p {
  margin: 0;
  max-width: 620px;
  font-size: 17px;
  line-height: 1.55;
  opacity: 0.86;
}

/* A soft top banner for transient states (offline playback). */
.frame-banner {
  position: absolute;
  top: 26px;
  left: 50%;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: var(--radius-full);
  background: rgb(20 17 15 / 0.7);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

.frame-banner svg {
  width: 18px;
  height: 18px;
}

/* ============================================================= *
 * First-run wizard (light, on the warm-paper canvas)
 * ============================================================= */
.frame-wizard {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--background);
}

.frame-wizard__inner {
  width: 100%;
  max-width: 540px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  text-align: center;
}

.frame-mark {
  font-family: var(--font-mark);
  font-size: 66px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--text);
}

.frame-wizard h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.frame-wizard p.sub {
  margin: 0;
  max-width: 460px;
  font-size: 17px;
  line-height: 1.5;
  color: var(--textMuted);
}

.frame-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.frame-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

/* Small progress dots for the wizard (welcome → wifi → sign-in). */
.frame-steps {
  display: flex;
  gap: 8px;
}

.frame-steps i {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--borderColorHover);
}

.frame-steps i.on {
  width: 26px;
  border-radius: 4px;
  background: var(--brand);
}

/* Back affordance for wizard/panel screens. */
.frame-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
}

.frame-back svg {
  width: 18px;
  height: 18px;
}

/* ============================================================= *
 * One-time-code entry (sign in on the frame)
 * ============================================================= */
.frame-otp {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.frame-otp span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 76px;
  border: 1px solid var(--borderColor);
  border-radius: var(--radius-md);
  background: var(--surface1);
  font-size: 34px;
  font-weight: 600;
  color: var(--text);
}

.frame-otp span.empty {
  border-color: var(--borderColor);
  background: var(--surface1);
}

.frame-otp span.active {
  border-color: var(--borderColorFocus);
}

/* ============================================================= *
 * Wi-Fi network picker (shared by setup and settings)
 * ============================================================= */
.frame-net-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.frame-net {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
}

.frame-net.on {
  background: var(--brandMuted);
}

button.frame-net {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

button.frame-net:hover,
button.frame-net:focus-visible {
  background: var(--surface3);
}

button.frame-net.on:hover,
button.frame-net.on:focus-visible {
  background: var(--brandMuted);
}

.frame-net svg.lead {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--textMuted);
}

.frame-net .name {
  font-weight: 600;
}

.frame-net .spacer {
  flex: 1 1 auto;
}

.frame-net .lock {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  color: var(--textMuted);
}

.frame-net .check {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--success);
}

/* A spinner for the connecting step. */
.frame-spinner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 5px solid var(--surface3);
  border-top-color: var(--brand);
  animation: frame-spin 0.9s linear infinite;
}

@keyframes frame-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================= *
 * Settings overlay — scrim over playing content + right panel.
 * Tap the panel's row to open a sub-screen; tap outside to close.
 * ============================================================= */
.frame-settings-scrim {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgb(20 17 15 / 0.45);
  backdrop-filter: blur(6px);
}

.frame-settings-hint {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 41;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.85;
  text-shadow: 0 2px 10px rgb(0 0 0 / 0.5);
}

.frame-panel {
  position: absolute;
  top: 40px;
  right: 40px;
  z-index: 41;
  box-sizing: border-box;
  width: 420px;
  max-height: calc(100% - 80px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: var(--surface1);
  box-shadow: 0 30px 70px -30px rgb(0 0 0 / 0.6);
}

.frame-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 10px;
}

.frame-panel__head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.frame-panel__scroll {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: none;
}

.frame-panel__scroll::-webkit-scrollbar {
  display: none;
}

.frame-set-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
}

.frame-set-row.on {
  background: var(--surface3);
}

.frame-set-row svg.lead {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  color: var(--textMuted);
}

.frame-set-row .val {
  margin-left: auto;
  font-size: 14px;
  font-weight: 500;
  color: var(--textMuted);
}

.frame-set-row svg.chev {
  flex: 0 0 auto;
  /* Pin a chevron-only row's chevron to the trailing edge. On a row that also has a
     value, the value's own margin-left: auto takes the free space instead, keeping the
     value immediately left of the chevron (see the sibling reset below). */
  margin-left: auto;
  width: 18px;
  height: 18px;
  color: var(--textMuted);
}

/* A value already absorbs the free space, so its chevron stays adjacent, not split. */
.frame-set-row .val + svg.chev {
  margin-left: 0;
}

.frame-set-row--danger {
  color: var(--danger);
}

.frame-set-row--danger svg.lead {
  color: var(--danger);
}

.frame-sep {
  flex: 0 0 auto;
  height: 1px;
  margin: 6px 8px;
  background: var(--borderColor);
}

.frame-note {
  margin: 0;
  padding: 0 6px 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--textMuted);
}

/* ============================================================= *
 * Brightness slider
 * ============================================================= */
.frame-auto-brightness {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--borderColor);
  border-radius: var(--radius-md);
  background: var(--surface2);
  color: var(--text);
  text-align: left;
  white-space: normal;
}

.frame-auto-brightness strong {
  display: block;
  font-size: 16px;
}

.frame-auto-brightness small {
  display: block;
  margin-top: 4px;
  color: var(--textMuted);
  font-size: 13px;
  line-height: 1.4;
}

.frame-auto-brightness[aria-checked='false'] .m-switch {
  background: var(--surface3);
  border-color: var(--borderColor);
}

.frame-auto-brightness:focus-visible,
.frame-bright__range:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}

.frame-bright__range {
  width: 100%;
  height: 44px;
  margin: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.frame-bright__range:disabled {
  opacity: 0.4;
  cursor: default;
}

.frame-bright {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 8px 4px;
}

.frame-bright__value {
  text-align: center;
  font-size: 16px;
  font-weight: 700;
}

.frame-slider {
  position: relative;
  height: 44px;
  display: flex;
  align-items: center;
}

.frame-slider__track {
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--surface3);
}

.frame-slider__fill {
  position: absolute;
  left: 0;
  height: 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, #5c3328 0%, #8a4c33 100%);
}

.frame-slider__knob {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--borderColor);
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.2);
  transform: translateX(-50%);
}

.frame-bright__labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--textMuted);
}

.frame-bright__labels svg {
  width: 20px;
  height: 20px;
}

/* ============================================================= *
 * Android system information
 * ============================================================= */
.frame-about {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.frame-about .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 6px;
  border-bottom: 1px solid var(--borderColor);
  font-size: 15px;
}

.frame-about .row:last-child {
  border-bottom: 0;
}

.frame-about dt {
  color: var(--textMuted);
  font-weight: 500;
}

.frame-about dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

/* ============================================================= *
 * Factory-reset confirmation dialog
 * ============================================================= */
.frame-dialog-scrim {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 40px;
  background: rgb(20 17 15 / 0.55);
  backdrop-filter: blur(6px);
}

.frame-dialog {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface1);
  box-shadow: 0 30px 70px -30px rgb(0 0 0 / 0.6);
}

.frame-dialog__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--dangerMuted);
  color: var(--danger);
}

.frame-dialog__icon svg {
  width: 26px;
  height: 26px;
}

.frame-dialog h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.frame-dialog p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  color: var(--textMuted);
}

.frame-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.frame-dialog--wifi .field {
  margin-top: -2px;
}
