/* =========================================================================
   Tell Tale — "Leave a memory" (public submission page)
   Same hardware identity as the main site: putty + charcoal plastics,
   oxide red, cyan, amber LCD, holographic foil. Mobile-first.
   ========================================================================= */
:root {
  --putty: #E6E1D5;
  --putty-deep: #DAD4C4;
  --panel: #26272B;
  --panel-2: #1B1C20;
  --ink: #26272B;
  --paper: #F2EEE3;
  --muted: #6E6A5E;
  --oxide: #D14B34;
  --oxide-deep: #A9361F;
  --cyan: #2FB5BC;
  --lcd-bg: #14160F;
  --lcd: #FFB84D;
  --line: #C7C0AE;
  --foil: linear-gradient(100deg, #FF7AC8, #8E7BFF, #4CC9F0, #7BE495, #FFD166, #FF7AC8);
  --cond: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Barlow", -apple-system, system-ui, sans-serif;
  --pix: "VT323", ui-monospace, monospace;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255,255,255,0.55), transparent 60%),
    var(--putty);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  min-height: 100vh;
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 1rem; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

/* ---------- foil + LCD primitives ---------- */
.holo-bar { height: 8px; background: var(--foil); background-size: 300% 100%; animation: holo-slide 14s linear infinite; }
@keyframes holo-slide { to { background-position: 300% 0; } }

.lcd {
  font-family: var(--pix);
  background: var(--lcd-bg);
  color: var(--lcd);
  padding: 0.3rem 0.7rem 0.22rem;
  border-radius: 6px;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 0 6px rgba(255,184,77,0.45);
}
.small-lcd { font-size: 0.95rem; }

/* ---------- below the shared nav (ui/nav.css) ---------- */
#main { padding-top: 1.4rem; }
.signed-note { margin: 0.9rem 0 0; font-size: 0.92rem; line-height: 1.5; color: var(--muted); }
.signed-note b { color: var(--ink); }
.signed-note a, .done a { color: var(--oxide); }

