/* Glassie — site styles
   MacBook CSS from site/lab/index.html (verbatim),
   hero block from site/design/mockup.html,
   layout and responsive rules for the product page. */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background: #000;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   LAYOUT
   ================================================================ */

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ================================================================
   INTRO FADE COVER
   Fades from opaque black to transparent to reveal the MacBook.
   Placed outside the 3D chain: opacity on a preserve-3d ancestor
   creates a stacking context that flattens 3D transforms.
   ================================================================ */

.intro-cover {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 50;
  pointer-events: none;
  transition: opacity 0.9s ease-out;
}

.intro-cover.fade-out {
  opacity: 0;
}

/* ================================================================
   SCENE VIEWPORT
   ================================================================ */

.scene-viewport {
  flex: 0 0 auto;
  width: 100%;
  height: var(--mac-box-h, 300px);
  display: flex;
  justify-content: center;
  align-items: center;
  perspective: 1200px;
  transform-style: preserve-3d;
  overflow: visible;
}

.scene {
  transform-style: preserve-3d;
  will-change: transform;
}

.hinge {
  position: relative;
  width: 400px;
  height: 0;
  transform-style: preserve-3d;
}

/* ================================================================
   BASE (lower chassis) — verbatim from prototype
   ================================================================ */

.base {
  position: absolute;
  width: 400px;
  height: 260px;
  top: 0;
  left: 0;
  transform-style: preserve-3d;
  transform-origin: top center;
  transform: rotateX(90deg);
}

.base-top {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #dedede, #b5b5b5);
  border-radius: 14px;
  padding: 14px 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  backface-visibility: hidden;
  transform: translateZ(0px);
}

.keyboard-well {
  width: 100%;
  height: 128px;
  background: #121212;
  border-radius: 6px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.95), 0 1px 0 rgba(255, 255, 255, 0.35);
}

.kb-row {
  display: flex;
  gap: 2.5px;
  width: 100%;
  height: 17px;
}

.kb-row-fn {
  height: 11px;
}

.key {
  background: linear-gradient(180deg, #2b2b2b 0%, #1c1c1c 85%, #111 100%);
  border-radius: 2.5px;
  flex: 1;
  height: 100%;
  border-top: 0.8px solid #3c3c3c;
  border-left: 0.6px solid #282828;
  border-right: 0.6px solid #141414;
  border-bottom: 1.2px solid #050505;
  box-shadow:
    0 1px 0.5px rgba(0, 0, 0, 0.9),
    0 1.5px 0 #000,
    inset 0 0.5px 0.5px rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.75);
  font-size: 6.5px;
  font-weight: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  line-height: 1;
  padding: 1px 2px;
  letter-spacing: -0.1px;
}

.key span {
  pointer-events: none;
}

.key-fn {
  font-size: 5px;
  color: rgba(255, 255, 255, 0.6);
}

.key-symbol {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 5.5px;
  gap: 0.5px;
}

.key-symbol span:first-child {
  font-size: 5px;
  opacity: 0.6;
}

.k-esc { flex: 1.3; font-size: 5px; justify-content: flex-start; padding-left: 3px; }
.k-touchid {
  flex: 1.3;
  background: #141414;
  border-radius: 3px;
  border: 0.8px solid #333;
  box-shadow: inset 0 0 2px #000;
}
.k-delete { flex: 1.45; font-size: 5px; justify-content: flex-end; padding-right: 3px; }
.k-tab { flex: 1.4; font-size: 5px; justify-content: flex-start; padding-left: 3px; }
.k-slash { flex: 1.4; }
.k-caps { flex: 1.7; font-size: 5px; justify-content: flex-start; padding-left: 3px; }
.k-return { flex: 1.7; font-size: 5px; justify-content: flex-end; padding-right: 3px; }
.k-shift-l { flex: 2.15; font-size: 5px; justify-content: flex-start; padding-left: 3px; }
.k-shift-r { flex: 2.15; font-size: 5px; justify-content: flex-end; padding-right: 3px; }
.k-mod { flex: 1.15; font-size: 5px; }
.k-cmd { flex: 1.35; font-size: 5px; }
.k-space { flex: 5.4; }

.arrow-cluster {
  flex: 3.2;
  display: flex;
  gap: 2.5px;
  height: 100%;
}

.arrow-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5px;
  height: 100%;
}

.key-arrow-half {
  height: 7.7px;
  border-radius: 2px;
  margin-top: auto;
  font-size: 4.5px;
  padding: 0;
}

.trackpad {
  width: 124px;
  height: 78px;
  background: rgba(0, 0, 0, 0.04);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  margin-top: auto;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.08);
}

.base-bottom {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #dedede, #a8a8a8);
  border-radius: 14px;
  transform: translateZ(-6px) rotateX(180deg);
  backface-visibility: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}

.mb-foot {
  position: absolute;
  width: 18px;
  height: 18px;
  background: #1c1c1e;
  border-radius: 50%;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    0 1px 2px rgba(0, 0, 0, 0.6);
  border: 0.5px solid #111;
}

.mb-foot-tl { top: 16px; left: 18px; }
.mb-foot-tr { top: 16px; right: 18px; }
.mb-foot-bl { bottom: 16px; left: 18px; }
.mb-foot-br { bottom: 16px; right: 18px; }

