/* Submission page: frosted panels set into the glass block wall.
   wall.js sets --cell (one block, in px), --inset (half a mortar joint),
   --across (whole blocks across on phones) and the wall position, then adds
   .is-wall to <html>. Without it the panels simply stack on a plain background. */

.page-submit {
  --frost: rgba(255, 255, 255, 0.88);
  --joint: rgba(4, 47, 40, 0.07);
  --pad: clamp(16px, calc(var(--cell, 80px) * 0.26), 34px);
  /* Space between a mortar line and the content inside its block. Matches the
     panel padding plus the inset, so text lines up across panels. */
  --g: calc(var(--pad) + var(--inset, 0px));
  background: #e3e7e6;
}

/* ---------- The wall ---------- */
html.is-wall {
  background: #cfd6d4 url("/assets/glass-wall.webp") repeat-y;
  background-position: var(--wall-x) var(--wall-y);
  background-size: var(--wall-w) var(--wall-h);
}
html.is-wall .page-submit { background: transparent; }

/* ---------- Panels ---------- */
.stage {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 8px;
}
.is-wall .stage {
  position: relative;
  max-width: none;
  margin: 0;
  padding: 0;
  display: block;
}

.tile {
  display: flex;
  flex-direction: column;
  padding: var(--pad);
  border-radius: calc(var(--cell, 80px) * 0.035);
  background-color: var(--frost);
  /* The mortar lines carry on faintly behind the frost. */
  background-image:
    linear-gradient(90deg, var(--joint) 0 1px, transparent 1px),
    linear-gradient(180deg, var(--joint) 0 1px, transparent 1px);
  background-size: var(--cell, 80px) var(--cell, 80px);
  background-position: calc(var(--inset, 0px) * -1) calc(var(--inset, 0px) * -1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.75),
    0 1px 1px rgba(4, 47, 40, 0.1),
    0 8px 22px rgba(4, 47, 40, 0.12);
}
.is-wall .tile { position: absolute; }

.tile-body {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

/* ---------- Logo: white, straight on the wall, top left ---------- */
.tile.tile-logo {
  flex-direction: row;
  align-items: center;
  padding: 0 var(--pad);
  min-height: 64px;
  background: none;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.tile-logo img {
  display: block;
  width: 100%;
  max-width: 260px;
  height: auto;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 12px rgba(0, 0, 0, 0.45));
  transition: opacity 0.15s;
}
.tile-logo:hover img { opacity: 0.85; }
.tile-logo:focus-visible { outline: 2px solid #fff; outline-offset: 2px; border-radius: 4px; }
html:not(.is-wall) .tile-logo { justify-self: start; width: 200px; background: #5f6b68; border-radius: 4px; }

/* ---------- Title ---------- */
.tile-intro .tile-body { justify-content: center; }
.tile-intro h1 {
  font-size: clamp(28px, calc(var(--cell, 80px) * 0.42), 64px);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.45em;
}
.lede { margin: 0; font-size: 17px; line-height: 1.5; max-width: 32em; text-wrap: pretty; }

/* ---------- Form, all sizes ---------- */
.tile-form .tile-body { justify-content: flex-start; }
.tile-form .field { margin-bottom: 20px; }
.tile-form .drop { background: rgba(4, 47, 40, 0.035); min-height: 180px; }
.tile-form .drop:hover, .tile-form .drop.is-over { background: rgba(4, 47, 40, 0.07); }
.tile-form .consent { color: var(--muted); font-size: 13px; line-height: 1.45; }
.form-end { display: flex; flex-direction: column; }
.photo-side { margin: 8px 0 20px; }

/* ---------- Form on the wall, phones and portrait ----------
   The form's grid tracks are blocks, pulled out to the mortar lines with
   negative margins; each item sits --g in from the lines, the same as text in
   every other panel. The photo box spans the panel and is 3 blocks tall. */
.is-wall .form-grid {
  display: grid;
  grid-template-columns: repeat(var(--across), var(--cell));
  grid-template-rows: repeat(3, var(--cell));
  grid-auto-rows: auto;
  margin: calc(var(--g) * -1) calc(var(--g) * -1) 0;
}
.is-wall .form-grid > * { grid-column: 1 / -1; padding-inline: var(--g); min-width: 0; }
.is-wall .form-grid .drop {
  grid-column: 1 / -1;
  grid-row: 1 / span 3;
  margin: var(--g);
  padding: 0;
  min-height: 0;
}
/* The box says "Choose a photo", so no separate label; a tag on the photo
   shows it can be changed. */
.is-wall .form-grid .photo-side { display: none; }
.is-wall .form-main { padding-top: 4px; }
.is-wall .drop-preview { position: absolute; inset: 0; width: 100%; height: 100%; max-height: none; }
.is-wall .drop-empty { text-align: center; padding-inline: 8px; }

.done {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-block: 24px;
}
.done p { margin: 0 0 20px; }
.done .submit { width: auto; padding-inline: 32px; }

/* ---------- Desktop, landscape ---------- */
.is-wide .tile-logo img { width: 80%; max-width: 208px; }
.is-wide .tile-intro h1 { font-size: clamp(36px, calc(var(--cell) * 0.5), 76px); }
.is-wide .lede { font-size: clamp(16px, calc(var(--cell) * 0.17), 20px); }

/* Form text grows a little with the blocks on large screens. */
.is-wide .tile-form { font-size: clamp(15px, calc(var(--cell) * 0.13), 18px); padding: 0; }
.is-wide .tile-form input[type="text"] { font-size: 1em; padding: 0.75em 0.9em; }
.is-wide .tile-form .handle input { padding-left: 2em; }
.is-wide .tile-form .note { font-size: 0.85em; }
.is-wide .tile-form .consent { font-size: 0.78em; margin: 0; }
.is-wide .tile-form .submit { font-size: 0.95em; padding-block: 0.95em; }

/* 9 x 3 blocks. The photo fills the left 3 x 3. To its right, a two-column
   grid (3 blocks each): Location over the permission tick, Instagram over
   Send. Labels line up with the top of the photo, the bottom row with its
   bottom; the gap between the columns sits on a mortar line. */
.is-wide .form-grid {
  grid-template-columns: repeat(9, var(--cell));
  grid-template-rows: repeat(3, minmax(var(--cell), auto));
  margin: calc(var(--inset) * -1);
}
.is-wide .form-grid .drop { grid-column: 1 / span 3; grid-row: 1 / span 3; }
.is-wide .form-grid .form-main {
  grid-column: 4 / span 6;
  grid-row: 1 / span 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: var(--g);
}
.is-wide .fields-row,
.is-wide .form-end {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: calc(var(--g) * 2);
  align-items: end;
}
.is-wide .fields-row { align-items: start; }
.is-wide .fields-row .field { margin: 0; }
.is-wide .form-end .error,
.is-wide .form-end .turnstile { grid-column: 1 / -1; margin-bottom: 12px; }
.is-wide .form-end .submit { width: 100%; }

/* After a photo is chosen, tapping or clicking it opens the picker again.
   Phones always show the tag; desktop shows it on hover. */
.is-wall .drop.has-photo::after {
  content: "Change photo";
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(4, 47, 40, 0.75);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: opacity 0.15s;
  pointer-events: none;
}
.is-wide .drop.has-photo::after { opacity: 0; }
.is-wide .drop.has-photo:hover::after,
.is-wide .drop.has-photo:focus-within::after { opacity: 1; }