/* ---------- faceplate ---------- */
.face {
  background: var(--panel);
  color: var(--paper);
  border-radius: 18px;
  padding: 2rem 1.3rem 1.5rem;
  position: relative;
  box-shadow: 0 18px 44px rgba(38,39,43,0.32), inset 0 1px 0 rgba(255,255,255,0.09);
}
.screw { position: absolute; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #8b8d92, #3c3d41); }
.screw::after { content: ""; position: absolute; left: 1px; right: 1px; top: 4px; height: 2px; background: #202125; transform: rotate(var(--r, 35deg)); }
.screw.tl { top: 10px; left: 10px; } .screw.tr { top: 10px; right: 10px; --r: -20deg; }
.screw.bl { bottom: 10px; left: 10px; --r: 70deg; } .screw.br { bottom: 10px; right: 10px; --r: 10deg; }

.kicker { font-family: var(--pix); color: var(--cyan); letter-spacing: 0.24em; text-transform: uppercase; margin: 0 0 0.4rem; font-size: 1.05rem; }
h1 {
  font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.01em; line-height: 0.92; margin: 0;
  font-size: clamp(3rem, 13vw, 5.6rem);
}
h1 .ox { color: var(--oxide); }
.stripes { display: flex; height: 10px; margin: 1rem 0 1.1rem; border-radius: 2px; overflow: hidden; }
.stripes i { flex: 1; }
.stripes i:nth-child(1) { background: var(--oxide); flex: 3; }
.stripes i:nth-child(2) { background: var(--cyan); flex: 2; }
.stripes i:nth-child(3) { background: var(--foil); flex: 2; }
.face .sub { color: #CFCABB; margin: 0 0 0.9rem; max-width: 38rem; }
.face .sub.small { font-size: 0.92rem; color: #A9A599; margin: 0; }

/* ---------- J-card form ---------- */
.jcard { margin: 1.4rem 0 2rem; display: grid; gap: 1rem; }
.track {
  border: 0; margin: 0; padding: 0; min-width: 0;
  display: grid; grid-template-columns: 34px 1fr;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset, 0 8px 22px rgba(38,39,43,0.12);
  overflow: hidden;
}
.spine {
  background: var(--oxide);
  color: var(--paper);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 1rem;
  position: relative;
}
.spine::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 4px; background: var(--foil); background-size: 100% 300%; opacity: 0.85; }
.spine-b { background: var(--cyan); }
.spine span { font-family: var(--pix); font-size: 1.2rem; writing-mode: vertical-rl; transform: rotate(180deg); letter-spacing: 0.15em; }
.track-body { padding: 1.05rem 1rem 1.2rem; min-width: 0; }
legend {
  float: left; width: 100%; padding: 0; margin: 0 0 0.6rem;
  font-family: var(--cond); font-weight: 800; text-transform: uppercase;
  font-size: 1.65rem; line-height: 1; letter-spacing: 0.02em;
}
legend + * { clear: both; }
.tno { font-family: var(--pix); font-weight: 400; color: var(--oxide); font-size: 1.3rem; margin-right: 0.25rem; }
.req { font-style: normal; font-family: var(--pix); font-size: 0.95rem; letter-spacing: 0.06em; color: var(--oxide); text-transform: uppercase; font-weight: 400; white-space: nowrap; }
legend .req { margin-left: 0.4rem; display: inline-block; }
.opt { font-family: var(--pix); font-size: 0.95rem; color: var(--muted); text-transform: uppercase; font-weight: 400; letter-spacing: 0.06em; }
.lede { margin: 0 0 0.9rem; color: #4a4840; }

.field { margin: 0 0 1rem; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 600; margin-bottom: 0.3rem; line-height: 1.3; }
.row { display: grid; gap: 0 1rem; }
input[type=text], input[type=email], textarea {
  width: 100%;
  background: #FBF8F0;
  border: 0;
  border-bottom: 2px solid var(--line);
  border-radius: 6px 6px 0 0;
  padding: 0.65rem 0.7rem;
  font-size: 1.05rem;
  transition: border-color 0.15s, background 0.15s;
  /* ruled J-card lines */
  background-image: linear-gradient(transparent calc(100% - 1px), rgba(199,192,174,0.0) 0);
}
textarea {
  resize: vertical; min-height: 9rem; line-height: 1.75rem;
  background-image: repeating-linear-gradient(to bottom, transparent 0 calc(1.75rem - 1px), rgba(47,181,188,0.18) calc(1.75rem - 1px) 1.75rem);
  background-position: 0 0.62rem;
  background-attachment: local;
}
input::placeholder, textarea::placeholder { color: #A39E90; }
input:focus, textarea:focus { outline: none; border-bottom-color: var(--cyan); background-color: #fff; }
[aria-invalid=true] { border-bottom-color: var(--oxide) !important; background-color: #FFF4F1 !important; }
.hint { margin: 0.3rem 0 0; font-size: 0.86rem; color: var(--muted); }
.field-error { margin: 0.3rem 0 0; font-size: 0.88rem; color: var(--oxide-deep); font-weight: 600; }

/* ---------- the deck ---------- */
.deck {
  position: relative;
  background: linear-gradient(180deg, #2c2d32, var(--panel-2));
  border-radius: 16px;
  padding: 1.6rem 1rem 1rem;
  color: var(--paper);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 10px 24px rgba(27,28,32,0.35);
}
.deck-lcd { display: flex; justify-content: space-between; gap: 0.6rem; font-size: 1.25rem; margin-bottom: 0.9rem; }
#lcd-mode.rec { color: #ff6b57; text-shadow: 0 0 8px rgba(255,90,70,0.7); }
#lcd-mode.rec::before { content: "● "; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

.cassette { max-width: 340px; margin: 0 auto; filter: drop-shadow(0 8px 10px rgba(0,0,0,0.45)); }
.cassette-svg { width: 100%; height: auto; display: block; }
.cs-label { font-family: var(--cond); font-weight: 800; font-size: 17px; fill: #26272B; letter-spacing: 0.04em; }
.reel { transform-box: view-box; }
.deck.rolling .reel { animation: spin 2.2s linear infinite; }
.deck.rolling .reel-r { animation-duration: 1.7s; }
.deck.recording .cassette-svg > rect:first-of-type { stroke: var(--oxide); }
@keyframes spin { to { transform: rotate(-360deg); } }

.vu { display: block; width: 100%; max-width: 340px; height: 28px; margin: 0.8rem auto 0; background: var(--lcd-bg); border-radius: 6px; box-shadow: inset 0 2px 6px rgba(0,0,0,0.7); }

.transport { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.45rem; margin-top: 0.9rem; }
.key {
  appearance: none; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #E9E4D8, #CFC8B7);
  color: var(--ink);
  border-radius: 8px 8px 10px 10px;
  padding: 0.65rem 0.2rem 0.55rem;
  min-height: 64px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
  box-shadow: 0 5px 0 #8f897b, 0 7px 10px rgba(0,0,0,0.35), inset 0 1px 0 #fff;
  transition: transform 0.06s, box-shadow 0.06s;
  -webkit-tap-highlight-color: transparent;
}
.key:active:not(:disabled), .key[aria-pressed=true] { transform: translateY(4px); box-shadow: 0 1px 0 #8f897b, 0 2px 4px rgba(0,0,0,0.35), inset 0 1px 0 #fff; }
.key:disabled { opacity: 0.42; cursor: not-allowed; }
.klabel { font-family: var(--cond); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.92rem; }
.glyph { display: block; width: 16px; height: 16px; }
.rec-dot { border-radius: 50%; background: var(--oxide); box-shadow: 0 0 0 2px rgba(209,75,52,0.25); }
.key-rec[aria-pressed=true] .rec-dot { background: #ff3b24; box-shadow: 0 0 10px 3px rgba(255,59,36,0.7); }
.stop-sq { background: var(--ink); border-radius: 2px; width: 14px; height: 14px; }
.play-tri { width: 0; height: 0; border-left: 15px solid var(--ink); border-top: 9px solid transparent; border-bottom: 9px solid transparent; }
.erase-x { position: relative; }
.erase-x::before, .erase-x::after { content: ""; position: absolute; left: 7px; top: 0; width: 3px; height: 16px; background: var(--ink); border-radius: 2px; transform: rotate(45deg); }
.erase-x::after { transform: rotate(-45deg); }
.deck-note { margin: 0.9rem 0 0; font-size: 0.9rem; color: #CFCABB; text-align: center; min-height: 1.4em; }

.or { display: flex; align-items: center; gap: 0.8rem; margin: 1rem 0; color: var(--muted); font-family: var(--pix); font-size: 1.15rem; text-transform: uppercase; letter-spacing: 0.2em; }
.or::before, .or::after { content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--line) 0 6px, transparent 6px 10px); }

.file-btn {
  display: inline-flex !important; align-items: center; gap: 0.6rem; cursor: pointer;
  background: var(--putty); border: 2px dashed var(--line); border-radius: 10px;
  padding: 0.75rem 1rem; font-weight: 600; width: 100%;
}
.file-btn:hover { border-color: var(--cyan); }
input[type=file]:focus-visible + .hint, .file-field:focus-within .file-btn { outline: 3px solid var(--cyan); outline-offset: 2px; }
.fb-icon { font-size: 1.2rem; color: var(--oxide); }
.file-chip {
  display: inline-flex; align-items: center; gap: 0.5rem; margin: 0.5rem 0 0;
  font-family: var(--pix); font-size: 1.05rem; background: var(--lcd-bg); color: var(--lcd);
  border-radius: 6px; padding: 0.2rem 0.6rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- map ---------- */
.map-wrap { border-radius: 12px; overflow: hidden; border: 3px solid var(--panel); margin-bottom: 1rem; background: var(--panel); }
.map { height: 300px; background: #cfc9bb; }
.map-wrap.no-map .map { display: none; }
.map-tools { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.55rem; flex-wrap: wrap; }
.chip-btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 999px;
  background: var(--cyan); color: #0e2c2e; font-weight: 700; padding: 0.5rem 0.95rem;
  font-family: var(--cond); text-transform: uppercase; letter-spacing: 0.06em; font-size: 1rem;
}
.chip-btn:disabled { opacity: 0.6; }
.leaflet-container { font-family: var(--body); }
.tt-pin { width: 28px; height: 28px; position: relative; }
.tt-pin::before {
  content: ""; position: absolute; left: 2px; top: 0; width: 24px; height: 24px;
  border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--oxide); border: 3px solid var(--paper); box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

/* ---------- photo ---------- */
.photo-row { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: start; }
.polaroid {
  display: block; width: 132px; cursor: pointer; background: #fff; padding: 8px 8px 0;
  box-shadow: 0 6px 14px rgba(38,39,43,0.22); transform: rotate(-2.5deg); transition: transform 0.2s;
}
.polaroid:hover, #f-photo:focus-visible ~ * .polaroid { transform: rotate(0deg); }
.photo-row:focus-within .polaroid { outline: 3px solid var(--cyan); outline-offset: 3px; }
.pol-img { display: grid; place-items: center; aspect-ratio: 1; background: var(--putty-deep) center/cover no-repeat; }
.pol-empty { font-family: var(--cond); font-weight: 700; text-transform: uppercase; color: var(--muted); font-size: 0.95rem; }
.pol-cap { display: block; font-family: "Permanent Marker", var(--cond); font-size: 0.85rem; padding: 0.35rem 0 0.45rem; text-align: center; color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-btn { appearance: none; background: none; border: 0; padding: 0; color: var(--oxide-deep); text-decoration: underline; cursor: pointer; font-weight: 600; margin-top: 0.4rem; }

/* ---------- consent + send ---------- */
.check { display: grid; grid-template-columns: 28px 1fr; gap: 0.6rem; align-items: start; margin: 0 0 0.9rem; }
.check input {
  appearance: none; width: 26px; height: 26px; margin: 0.1rem 0 0; cursor: pointer;
  border: 2px solid var(--ink); border-radius: 5px; background: #FBF8F0; display: grid; place-items: center;
}
.check input:checked { background: var(--oxide); border-color: var(--oxide); }
.check input:checked::after { content: ""; width: 7px; height: 13px; border: solid var(--paper); border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg); }
.check input[aria-invalid=true] { border-color: var(--oxide); box-shadow: 0 0 0 3px rgba(209,75,52,0.25); }
.check label { cursor: pointer; font-size: 0.97rem; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.send-row { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: center; margin: 1.3rem 0 0.4rem; }
.send {
  appearance: none; border: 0; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.8rem;
  background: var(--oxide); color: var(--paper);
  font-family: var(--cond); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
  font-size: 1.45rem; padding: 0.8rem 1.4rem; border-radius: 10px; min-height: 56px;
  box-shadow: 0 5px 0 var(--oxide-deep), 0 10px 18px rgba(169,54,31,0.3);
  transition: transform 0.06s, box-shadow 0.06s, filter 0.15s;
  flex: 1 1 auto;
}
.send:hover { filter: brightness(1.06); }
.send:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--oxide-deep), 0 3px 8px rgba(169,54,31,0.3); }
.send:disabled { filter: grayscale(0.5) brightness(0.9); cursor: progress; }
.send .arrow { font-size: 1.3rem; }
.send.ghost { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 2px #5a5b60; }
.send-lcd { flex: 1 1 12rem; text-align: center; font-size: 1.2rem; }
.fineprint { font-size: 0.82rem; color: var(--muted); margin: 1rem 0 0; line-height: 1.5; border-top: 1px dashed var(--line); padding-top: 0.9rem; }

.error-summary {
  background: #FFF1EC; border: 2px solid var(--oxide); border-radius: var(--radius); padding: 0.9rem 1.1rem;
}
.error-summary:focus { outline: 3px solid var(--cyan); }
.es-title { margin: 0 0 0.35rem; font-weight: 700; color: var(--oxide-deep); }
.error-summary ul { margin: 0; padding-left: 1.2rem; }
.error-summary a { color: var(--oxide-deep); font-weight: 600; }

/* ---------- success ---------- */
.done { padding-bottom: 2rem; }
.done:focus { outline: none; }
.envelope { margin-top: 0.4rem; overflow: hidden; }
.envelope::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 14px;
  background: repeating-linear-gradient(135deg, var(--oxide) 0 14px, var(--paper) 14px 28px, var(--cyan) 28px 42px, var(--paper) 42px 56px);
  opacity: 0.9;
}
.stamp {
  position: absolute; right: 1.3rem; top: 2rem; width: 86px; height: 100px;
  background: var(--foil); background-size: 200% 200%; animation: holo-slide 10s linear infinite;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--pix); color: var(--panel); font-size: 1.05rem; line-height: 1; letter-spacing: 0.1em;
  transform: rotate(6deg);
  -webkit-mask: radial-gradient(circle 5px at 5px 5px, transparent 98%, #000) -5px -5px / 12px 12px;
          mask: radial-gradient(circle 5px at 5px 5px, transparent 98%, #000) -5px -5px / 12px 12px;
}
.done h1 { padding-right: 90px; }
.ref { display: inline-block; font-size: 1.35rem; margin: 0.2rem 0 1.3rem; }
.done-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; }

.foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1rem 2.5rem; color: var(--muted); font-size: 0.85rem; flex-wrap: wrap; }

/* ---------- larger screens ---------- */
@media (min-width: 640px) {
  .face { padding: 2.4rem 2.2rem 1.9rem; }
  .track { grid-template-columns: 46px 1fr; }
  .track-body { padding: 1.4rem 1.6rem 1.6rem; }
  .row { grid-template-columns: 1.4fr 1fr; }
  .deck { padding: 1.8rem 1.6rem 1.2rem; }
  .map { height: 360px; }
  .send { flex: 0 0 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .holo-bar, .stamp, .deck.rolling .reel, #lcd-mode.rec::before { animation: none !important; }
  .polaroid { transform: none; }
}
