:root {
  --vellum: #fbf9f4;
  --champagne: #f5f1e6;
  --gilt: #c5a059;
  --ink: #23140d;
  --brown: #3a2820;
  --secondary: #665046;
  --outline: #d3c3be;
  --error: #93000a;
  --serif: "Crimson Pro", serif;
  --sans: "Source Sans 3", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 34%, rgba(245, 241, 230, 0.38), transparent 42%),
    var(--vellum);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--gilt);
  outline-offset: 3px;
}

.companion-sheet {
  width: 100%;
  min-height: 100vh;
  padding: 18px clamp(28px, 4vw, 68px) 16px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  background:
    linear-gradient(180deg, rgba(245, 241, 230, 0.24), transparent 22%),
    transparent;
}

.device-switcher {
  justify-self: center;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(2, 104px) 86px;
  gap: 5px;
  border: 1px solid rgba(211, 195, 190, 0.74);
  border-radius: 34px;
  background: rgba(251, 249, 244, 0.76);
  box-shadow: 0 13px 32px -29px rgba(58, 40, 32, 0.42);
}

.device-switcher button {
  min-height: 52px;
  padding: 4px 12px 5px;
  display: grid;
  grid-template-columns: 29px 1fr;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 28px;
  color: var(--secondary);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.device-switcher button svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.15;
}

.device-switcher button[aria-pressed="true"] {
  border-color: var(--gilt);
  color: var(--brown);
  background: rgba(245, 241, 230, 0.68);
  box-shadow: inset 0 0 0 1px rgba(197, 160, 89, 0.18);
}

.device-switcher .rotate-device {
  grid-template-columns: 24px 1fr;
  padding-inline: 9px;
  border-left-color: var(--outline);
  border-radius: 4px 28px 28px 4px;
}

.device-switcher .rotate-device svg {
  width: 23px;
  height: 23px;
}

.companion-context {
  min-height: 58px;
  padding: 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--outline);
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.companion-context h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
}

.preview-badge {
  margin: 0;
  padding: 5px 8px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  border: 1px solid rgba(197, 160, 89, 0.72);
  border-radius: 999px;
  color: var(--brown);
  background: rgba(245, 241, 230, 0.72);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.preview-badge span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gilt);
}

.companion-layout {
  width: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  align-items: center;
  gap: clamp(20px, 3vw, 42px);
}

.device-stage {
  min-height: 0;
  padding: 11px 0 5px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: 7px;
}

.companion-guide {
  align-self: center;
  padding: 22px 20px 20px;
  border: 1px solid rgba(211, 195, 190, 0.88);
  border-radius: 18px;
  background: rgba(251, 249, 244, 0.82);
  box-shadow: 0 18px 40px -34px rgba(58, 40, 32, 0.48);
}

.companion-guide summary {
  color: var(--brown);
  cursor: default;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  list-style: none;
}

.companion-guide summary::-webkit-details-marker {
  display: none;
}

.companion-instructions {
  margin: 9px 0 16px;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.48;
}

.companion-qr {
  margin: 0;
  display: grid;
  justify-items: center;
}

.companion-qr img {
  width: 152px;
  height: 152px;
  padding: 7px;
  display: block;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: var(--vellum);
}

.companion-qr figcaption {
  margin-top: 7px;
  color: var(--secondary);
  font-size: 10px;
  line-height: 1.3;
  text-align: center;
}

.companion-copy {
  margin-top: 17px;
  padding-top: 14px;
  border-top: 1px solid var(--outline);
}

.companion-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
}

.companion-copy p {
  margin: 6px 0 0;
  color: var(--secondary);
  font-family: var(--serif);
  font-size: 13px;
  line-height: 1.42;
}

.device-caption {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.device-size {
  color: var(--gilt);
}

.live-indicator {
  margin-left: 3px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--brown);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.live-indicator i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--gilt);
}

