:root {
  --navy: #0E2A47;
  --navy-light: #16385C;
  --aqua: #159FB2;
  --aqua-light: #4FC3D9;
  --gold: #D9A227;
  --cream: #F5EFE3;
  --ink: #0E2A47;
  --radius: 14px;
}

* { box-sizing: border-box; }

/* Safety net: no image may ever grow wider than its container. */
img { max-width: 100%; height: auto; }

body {
  margin: 0;
  background: var(--navy);
  color: var(--cream);
  font-family: 'Lato', sans-serif;
  min-height: 100vh;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ----
 * LOCKED LAYOUT — Aug 2, 2026. The logo (poolcast-p.png + poolcast-wordmark.png)
 * has dark navy lettering, so it needs a WHITE header bar to be visible at all.
 * A dark/navy .site-header background makes the wordmark unreadable.
 * Layout is: logo centered, tagline centered underneath it (not side-by-side).
 * If you touch header/brand/wordmark markup or CSS for any other reason
 * (new feature, unrelated commit, etc.), re-check this section before
 * committing. It has broken silently from unrelated changes before.
 */

.site-header {
  background: #FFFFFF;
  padding: 24px 0;
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  height: 44px;
  width: auto;
  flex: 0 0 auto;
  display: block;
}

.brand-wordmark {
  height: auto;
  width: auto;
  max-height: 30px;
  max-width: 220px;
  flex: 0 1 auto;
  display: block;
  object-fit: contain;
}

.wordmark {
  font-family: 'Source Serif 4', serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.wordmark-accent { color: var(--aqua-light); }

.tagline {
  font-size: 13px;
  color: var(--navy);
}

/* ---- Stages ---- */

.stage {
  padding: 56px 0 72px;
}

.hidden { display: none !important; }

.hero-line {
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  font-size: 34px;
  line-height: 1.15;
  margin: 0 0 16px;
}

.hero-sub {
  font-size: 16px;
  line-height: 1.55;
  color: rgba(245, 239, 227, 0.78);
  margin: 0 0 32px;
  max-width: 46ch;
}

/* ---- Drop zone ---- */

.drop-zone {
  border: 1.5px dashed rgba(79, 195, 217, 0.4);
  border-radius: var(--radius);
  background: rgba(79, 195, 217, 0.05);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--aqua-light);
  background: rgba(79, 195, 217, 0.1);
}

.drop-zone-inner svg {
  color: var(--aqua-light);
  margin-bottom: 12px;
}

.drop-zone-inner p {
  margin: 4px 0;
}

.drop-hint {
  font-size: 13px;
  color: rgba(245, 239, 227, 0.55);
}

/* ---- Take a photo / choose from library ---- */

.upload-actions {
  margin-top: 18px;
  display: grid;
  gap: 10px;
}

.upload-actions .primary-btn,
.upload-actions .secondary-btn {
  margin-top: 0;
  min-height: 48px;
}

/* ---- Preview ---- */

.preview-block {
  margin-top: 24px;
  text-align: center;
}

.preview-block img {
  max-width: 100%;
  border-radius: var(--radius);
  display: block;
  margin: 0 auto 12px;
}

/* ---- Options form ---- */

.options {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}

.option-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 8px;
}

.option-group select {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Lato', sans-serif;
  background: var(--navy-light);
  color: var(--cream);
  border: 1px solid rgba(245, 239, 227, 0.18);
  border-radius: 10px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%234FC3D9' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.option-group select:focus-visible {
  outline: 2px solid var(--aqua-light);
  outline-offset: 2px;
}

/* ---- Buttons ---- */

.primary-btn,
.secondary-btn,
.link-btn {
  font-family: 'Lato', sans-serif;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  display: inline-block;
  text-align: center;
  text-decoration: none;
}

.primary-btn {
  background: var(--aqua);
  color: var(--navy);
  padding: 14px 24px;
  width: 100%;
  margin-top: 8px;
  transition: background 0.15s ease;
}

.primary-btn:hover { background: var(--aqua-light); }
.primary-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.secondary-btn {
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(245, 239, 227, 0.35);
  padding: 13px 24px;
  width: 100%;
  margin-top: 10px;
}

.secondary-btn:hover { border-color: var(--aqua-light); color: var(--aqua-light); }

.link-btn {
  background: none;
  color: var(--aqua-light);
  padding: 10px 0;
  font-weight: 500;
  font-size: 14px;
  width: 100%;
  margin-top: 6px;
}

.link-btn:hover { color: var(--gold); }

.error-msg {
  margin-top: 16px;
  color: #E8846A;
  font-size: 14px;
}

/* ---- Loading ---- */

#loadingStage {
  text-align: center;
  padding-top: 100px;
}

.loading-ripple {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.loading-ripple span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--aqua-light);
  animation: ripple 1.1s ease-in-out infinite;
}

