/* Future Histories - the camera page.
   Cyanotype: the blueprint print that builders and early photographers shared. Prussian ground, paper type,
   one signal red that appears only while the camera is live. The clock is the loud thing; it gains weight as
   the three and a half minutes are spent. */

@font-face {
  font-family: "Archivo FH";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --prussian: #15375F;
  --deep: #0E2847;
  --wash: #2C5A94;
  --frost: #C3D5EB;
  --paper: #F4F7FB;
  --signal: #FF5A3C;
  --gutter: 16px;
  --radius-frame: 14px;
  --radius-control: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--prussian);
  color: var(--paper);
  font-family: "Archivo FH", "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
  font-variation-settings: "wdth" 100;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px var(--gutter) 8px;
  max-width: 1120px;
  margin: 0 auto;
}

.wordmark {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.1;
  font-weight: 760;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  letter-spacing: -0.01em;
}

.round-name { margin: 2px 0 0; color: var(--frost); font-size: 0.9375rem; }

.lang { display: flex; gap: 4px; flex-shrink: 0; }
.lang button {
  font: inherit;
  font-size: 0.875rem;
  color: var(--frost);
  background: none;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}
.lang button[aria-pressed="true"] { color: var(--paper); border-color: var(--frost); }

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter) 64px;
}

.step { padding: 20px 0 8px; }
.steps-rest .step { border-top: 1px solid rgba(195, 213, 235, 0.22); margin-top: 16px; }

h2 {
  margin: 0 0 10px;
  font-size: 1.1875rem;
  line-height: 1.3;
  font-weight: 650;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
h2 .n {
  font-stretch: 125%;
  font-variation-settings: "wdth" 125;
  font-weight: 300;
  color: var(--frost);
  min-width: 1ch;
}

.lede { margin: 0 0 16px; max-width: 34em; color: var(--frost); }

/* The viewfinder */
.frame {
  position: relative;
  background: var(--deep);
  border-radius: var(--radius-frame);
  overflow: hidden;
  aspect-ratio: 3 / 4;
  max-height: 68vh;
  width: 100%;
  margin: 0 auto;
}
.view, .take { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--deep); }
.take { object-fit: contain; }
.frame[data-facing="user"] .view { transform: scaleX(-1); }
.frame-note {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; text-align: center; color: var(--frost);
}
.budget { position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: rgba(195, 213, 235, 0.18); }
.budget span {
  display: block; height: 100%; width: 100%;
  background: var(--paper);
  transform: scaleX(0); transform-origin: left center;
}
.frame[data-mode="recording"] .budget span { background: var(--signal); }

/* The clock */
.clock-row { display: flex; align-items: baseline; gap: 12px; margin: 14px 0 6px; }
.clock {
  margin: 0;
  font-size: clamp(3.5rem, 17vw, 5.5rem);
  line-height: 0.95;
  font-stretch: 125%;
  font-variation-settings: "wdth" 125, "wght" 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.frame[data-mode="recording"] ~ .clock-row .clock { color: var(--signal); }
.clock-cap { margin: 0; color: var(--frost); font-variant-numeric: tabular-nums; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 0; }

button, .quiet, .primary { font: inherit; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px;
  padding: 0 22px;
  border: none;
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--prussian);
  font-weight: 700;
  cursor: pointer;
}
.primary:disabled { opacity: 0.45; cursor: not-allowed; }
.controls .primary { flex: 1 1 100%; }

.quiet {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--wash);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--paper);
  text-decoration: none;
  cursor: pointer;
}
.quiet:hover { border-color: var(--frost); }
.quiet:disabled { opacity: 0.45; cursor: not-allowed; }
body.locked .controls > :not(#save-copy) { display: none; }

.dot { width: 14px; height: 14px; border-radius: 50%; background: var(--signal); }
.square { width: 13px; height: 13px; border-radius: 2px; background: var(--signal); }

.file-pick { position: relative; overflow: hidden; }
.file-pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
.file-pick:focus-within { outline: 3px solid var(--paper); outline-offset: 2px; }

:focus-visible { outline: 3px solid var(--paper); outline-offset: 2px; }

/* Forms */
form { display: grid; gap: 6px; max-width: 34em; }
label { color: var(--frost); font-size: 0.9375rem; margin-top: 10px; }
input, select {
  font: inherit;
  color: var(--paper);
  background: var(--deep);
  border: 1px solid var(--wash);
  border-radius: var(--radius-control);
  min-height: 48px;
  padding: 10px 12px;
  width: 100%;
}
input:focus-visible, select:focus-visible { border-color: var(--paper); }
form .quiet { justify-self: start; margin-top: 12px; }

.hint { margin: 6px 0 0; color: var(--frost); font-size: 0.9375rem; max-width: 34em; }

.progress { height: 6px; border-radius: 3px; background: rgba(195, 213, 235, 0.18); overflow: hidden; margin: 14px 0 0; max-width: 34em; }
.progress span { display: block; height: 100%; width: 100%; background: var(--paper); transform: scaleX(0); transform-origin: left center; }

.status { margin: 0 0 12px; font-weight: 600; max-width: 34em; }
.notes {
  margin: 0 0 14px; padding: 12px 14px; max-width: 34em;
  border-left: 3px solid var(--paper);
  background: var(--deep);
}

.toast {
  position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(16px + env(safe-area-inset-bottom));
  margin: 0 auto; max-width: 34em;
  padding: 12px 14px;
  border-radius: var(--radius-control);
  background: var(--paper); color: var(--prussian);
  font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity 160ms ease;
}
.toast.show { opacity: 1; }
.toast.bad { background: var(--signal); color: var(--deep); }

/* The guide and the prompter */
.guide { margin: 0 0 16px; max-width: 34em; }
.guide summary { cursor: pointer; font-weight: 650; padding: 8px 0; }
.guide form { margin: 4px 0 10px; }
.guide form .quiet { justify-self: start; margin-top: 12px; }
.guide textarea {
  font: inherit; color: var(--paper); background: var(--deep); border: 1px solid var(--wash);
  border-radius: var(--radius-control); padding: 10px 12px; width: 100%; resize: vertical;
}
.guide .check { display: flex; gap: 10px; align-items: center; color: var(--paper); margin-top: 10px; }
.guide .check input { width: 20px; height: 20px; min-height: 0; accent-color: var(--paper); }
.beats { margin: 10px 0; padding-left: 1.3em; display: grid; gap: 6px; }
.beats b { font-variant-numeric: tabular-nums; font-weight: 600; }
.coach { margin: 8px 0; padding: 10px 12px; border-left: 3px solid var(--paper); background: var(--deep); white-space: pre-line; }
.questions { margin: 8px 0; padding-left: 1.2em; color: var(--frost); }
.prompter {
  position: absolute; left: 0; right: 0; bottom: 5px; max-height: 42%;
  overflow: hidden; padding: 12px 16px;
  background: rgba(14, 40, 71, 0.72);
}
.prompter p { margin: 0; font-size: 1.25rem; line-height: 1.45; white-space: pre-line; }
.frame[data-mode="recording"] .prompter p { animation: prompt var(--prompt-seconds, 210s) linear forwards; }
@keyframes prompt { from { transform: translateY(0); } to { transform: translateY(-100%); } }

[hidden] { display: none !important; }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  .step-record { position: sticky; top: 12px; }
  .steps-rest .step:first-child { border-top: none; margin-top: 0; }
  .frame { aspect-ratio: 4 / 3; }
  .controls .primary { flex: 0 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
  .frame[data-mode="recording"] .prompter p { animation: none; }
  .prompter { overflow-y: auto; }
}
