/*! Copyright (c) 2026 Handbuilt Creative. */

/* Base styles */

:root {
  font-family: var(--font-body);
  color: var(--brand-white);
  background: var(--brand-charcoal);
  font-synthesis: none;
  letter-spacing: -0.01em;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
}

button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  border: 0;
  border-radius: 4px;
  background: var(--brand-yellow);
  color: var(--brand-charcoal);
  min-height: 44px;
  padding: 0.65rem 1rem;
  font-weight: 700;
}

button:focus-visible {
  outline: 3px solid var(--brand-cherry);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

/* Camera feed and AR canvas */

#camera-stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

video,
canvas {
  position: absolute;
  top: 0;
  left: 0;
}

video {
  z-index: 0;
}

canvas {
  z-index: 1;
}

/* Header */

.camera-header {
  position: fixed;
  z-index: 4;
  inset: 0 0 auto;
  padding: calc(0.6rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.6rem
    max(1rem, env(safe-area-inset-left));
  color: var(--brand-charcoal);
  background: var(--brand-white);
  border-bottom: 3px solid var(--brand-cherry);
}

.camera-brand {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  width: 100%;
}

.camera-brand > div {
  min-width: 0;
  text-align: right;
}

.camera-brand p {
  margin: 0;
}

.brand-kicker {
  font-size: 0.7rem;
  line-height: 1.2;
}

.brand-name {
  font: 700 24px/1 var(--font-heading);
}

.camera-brand .stop-subtitle {
  font-size: 0.7rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--brand-charcoal);
  margin: 0.1rem 0 0;
}

/* Scanning guide and camera messages */

.scan-guide {
  position: fixed;
  z-index: 3;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(80vw, 72vh, 420px);
  aspect-ratio: 3/2;
  border: 2px solid #ffffffa0;
  border-radius: 8px;
  pointer-events: none;
}

.camera-status {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: calc(100% - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right));
  max-width: 390px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: #2d2d2df5;
  text-align: center;
  padding: 1rem;
  border: 1px solid var(--brand-grey);
  border-radius: 12px;
  box-shadow: 0 5px 24px #00000025;
  backdrop-filter: blur(8px);
}

.info-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand-grey);
  border-radius: 50%;
  font: 700 18px var(--font-body);
  color: var(--brand-white);
}

.camera-status > div {
  min-width: 0;
  width: 100%;
}

.camera-status p {
  margin: 0;
  line-height: 1.5;
}

.camera-status p:first-child {
  font-weight: 700;
}

#camera-help {
  font-size: 0.85rem;
  color: var(--brand-grey);
  margin-top: 0.25rem;
}

.camera-status button {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 1rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Pinch and zoom controls */

#camera-stage.content-visible {
  touch-action: none;
}

.resize-controls {
  position: fixed;
  z-index: 4;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: max-content;
  max-width: calc(100% - 2rem - env(safe-area-inset-left) - env(safe-area-inset-right));
  padding: 0.25rem;
  background: #2d2d2df5;
  border: 1px solid var(--brand-grey);
  border-radius: 8px;
  backdrop-filter: blur(8px);
  text-align: center;
}

.resize-controls p {
  min-width: 0;
  margin: 0 0.25rem 0 0.5rem;
  font-size: 0.75rem;
  color: var(--brand-white);
  line-height: 1.4;
}

.resize-controls > div {
  display: flex;
  flex-shrink: 0;
  gap: 0.25rem;
}

.resize-controls button {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1px solid var(--brand-grey);
  border-radius: 4px;
  background: var(--brand-white);
  color: var(--brand-charcoal);
}

.resize-controls button:hover,
.resize-controls button:active {
  background: var(--brand-grey);
}

.resize-controls button:focus-visible {
  outline: 3px solid var(--brand-cherry);
  outline-offset: 3px;
}

@media (orientation: landscape) and (max-height: 500px) {
  .brand-name {
    font-size: 20px;
  }

  .camera-brand .stop-subtitle {
    font-size: 0.65rem;
    line-height: 1.1;
    margin-top: 0;
  }

  .camera-status {
    max-width: 620px;
    padding: 0.65rem 1rem;
  }

  .camera-status button {
    margin-top: 0.5rem;
  }
}

.resize-controls button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Welcome photographs */

.camera-welcome {
  position: fixed;
  z-index: 2;
  inset: calc(87px + env(safe-area-inset-top)) env(safe-area-inset-right)
    calc(230px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 20px 24px;
  pointer-events: none;
}

.camera-welcome h1 {
  margin: 22px 0 0;
  color: var(--brand-white);
  font: 700 38px/1 var(--font-heading);
  text-align: center;
  letter-spacing: 0;
}

.welcome-collage {
  position: relative;
  flex: 0 1 268px;
  width: 100%;
  max-width: 340px;
  min-height: 200px;
}

.welcome-photo {
  position: absolute;
  margin: 0;
  background: var(--brand-white);
  border: 6px solid var(--brand-white);
  box-shadow: 0 10px 22px #0004;
  overflow: hidden;
}

.welcome-photo img {
  display: block;
  width: 100%;
  height: calc(100% - 23px);
  object-fit: cover;
}

.welcome-photo figcaption {
  height: 23px;
  display: flex;
  align-items: center;
  justify-content: center;
  font: 400 11px/1.1 var(--font-body);
  color: var(--brand-charcoal);
}

.welcome-photo-left {
  width: 158px;
  height: 164px;
  left: 0;
  top: 16px;
  transform: rotate(-11deg);
}

.welcome-photo-right {
  width: 146px;
  height: 172px;
  right: 0;
  top: 5px;
  transform: rotate(10deg);
}

.welcome-photo-front {
  width: 256px;
  height: 194px;
  left: 50%;
  top: 80px;
  transform: translateX(-50%) rotate(-2deg);
}

@media (max-height: 700px) and (orientation: portrait) {
  .camera-welcome {
    top: calc(83px + env(safe-area-inset-top));
    bottom: calc(260px + env(safe-area-inset-bottom));
    padding: 0 16px;
  }

  .welcome-collage {
    flex-basis: 130px;
    min-height: 120px;
    max-width: 240px;
  }

  .welcome-photo-left {
    width: 110px;
    height: 105px;
    top: 2px;
  }

  .welcome-photo-right {
    width: 110px;
    height: 105px;
    top: 0;
  }

  .welcome-photo-front {
    width: 180px;
    height: 108px;
    top: 24px;
  }

  .camera-welcome h1 {
    font-size: 30px;
    margin-top: 12px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .camera-welcome {
    top: calc(83px + env(safe-area-inset-top));
    bottom: calc(206px + env(safe-area-inset-bottom));
    flex-direction: row;
    gap: 26px;
    padding: 0 24px;
  }

  .welcome-collage {
    height: 80px;
    min-height: 0;
    flex: 0 0 210px;
  }

  .welcome-photo-left {
    width: 90px;
    height: 60px;
    top: 0;
  }

  .welcome-photo-right {
    width: 90px;
    height: 60px;
    top: 0;
  }

  .welcome-photo-front {
    width: 172px;
    height: 68px;
    top: 0;
  }

  .camera-welcome h1 {
    margin: 0;
    font-size: 30px;
    text-align: left;
  }
}

@media (max-height: 360px) and (orientation: landscape) {
  .camera-welcome {
    display: none;
  }
}

/* Story Stop placement controls */
.scan-guide {
  aspect-ratio: 1;
}

.has-stories .camera-status {
  bottom: calc(82px + env(safe-area-inset-bottom));
}

body.has-stories {
  touch-action: none;
}