.engraved-text {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.7px;
  background: linear-gradient(135deg, #d8d8d8, #a2a2a2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 -0.8px 0 rgba(0, 0, 0, 0.4))
          drop-shadow(0 0.8px 0 rgba(255, 255, 255, 0.75));
}

/* ================================================================
   LID (screen assembly) — verbatim from prototype
   ================================================================ */

.tampa {
  position: absolute;
  width: 400px;
  height: 260px;
  bottom: 0;
  left: 0;
  transform-style: preserve-3d;
  transform-origin: bottom center;
  transform: rotateX(var(--lid-angle, 20deg));
}

.tampa-frente {
  position: absolute;
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 14px;
  padding: 4px 4px 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 0 0 1px #222;
  backface-visibility: hidden;
  transform: translateZ(0px);
}

.display {
  width: 100%;
  height: 100%;
  background: #000;
  border-radius: 10px 10px 6px 6px;
  position: relative;
  overflow: hidden;
  perspective: 1200px;
}

.display-layer {
  position: absolute;
  inset: 0;
  transform-origin: bottom center;
  transform: scaleY(var(--img-scale-y, 1)) rotateX(var(--img-rot-x, 0deg));
  filter: brightness(var(--img-brightness, 1));
  opacity: var(--img-opacity, 1);
  will-change: transform, filter, opacity;
}

.display-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
}

.display-gl {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  opacity: 0;
}

.display.gl-ready .display-gl { opacity: 1; }
.display.gl-ready .display-layer { visibility: hidden; }

.notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 54px;
  height: 12px;
  background: #000;
  border-radius: 0 0 5px 5px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

.camera {
  width: 4.5px;
  height: 4.5px;
  background: #152b47;
  border: 0.5px solid #081424;
  border-radius: 50%;
}

.tampa-traseira {
  position: absolute;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #dedede, #a8a8a8);
  border-radius: 14px;
  transform: translateZ(-4px) rotateY(180deg);
  backface-visibility: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.apple-logo-svg {
  width: 32px;
  height: 38px;
}

.perimeter-mesh {
  position: absolute;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  pointer-events: none;
}

.facet {
  position: absolute;
  transform-origin: center center;
  backface-visibility: visible;
}

/* ================================================================
   HERO BLOCK (below the MacBook)
   Markup/styles from site/design/mockup.html .hero-inner
   ================================================================ */

/* ================================================================
   SCROLL HINT
   ================================================================ */

.scroll-hint {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translate(-50%, -50%);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  opacity: 0;
  transition: opacity 0.6s ease-out;
}

.scroll-hint > span,
.scroll-hint > svg {
  display: block;
}

.scroll-hint > span {
  margin-bottom: 6px;
}

.scroll-hint.hint-visible {
  opacity: 1;
}

.scroll-hint.hint-hidden {
  opacity: 0;
  transition: opacity 0.4s ease-out;
}

.scroll-hint.hint-no-transition {
  transition: none;
}

.scroll-hint svg {
  animation: hint-bounce 2s ease-in-out infinite;
}

@keyframes hint-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ================================================================
   HERO BLOCK (below the MacBook)
   Markup/styles from site/design/mockup.html .hero-inner
   ================================================================ */

.hero {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 48px;
  padding: 0 16px;
  color: #fff;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.hero-visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-no-transition {
  transition: none;
}

.hero .icon {
  width: 56px;
  height: 56px;
  margin-bottom: 8px;
}

.hero .wm {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 28px;
}

.hero .buy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  background: #fff;
  color: #000;
  border: none;
  border-radius: 100px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-bottom: 10px;
}

.hero .buy:hover {
  background: #f0f0f0;
}

.hero .buy .s {
  color: rgba(0, 0, 0, 0.3);
  text-decoration: line-through;
  font-weight: 400;
  font-size: 14px;
}

.hero .meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.35);
}

/* ================================================================
   PAGE FOOTER (below hero, enters with hero)
   ================================================================ */

.page-foot {
  width: 100%;
  max-width: 800px;
  margin-top: auto;
  padding: 16px 40px 24px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.25);
  line-height: 1.5;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.page-foot.foot-visible {
  opacity: 1;
  transform: translateY(0);
}

.page-foot.foot-no-transition {
  transition: none;
}

.page-foot .foot-left { text-align: left; }
.page-foot .foot-right { white-space: nowrap; flex-shrink: 0; }

.page-foot a {
  color: rgba(255, 255, 255, 0.30);
  text-decoration: none;
  transition: color 0.2s;
}

.page-foot a:hover { color: rgba(255, 255, 255, 0.60); }
.page-foot a:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.4); outline-offset: 2px; }

/* ================================================================
   DEBUG CONTROLS PANEL — from prototype
   ================================================================ */

.controls {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(26, 26, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(12px);
  padding: 16px 20px;
  border-radius: 12px;
  color: #eaeaea;
  display: none;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  z-index: 100;
  width: 260px;
}

.controls h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #aaa;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 6px;
}

.info-tag {
  font-size: 11px;
  color: #00bfff;
  font-weight: 500;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-row label {
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}

.control-row input[type="range"] {
  width: 100%;
  accent-color: #0071e3;
  cursor: pointer;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 640px) {
  .scene-viewport {
    transform: scale(0.65);
    transform-origin: center center;
  }

  .hero {
    margin-top: 40px;
  }

  .hero .icon {
    width: 44px;
    height: 44px;
  }

  .hero .wm {
    font-size: 13px;
    margin-bottom: 20px;
  }

  .hero .buy {
    padding: 12px 32px;
    font-size: 15px;
  }

  .page-foot {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 20px 20px;
    font-size: 10px;
  }

  .controls {
    top: auto;
    bottom: 10px;
    right: 10px;
    left: 10px;
    width: auto;
  }
}

/* ================================================================
   REDUCED MOTION
   ================================================================ */

@media (prefers-reduced-motion: reduce) {
  .hero,
  .page-foot {
    transition: none;
  }
}