.loading-ripple span:nth-child(2) { animation-delay: 0.15s; background: var(--gold); }
.loading-ripple span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ripple {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

.loading-text {
  font-family: 'Source Serif 4', serif;
  font-size: 18px;
  color: rgba(245, 239, 227, 0.8);
}

@media (prefers-reduced-motion: reduce) {
  .loading-ripple span { animation: none; opacity: 0.9; }
}

/* ---- Result / reveal slider ---- */

.result-heading {
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  font-size: 26px;
  margin: 0 0 6px;
}

.reveal-wrap {
  position: relative;
  width: 100%;
  border-radius: var(--radius);
  overflow: hidden;
  user-select: none;
  touch-action: none;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.reveal-after {
  display: block;
  width: 100%;
  height: auto;
}

.reveal-clip {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 50%;
  overflow: hidden;
}

.reveal-before {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--reveal-img-width, 100%);
  object-fit: cover;
  max-width: none;
}

.reveal-handle {
  touch-action: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 3px;
  background: var(--cream);
  cursor: ew-resize;
  transform: translateX(-50%);
}

.reveal-handle-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cream);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.reveal-label {
  position: absolute;
  bottom: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: rgba(14, 42, 71, 0.75);
  color: var(--cream);
  padding: 5px 10px;
  border-radius: 6px;
  pointer-events: none;
}

.reveal-label-left { left: 12px; }
.reveal-label-right { right: 12px; }

.result-actions { margin-top: 24px; }

.disclosure {
  margin-top: 20px;
  font-size: 12.5px;
  color: rgba(245, 239, 227, 0.5);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .hero-line { font-size: 28px; }
  .stage { padding: 40px 0 56px; }
  .brand-mark { height: 36px; }
  .brand-wordmark { max-height: 24px; max-width: 120px; }
  .tagline { font-size: 12px; }
}

/* ---- Accounts: status bar + login/signup modal ---- */

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin: 24px 0 -8px;
  background: var(--navy-light);
  border: 1px solid rgba(245, 239, 227, 0.12);
  border-radius: 10px;
  font-size: 13px;
}

.account-bar #accountInfo { color: var(--cream); }
.account-bar .link-btn { padding: 0; font-size: 13px; }
.account-bar-actions { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }

/* ---- My renders gallery ---- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

/* The card is a positioned wrapper so the delete button can sit on top of
   the thumbnail. The card itself is no longer the clickable element — the
   inner .gallery-thumb-open button is, because a delete button nested
   inside a button is invalid markup. */
.gallery-thumb {
  position: relative;
  background: var(--navy-light);
  border: 1px solid rgba(245, 239, 227, 0.18);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.gallery-thumb:hover { border-color: var(--aqua-light); }

.gallery-thumb-open {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  width: 100%;
  color: inherit;
  font: inherit;
}

.gallery-thumb-open:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

/* Always visible rather than hover-only — this has to work on the phone a
   rep is actually holding in a customer's backyard, where there is no
   hover state at all. */
.gallery-thumb-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(245, 239, 227, 0.35);
  background: rgba(14, 42, 71, 0.78);
  color: var(--cream);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.gallery-thumb-delete:hover {
  background: #B3261E;
  border-color: #B3261E;
  color: #fff;
}

.gallery-thumb-delete:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.gallery-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.gallery-thumb-date {
  font-size: 12px;
  color: rgba(245, 239, 227, 0.6);
  padding: 8px 10px;
}

.gallery-empty {
  text-align: center;
  margin-top: 32px;
}

.gallery-back-btn {
  margin-top: 28px;
  max-width: 200px;
}

.gallery-lightbox-inner {
  max-width: 720px;
}

.gallery-lightbox-date {
  font-size: 13px;
  color: rgba(245, 239, 227, 0.6);
  margin: 0 0 16px;
}

.gallery-lightbox-images {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.gallery-lightbox-col { flex: 1 1 260px; }

.gallery-lightbox-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--aqua-light);
  margin: 0 0 6px;
}

.gallery-lightbox-images img {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.gallery-lightbox-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}

/* Destructive actions get their own colour rather than reusing
   .secondary-btn — deleting a customer's saved render is not undoable and
   should not look like Back. */
.danger-btn {
  background: transparent;
  border: 1px solid rgba(179, 38, 30, 0.8);
  color: #E8837C;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.danger-btn:hover {
  background: #B3261E;
  border-color: #B3261E;
  color: #fff;
}

.danger-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.auth-modal {
  position: fixed;
  inset: 0;
  background: rgba(14, 42, 71, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.auth-modal-inner {
  position: relative;
  background: var(--navy);
  border: 1px solid rgba(245, 239, 227, 0.18);
  border-radius: var(--radius);
  padding: 32px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.auth-modal-inner h2 {
  margin: 0 0 8px;
  font-family: 'Source Serif 4', serif;
  font-size: 22px;
  color: var(--cream);
}

.auth-sub {
  margin: 0 0 20px;
  font-size: 13.5px;
  color: rgba(245, 239, 227, 0.7);
  line-height: 1.5;
}

.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}

.auth-notice {
  font-size: 13.5px;
  color: var(--aqua-light);
  margin: -4px 0 16px;
  line-height: 1.5;
}

#authToggleMode {
  display: block;
  margin: 14px auto 0;
  text-align: center;
}

/* ---- Section labels & new form elements ---- */

.section-label {
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--cream);
  margin: 14px 0 -4px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 239, 227, 0.12);
}

