/* Our Album: shared look for every screen. No inline styles anywhere in the
   app; any value that must change at runtime is set with
   el.style.setProperty on a custom property, never a style attribute. */

@font-face {
  font-family: 'Instrument Sans';
  src: url('/fonts/InstrumentSans-Variable.woff2') format('woff2-variations'),
    url('/fonts/InstrumentSans-Variable.woff2') format('woff2');
  font-weight: 400 700;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Global Constraints, "Look": every color as a custom property. */
  --night: #0a0a0b;
  --moon: #f4f3ef;
  --moon-quiet: #aeb0b5;
  --paper: #ffffff;
  --ink: #111214;
  --ink-quiet: #55585e;
  --night-btn: #26262a;
  --night-line: rgba(255, 255, 255, 0.14);
  --spark: #ff4f66;
  --marigold: #ffbd2e;
  --marigold-ink: #2b2420;

  /* Derived hairlines, not colors of their own: a faint line on paper and a
     calm card wash, both read from --ink so they stay in the approved palette. */
  --line: rgba(17, 18, 20, 0.1);
  --wash: rgba(17, 18, 20, 0.04);
  /* A resting field border needs real contrast against paper (>=3:1), not
     just a hairline. */
  --field-border: #85888e;
  /* living-room.html's soft glow under the Marigold main button. */
  --marigold-glow: rgba(214, 138, 0, 0.42);

  --radius-card: 24px;
  --radius-btn: 24px;
  --radius-btn-main: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img,
svg {
  display: block;
}

#app {
  min-height: 100vh;
}

/* ---------- type ---------- */

.title {
  font-stretch: 78%;
  font-weight: 650;
  letter-spacing: -0.012em;
  line-height: 1.1;
  margin: 0;
}

.meta {
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-quiet);
  margin: 0;
}

.dark .meta {
  color: var(--moon-quiet);
}

/* ---------- the wordmark ---------- */

.mark {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-stretch: 78%;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.dark .mark {
  color: var(--moon);
}

.mark-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  align-self: center;
  margin-right: 8px;
}

/* gallery.html's signature dot: .3em square, .1em after the wordmark. */
.mark::after {
  content: '';
  width: 0.3em;
  height: 0.3em;
  margin-left: 0.1em;
  border-radius: 50%;
  background: var(--spark);
}

/* ---------- dark scope ---------- */

.dark {
  background: var(--night);
  color: var(--moon);
}

/* ---------- buttons: 48px, the main action 56px and Marigold ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 48px;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--paper);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.dark .btn {
  background: var(--night-btn);
  color: var(--moon);
  box-shadow: inset 0 0 0 1px var(--night-line);
}

.btn-main {
  height: 56px;
  border-radius: var(--radius-btn-main);
  background: var(--marigold);
  color: var(--marigold-ink);
  font-size: 19px;
  /* living-room.html's .btn-sun: a soft Marigold glow and an inset top
     highlight, not just a flat fill. */
  box-shadow: 0 8px 16px -8px var(--marigold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* .dark .btn (below) would otherwise win on specificity and turn the main
   action into a plain dark button; it stays Marigold under .dark too. */
.dark .btn-main {
  background: var(--marigold);
  color: var(--marigold-ink);
  box-shadow: 0 8px 16px -8px var(--marigold-glow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.btn-quiet {
  background: transparent;
  color: var(--ink-quiet);
  box-shadow: none;
  text-decoration: underline;
  font-weight: 500;
}

.dark .btn-quiet {
  /* Same reason as .dark .btn-main: stays transparent, not night-btn's fill. */
  background: transparent;
  color: var(--moon-quiet);
  box-shadow: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

/* ---------- forms ---------- */

.field {
  display: block;
  margin: 0 0 18px;
}

.field label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 8px;
}

.field input {
  display: block;
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  /* A real border, not a box-shadow: it survives Windows High Contrast
     (where box-shadow is dropped), and it can't out-specificity the focus
     ring below, since they're different properties. */
  border: 1.5px solid var(--field-border);
  background: var(--paper);
  color: var(--ink);
  font-family: inherit;
  font-size: 17px;
}

.field input::placeholder {
  color: var(--ink-quiet);
}

.field input:focus-visible {
  border-color: var(--ink);
}

.dark .field input:focus-visible {
  border-color: var(--marigold);
}

.field-code input {
  letter-spacing: 0.3em;
  text-align: center;
  font-size: 22px;
}

.form-error {
  margin: -4px 0 18px;
  padding: 10px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--ink);
  background: var(--wash);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.4;
}

.dark .form-error {
  border-left-color: var(--moon);
  background: rgba(255, 255, 255, 0.08);
  color: var(--moon);
}

/* ---------- focus ---------- */

:focus {
  outline: none;
}

/* A plain outline, not box-shadow: box-shadow loses to .field input's own
   border-via-box-shadow on specificity (that's exactly the bug this
   replaces), and outline survives forced-colors mode too. Ink on paper,
   Marigold under .dark. */
:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.dark :focus-visible {
  outline-color: var(--marigold);
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- sheet: a bottom sheet with a backdrop ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(10, 10, 11, 0.45);
  z-index: 50;
}

.sheet {
  width: 100%;
  max-width: 480px;
  padding: 24px 20px calc(22px + env(safe-area-inset-bottom, 0px));
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
}

.sheet .title {
  font-size: 21px;
  margin: 0 0 8px;
}

.sheet-body {
  margin: 0 0 20px;
}

.sheet-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.sheet-actions .btn {
  flex: 1 1 0;
  height: 56px;
  /* Paired buttons share one label size (living-room.html's .acts), rather
     than the plain .btn's 16px next to .btn-main's 19px. */
  font-size: 17px;
}

/* ---------- toast: a small, transient notice ---------- */

.toast-stack {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 60;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: min(90vw, 420px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--night);
  color: var(--moon);
  font-size: 15px;
  line-height: 1.4;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}

/* ---------- .page: the shared gutter and width every screen so far uses ---------- */

.page {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: calc(48px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px))
    calc(40px + env(safe-area-inset-bottom, 0px)) calc(20px + env(safe-area-inset-left, 0px));
}

/* ---------- the sign-in screen ---------- */

.signin {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.signin-brand {
  margin: 0 0 40px;
  align-self: center;
}

.signin-card {
  width: 100%;
}

.signin-card .title {
  font-size: 28px;
  margin: 0 0 10px;
}

.signin-card .intro {
  margin: 0 0 28px;
}

.signin-card form {
  margin: 0;
}

.signin-foot {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* ---------- the family-home placeholder, and the "no family yet" screen ---------- */

.family-home > * + *,
.no-family > * + * {
  margin-top: 16px;
}

/* ---------- utility ---------- */

/* Hides a step's own content while a sheet is open over it, keeping layout
   and any sibling (the sign-in brand mark) in place: an open sheet already
   makes the page behind it inert, but a dimmed Marigold button showing
   through the backdrop still reads as a second main action next to the
   sheet's own. */
.card-hidden {
  visibility: hidden;
}
