/* GoosePic mobile-first refresh */
:root {
  --ink: #292521;
  --green: #a7442e;
  --lime: #d9ed76;
  --mint: #fff0e5;
  --paper: #fff8ee;
  --line: #e6d8cc;
  --muted: #716761;
  --shadow: 0 20px 60px rgba(91, 49, 34, .12);
}

body {
  background: radial-gradient(circle at 88% 3%, rgba(217, 237, 118, .4), transparent 22rem),
    radial-gradient(circle at 8% 34%, rgba(236, 119, 80, .1), transparent 28rem), var(--paper);
}

.site-header {
  min-height: calc(76px + env(safe-area-inset-top));
  height: auto;
  padding-top: env(safe-area-inset-top);
  padding-right: max(clamp(20px, 5vw, 72px), env(safe-area-inset-right));
  padding-left: max(clamp(20px, 5vw, 72px), env(safe-area-inset-left));
  border-color: rgba(167, 68, 46, .14);
  background: rgba(255, 248, 238, .88);
}

.button,
.icon-button,
.text-button,
.brand,
.size-buttons button,
.camera-head > button {
  min-height: 44px;
}

.camera-head > button {
  width: 44px;
  height: 44px;
}

.switch-row {
  min-height: 44px;
}

.upload-zone {
  background: linear-gradient(135deg, #fffdfa, #fff0e5);
  border-color: #d9b6a8;
}

.upload-zone:hover,
.upload-zone:focus,
.upload-zone.dragging {
  background: #fff3e9;
}

.preview-panel {
  background: #f4eee8;
}

.how-it-works {
  background: #3a2c28;
}

.crash-recovery {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 12px max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid #eccbbb;
  background: #fff0e5;
}

.crash-recovery[hidden],
.camera-dialog:not([open]) {
  display: none;
}

.crash-recovery > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.crash-recovery b {
  font-size: 13px;
}

.crash-recovery span {
  color: var(--muted);
  font-size: 11px;
}

.recovery-card {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #efb8a3;
  border-radius: 12px;
  background: #fff4ed;
}

.recovery-card > b {
  font-size: 12px;
}

.recovery-card p {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.recovery-card > div {
  display: flex;
  gap: 8px;
}

.recovery-card .button {
  flex: 1;
  padding-inline: 8px;
  font-size: 11px;
}

.mobile-result-actions {
  display: none;
}

.camera-dialog {
  max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  overflow: auto;
}

.toast {
  bottom: calc(24px + env(safe-area-inset-bottom));
}

@media (max-width: 600px) {
  .site-header {
    min-height: calc(58px + env(safe-area-inset-top));
    padding-right: max(14px, env(safe-area-inset-right));
    padding-left: max(14px, env(safe-area-inset-left));
  }

  .brand-mark {
    width: 29px;
    height: 34px;
  }

  .country-picker > span {
    display: none;
  }

  .country-picker select {
    max-width: 132px;
  }

  .hero {
    padding: 24px 16px 20px;
  }

  .hero h1 {
    margin: 10px 0 14px;
    font-size: clamp(38px, 11vw, 48px);
    line-height: 1;
  }

  .hero > p {
    font-size: 14px;
    line-height: 1.48;
  }

  .trust-row {
    gap: 7px 13px;
    margin-top: 14px;
    font-size: 11px;
  }

  .maker {
    margin: 0 10px 38px;
    padding: 14px;
    border-radius: 18px;
  }

  .maker-topline {
    margin-bottom: 14px;
  }

  .maker h2 {
    font-size: 25px;
  }

  .maker-topline > p {
    margin: 7px 0 0 44px;
    font-size: 11px;
    line-height: 1.4;
  }

  .upload-zone {
    padding: 16px 12px;
  }

  .upload-icon,
  .upload-zone h3,
  .upload-zone > p {
    display: none;
  }

  .upload-actions {
    margin-top: 0;
  }

  .upload-actions .button {
    min-height: 48px;
  }

  .preview-panel,
  .controls-panel {
    padding: 14px;
  }

  .export-section {
    margin-bottom: 42px;
    padding-inline: 12px;
  }

  .export-card {
    min-height: 0;
  }

  .partner-card {
    order: -1;
  }

  .how-it-works {
    padding: 24px 10px;
  }

  .section-heading.centered {
    margin-bottom: 14px;
  }

  .section-heading.centered h2 {
    display: none;
  }

  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
  }

  .steps-grid article {
    padding: 12px 6px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 10px;
    text-align: center;
  }

  .steps-grid article > span {
    font-size: 18px;
  }

  .steps-grid h3 {
    margin: 5px 0 0;
    font-size: 14px;
  }

  .steps-grid p {
    display: none;
  }

  footer {
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .mobile-result-actions:not([hidden]) {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 18;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
    padding: 10px max(12px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(255, 248, 238, .96);
    box-shadow: 0 -10px 35px rgba(65, 39, 29, .14);
    backdrop-filter: blur(14px);
  }

  .mobile-result-actions .button {
    min-height: 48px;
  }

  .toast {
    bottom: calc(82px + env(safe-area-inset-bottom));
    width: calc(100vw - 28px);
    text-align: center;
  }

  .crash-recovery {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
  }
}

@media (orientation: landscape) and (max-height: 500px) {
  .camera-dialog {
    width: calc(100vw - 16px);
    max-width: 900px;
    max-height: calc(100dvh - 12px);
    display: grid;
    grid-template-columns: minmax(300px, 1.45fr) minmax(250px, .8fr);
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
      "head head"
      "video help"
      "video actions";
    gap: 8px 14px;
    padding: 10px max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left));
    overflow: hidden;
  }

  .camera-head {
    grid-area: head;
    margin: 0;
  }

  .camera-head .eyebrow {
    display: none;
  }

  .camera-head h2 {
    margin: 0;
    font-size: 23px;
  }

  .video-frame {
    grid-area: video;
    width: auto;
    height: min(74dvh, 290px);
    max-width: 100%;
    aspect-ratio: 4 / 3;
    justify-self: center;
  }

  .camera-dialog > p {
    grid-area: help;
    align-self: end;
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    text-align: left;
  }

  .camera-actions {
    grid-area: actions;
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "shutter shutter" "flip fallback";
    gap: 8px;
  }

  #takePhoto {
    grid-area: shutter;
  }

  #flipCamera {
    grid-area: flip;
  }

  #cameraFallback {
    grid-area: fallback;
  }
}