.options .section-label:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.option-group textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  font-family: 'Lato', sans-serif;
  background: var(--navy-light);
  color: var(--cream);
  border: 1px solid rgba(245, 239, 227, 0.18);
  border-radius: 10px;
  resize: vertical;
  line-height: 1.5;
}

.option-group textarea::placeholder {
  color: rgba(245, 239, 227, 0.4);
}

.option-group textarea:focus-visible {
  outline: 2px solid var(--aqua-light);
  outline-offset: 2px;
}

.char-count {
  text-align: right;
  font-size: 12px;
  color: rgba(245, 239, 227, 0.45);
  margin-top: 5px;
}

.extras-locked {
  border: 1px solid rgba(217, 162, 39, 0.35);
  background: rgba(217, 162, 39, 0.07);
  border-radius: 10px;
  padding: 14px 16px;
}

.extras-locked p {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: rgba(245, 239, 227, 0.75);
}

.extras-locked strong { color: var(--gold); }


/* ---- Four-panel control grid ---- */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.panel {
  background: rgba(245, 239, 227, 0.04);
  border: 1px solid rgba(245, 239, 227, 0.12);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel-title {
  font-family: 'Source Serif 4', serif;
  font-size: 17px;
  font-weight: 600;
  color: var(--cream);
  margin: 0;
}

/* ---- Chips: the yes/no options ---- */

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 239, 227, 0.12);
}

.chip {
  font-family: 'Lato', sans-serif;
  font-size: 14px;
  font-weight: 700;
  padding: 11px 15px;
  min-height: 44px;
  color: var(--cream);
  background: transparent;
  border: 1px solid rgba(245, 239, 227, 0.25);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.chip:hover:not(:disabled) {
  border-color: var(--aqua-light);
  color: var(--aqua-light);
}

.chip[aria-pressed="true"] {
  background: var(--aqua);
  border-color: var(--aqua);
  color: var(--navy);
}

.chip[aria-pressed="true"]:hover {
  background: var(--aqua-light);
  border-color: var(--aqua-light);
  color: var(--navy);
}

.chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.chip:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* The pool yes/no selector. Sits at the top of the pool panel and controls
   everything below it, so it gets a rule under it to separate it from the
   options it switches on and off. */
.pool-mode-group {
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(245, 239, 227, 0.18);
}

.pool-mode-group select {
  font-weight: 600;
}

/* ---- Install-to-home-screen bar ----
   Fixed to the bottom so it is visible without scrolling, which matters on a
   phone held one-handed in someone's back yard. Sits above the iOS home
   indicator via safe-area-inset. */

.install-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--navy-light);
  border: 1px solid rgba(245, 239, 227, 0.22);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.install-icon {
  width: 40px;
  height: 40px;
  border-radius: 9px;
  flex: 0 0 auto;
}

.install-text {
  margin: 0;
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.35;
  color: var(--cream);
}

.install-btn {
  flex: 0 0 auto;
  background: var(--aqua);
  color: var(--navy);
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.install-btn:hover { background: var(--aqua-light); }

.install-dismiss {
  flex: 0 0 auto;
  background: none;
  border: 0;
  color: rgba(245, 239, 227, 0.6);
  font-size: 22px;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
}

.install-dismiss:hover { color: var(--cream); }

.install-btn:focus-visible,
.install-dismiss:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .install-text { font-size: 13px; }
  .install-icon { width: 34px; height: 34px; }
}

/* ---- Instruction counter ---- */

.instruction-count {
  font-size: 13px;
  color: rgba(245, 239, 227, 0.55);
  margin: 16px 0 -4px;
  text-align: center;
}

@media (max-width: 560px) {
  .panel-grid { grid-template-columns: 1fr; gap: 12px; }
  .panel { padding: 16px; }
}

/* ---- Dictation (microphone) ----
 * Sits inside the free-text box, bottom-right. 44px tap target so it works
 * with a thumb on a phone. Does NOT touch header/brand styles.
 */

.extras-wrap { position: relative; }

.extras-wrap textarea {
  /* Room so typed text never runs under the button. */
  padding-right: 56px;
}

.mic-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  background: rgba(14, 42, 71, 0.65);
  border: 1px solid rgba(245, 239, 227, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.mic-btn:hover { border-color: var(--aqua-light); color: var(--aqua-light); }

/* Recording. Filled so it reads at a glance in daylight, plus a pulse so
 * there is no doubt it is live. */
.mic-btn[aria-pressed="true"] {
  background: #C0392B;
  border-color: #C0392B;
  color: #fff;
  animation: mic-pulse 1.4s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.55); }
  50%      { box-shadow: 0 0 0 9px rgba(192, 57, 43, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .mic-btn[aria-pressed="true"] { animation: none; }
}

.mic-hint {
  font-size: 13px;
  color: rgba(245, 239, 227, 0.6);
  margin: 6px 0 0;
}
