/* Responsive hardware frames keep the original screenshots intact. */
.device-preview { min-width: 0; width: 100%; }
.preview-toolbar { display: flex; justify-content: flex-end; }
.preview-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.preview-controls[hidden] { display: none; }
.preview-controls fieldset { display: flex; gap: 2px; min-width: 0; margin: 0; padding: 3px; border: 1px solid var(--control-line, #52645b); border-radius: 9px; background: var(--control-fill, var(--dark)); }
.preview-controls label { display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 10px; border-radius: 6px; color: var(--muted); font-size: .75rem; cursor: pointer; }
.preview-controls label:has(:checked) { background: var(--green); color: var(--accent-ink, var(--dark)); }
.preview-controls label:has(:checked) input { accent-color: var(--accent-ink, #215238); }
.preview-controls label:has(:focus-visible) { outline: 3px solid var(--green); outline-offset: 5px; }
.preview-controls input { width: 13px; height: 13px; margin: 0; accent-color: #215238; }
.preview-controls input:focus-visible { outline: none; }
.preview-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.device-stage { position: relative; isolation: isolate; padding: 20px 0 24px; }
.device-stage::before {
  content: ""; position: absolute; z-index: -1; inset: 6% -12px 0;
  background: radial-gradient(ellipse at 50% 65%, var(--device-glow, #76ad8b24), transparent 68%);
}
.device-hardware { position: relative; width: 100%; max-width: var(--phone-max-width, 960px); margin: auto; }
.device-hardware::after {
  content: ""; position: absolute; z-index: -1; left: 8%; right: 8%; bottom: -10px; height: 22px;
  background: radial-gradient(ellipse, #0008, transparent 70%); filter: blur(7px);
}
.device-display {
  position: relative; margin: auto; padding: 2px; border: 1px solid #7f918c;
  border-radius: var(--phone-radius, 10px); background: linear-gradient(140deg, #9ba9a6, #44534e 28%, #23322e 65%, #8b9c95);
  box-shadow: 0 16px 36px #0004, inset 0 0 0 1px #d9e3dc42;
}
.device-bezel { position: relative; padding: var(--phone-padding, 8px 5px 6px); border-radius: var(--phone-bezel-radius, 7px); background: #101514; }
.device-bezel::before {
  content: ""; position: absolute; top: 3px; left: calc(50% - 1px); width: 2px; height: 2px;
  border-radius: 50%; background: #42554f; box-shadow: 0 0 0 1px #000;
}
.device-screen { aspect-ratio: var(--phone-ratio, 16 / 10); overflow: hidden; border-radius: var(--phone-screen-radius, 3px); background: #140f0c; }
.device-screen picture { display: block; width: 100%; height: 100%; }
.device-screen img { display: block; width: 100%; height: 100%; object-fit: contain; }
.preview-actions { display: flex; justify-content: flex-end; }
.device-enlarge { display: inline-flex; align-items: center; gap: 9px; min-height: 44px; width: fit-content; color: var(--green); font-size: .75rem; text-decoration: none; }
.device-enlarge .icon { width: 15px; height: 15px; }
.device-enlarge:hover { text-decoration: underline; }
.device-enlarge[data-screen-link="phone"] { display: var(--phone-link, none); }
.device-enlarge[data-screen-link="desktop"] { display: var(--desktop-link, inline-flex); }

/* Desktop display, tapered metal stand and weighted foot. */
.device-desktop .device-display { width: var(--phone-width, 94%); }
.device-desktop .device-bezel { padding-bottom: var(--phone-bottom-padding, 10px); }
.monitor-neck, .monitor-foot, .laptop-deck, .laptop-base { display: var(--wide-hardware, block); }
.monitor-neck {
  position: relative; z-index: -1; width: 18%; height: clamp(30px, 7vw, 76px); margin: -1px auto 0;
  clip-path: polygon(16% 0, 84% 0, 96% 100%, 4% 100%);
  background: linear-gradient(90deg, #52665d, #a1b2a9 8%, #637a6f 48%, #9bada3 91%, #435c4f);
}
.monitor-neck::before { content: ""; position: absolute; inset: 0; background: linear-gradient(#0008, transparent 65%); }
.monitor-foot {
  position: relative; width: 34%; height: clamp(8px, 1.5vw, 16px); margin: -2px auto 0;
  border-radius: 55% 55% 5px 5px / 80% 80% 3px 3px;
  background: linear-gradient(#b7c3bd, #7e9287 45%, #455e50 70%, #a4b6aa 82%, #536d5d);
  box-shadow: 0 3px 2px #0006;
}

/* Laptop display and low-profile keyboard deck. */
.device-laptop .device-display { width: var(--phone-width, 90%); border-radius: var(--phone-radius, 11px 11px 3px 3px); }
.device-laptop .device-bezel { border-radius: var(--phone-bezel-radius, 8px 8px 1px 1px); padding-bottom: var(--phone-bottom-padding, 7px); }
.laptop-deck {
  position: relative; height: clamp(25px, 4.6vw, 52px); margin-top: -1px;
  clip-path: polygon(5% 0, 95% 0, 100% 100%, 0 100%);
  background: linear-gradient(#485b52, #acbbb3 12%, #7e9487 70%, #a8b9af);
}
.laptop-keys {
  position: absolute; top: 12%; left: 17%; width: 66%; height: 43%; border: 1px solid #36483e; border-radius: 2px;
  background: repeating-linear-gradient(0deg, transparent 0 16%, #9eafa4 16% 20%), repeating-linear-gradient(90deg, #2d3c34 0 5.7%, #9eafa4 5.7% 6.6%);
  transform: perspective(80px) rotateX(12deg);
}
.laptop-trackpad { position: absolute; left: 42%; bottom: 10%; width: 16%; height: 30%; border: 1px solid #526d5c88; border-radius: 2px; background: #9daf9f66; }
.laptop-base {
  position: relative; height: clamp(5px, .8vw, 9px); border-radius: 0 0 35% 35% / 0 0 100% 100%;
  background: linear-gradient(#c3cfc6, #71887a 35%, #394d42 80%, #90a798);
  box-shadow: 0 4px 5px #0005;
}
.laptop-base::before { content: ""; position: absolute; left: 44%; top: 0; width: 12%; height: 40%; background: #344b3e; border-radius: 0 0 8px 8px; }

/* Explicit phone selection and the no-JavaScript default share the same frame. */
.device-preview[data-view="phone"] {
  --phone-max-width: 300px; --phone-width: 100%; --phone-ratio: 390 / 844;
  --phone-radius: 28px; --phone-bezel-radius: 25px; --phone-screen-radius: 18px;
  --phone-padding: 18px 6px 10px; --phone-bottom-padding: 10px;
  --wide-hardware: none; --phone-link: inline-flex; --desktop-link: none;
}
@media (max-width: 600px) {
  .device-preview:not([data-view]) {
    --phone-max-width: 300px; --phone-width: 100%; --phone-ratio: 390 / 844;
    --phone-radius: 28px; --phone-bezel-radius: 25px; --phone-screen-radius: 18px;
    --phone-padding: 18px 6px 10px; --phone-bottom-padding: 10px;
    --wide-hardware: none; --phone-link: inline-flex; --desktop-link: none;
  }
}

@media (min-width: 601px) {
  .device-stage { padding-block: 28px 32px; }
  .device-display { padding: 3px; border-radius: var(--phone-radius, 16px); }
  .device-bezel { padding: var(--phone-padding, 15px 10px 10px); border-radius: var(--phone-bezel-radius, 12px); }
  .device-bezel::before { top: 6px; left: calc(50% - 2px); width: 4px; height: 4px; }
  .device-desktop .device-bezel { padding-bottom: var(--phone-bottom-padding, 20px); }
  .device-desktop .device-display { width: var(--phone-width, 92%); }
  .device-laptop .device-display { border-radius: var(--phone-radius, 16px 16px 4px 4px); }
  .device-laptop .device-bezel { border-radius: var(--phone-bezel-radius, 12px 12px 2px 2px); padding-bottom: var(--phone-bottom-padding, 12px); }
}