.device-assembly {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.device-frame {
  position: relative;
  border: 1px solid rgba(58, 40, 32, 0.7);
  background: #3a2820;
  box-shadow:
    0 25px 50px -34px rgba(58, 40, 32, 0.62),
    0 4px 12px rgba(58, 40, 32, 0.11);
  transition:
    width 180ms ease,
    height 180ms ease,
    border-radius 180ms ease;
}

.device-screen {
  position: relative;
  overflow: hidden;
  background: var(--vellum);
}

.device-screen iframe {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  border: 0;
  pointer-events: auto;
  transform: scale(var(--device-scale));
  transform-origin: top left;
}

.device-assembly[data-device="phone"] .device-frame {
  width: 262px;
  height: 547px;
  padding: 12px 10px;
  border-radius: 34px;
}

.device-assembly[data-device="phone"] .device-screen {
  width: 242px;
  height: 523px;
  border-radius: 22px;
}

.device-assembly[data-device="phone"] iframe {
  width: 390px;
  height: 844px;
  --device-scale: 0.6205;
}

.phone-speaker {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 50%;
  width: 40px;
  height: 4px;
  border-radius: 9px;
  background: rgba(251, 249, 244, 0.38);
  transform: translateX(-50%);
}

.device-camera {
  display: none;
}

.device-assembly[data-device="tablet"] .device-frame {
  width: 449.85px;
  height: 639px;
  padding: 6px;
  border-radius: 25px;
}

.device-assembly[data-device="tablet"] .device-screen {
  width: 437.85px;
  height: 627px;
  border-radius: 19px;
}

.device-assembly[data-device="tablet"] iframe {
  width: 834px;
  height: 1194px;
  --device-scale: 0.525;
}

.device-assembly[data-device="tablet"] .phone-speaker {
  display: none;
}

.device-assembly[data-device="tablet"] .device-camera {
  position: absolute;
  z-index: 2;
  top: 2px;
  left: 50%;
  width: 4px;
  height: 4px;
  display: block;
  border-radius: 50%;
  background: rgba(251, 249, 244, 0.5);
  transform: translateX(-50%);
}

.device-assembly[data-orientation="landscape"] .device-frame {
  transition-duration: 200ms;
}

.device-assembly[data-device="tablet"][data-orientation="landscape"] .device-frame {
  width: 639px;
  height: 450.1px;
}

.device-assembly[data-device="tablet"][data-orientation="landscape"] .device-screen {
  width: 627px;
  height: 438.1px;
}

.device-assembly[data-device="tablet"][data-orientation="landscape"] iframe {
  width: 1194px;
  height: 834px;
}

.device-assembly[data-device="phone"][data-orientation="landscape"] .device-frame {
  width: 463px;
  height: 227px;
  padding: 10px 12px;
}

.device-assembly[data-device="phone"][data-orientation="landscape"] .device-screen {
  width: 439px;
  height: 203px;
  border-radius: 18px;
}

.device-assembly[data-device="phone"][data-orientation="landscape"] iframe {
  width: 844px;
  height: 390px;
  --device-scale: 0.52;
}

.device-assembly[data-device="phone"][data-orientation="landscape"] .phone-speaker {
  top: 50%;
  left: 7px;
  width: 4px;
  height: 34px;
  transform: translateY(-50%);
}

.teaser-copy {
  margin: 4px 0 10px;
  text-align: center;
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.legal {
  padding-top: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 22px;
  border-top: 1px solid var(--outline);
  color: var(--secondary);
  font-family: var(--serif);
  font-size: 10.5px;
  line-height: 1.35;
  text-align: center;
}

.legal p {
  margin: 0;
}

@media (hover: hover) {
  .device-switcher button:hover {
    color: var(--brown);
    background: rgba(245, 241, 230, 0.38);
  }
}

@media (max-width: 980px) {
  .companion-layout {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
  }

  .device-assembly[data-device="tablet"] {
    transform: scale(0.88);
  }
}

@media (max-width: 680px) {
  .companion-sheet {
    padding-inline: 14px;
  }

  .device-switcher {
    width: min(100%, 330px);
    grid-template-columns: repeat(3, 1fr);
  }

  .device-switcher button {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 1px;
  }

  .device-switcher button svg {
    width: 25px;
    height: 25px;
  }

  .companion-context {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .companion-layout {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .companion-guide {
    width: min(100%, 360px);
    justify-self: center;
    padding: 14px 16px;
    border-radius: 14px;
  }

  .companion-guide summary {
    position: relative;
    padding-right: 24px;
    cursor: pointer;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .companion-guide summary::after {
    position: absolute;
    top: -2px;
    right: 2px;
    content: "+";
    color: var(--gilt);
    font-size: 18px;
    font-weight: 400;
  }

  .companion-guide[open] summary::after {
    content: "–";
  }

  .companion-instructions {
    margin-top: 13px;
  }

  .companion-qr img {
    width: 132px;
    height: 132px;
  }

  .legal {
    flex-direction: column;
  }

  .device-assembly[data-device="tablet"] {
    transform: scale(0.72);
    transform-origin: top center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
