/* HAUSWORK web app. Base styles are copied from dropoff-intake.html (the Claude artifact version)
   so both look the same; additions for the PWA (lock, camera, viewer, install) are at the end. */
@font-face { font-family: "Idlewild"; font-weight: 700; font-display: block; src: url("../fonts/Idlewild-Bold.otf") format("opentype"); }
@font-face { font-family: "Idlewild"; font-weight: 300; font-display: block; src: url("../fonts/Idlewild-Light.otf") format("opentype"); }

/* Layout: phone-first, one question per screen. Question at the top in Idlewild,
   the answer control in the middle, Back / Next pinned to the bottom in the thumb zone. */
:root {
  --paper: #F3F2EB;
  --cream: #E7E5D8;
  --warm: #D0CEC2;
  --line: #BEBBAA;
  --ink: #33312E;
  --ink-soft: #5B5852;
  --rust: #E75635;
  --rust-ink: #B8381B;
  --navy: #0C3E64;
  --ok: #2F6B3A;
  --display: "Idlewild", "Futura", "Century Gothic", "Avenir Next", sans-serif;
  --body: "DM Sans", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.45; }
::selection { background: var(--rust); color: var(--paper); }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }

.app { min-height: 100%; display: grid; grid-template-rows: auto 1fr auto; max-width: 620px; margin: 0 auto; }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.top { padding-block: 14px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top-row img { height: 22px; width: auto; display: block; }
.where { font-size: 14px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--cream); }
.bar i { display: block; height: 100%; background: var(--rust); width: 0; transition: width .25s ease-out; }

main { padding-block: 26px 28px; display: grid; gap: 18px; align-content: start; }
h1 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: clamp(22px, 6.4vw, 32px); line-height: 1.08; margin: 0; text-wrap: balance; }
.hint { margin: 0; color: var(--ink-soft); font-size: 16px; max-width: 46ch; text-wrap: pretty; }

.choices { display: grid; gap: 10px; }
.choice {
  display: flex; align-items: center; gap: 14px; text-align: left; width: 100%;
  background: #FFFFFF; border: 2px solid var(--line); padding: 16px 16px; cursor: pointer; min-height: 64px;
}
.choice:hover { border-color: var(--ink); }
.choice[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.choice b { display: block; font-weight: 700; font-size: 18px; }
.choice span { display: block; font-size: 15px; opacity: .85; }
.choice .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; }
.choice[aria-pressed="true"] .dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--rust); }

.field { display: grid; gap: 6px; }
.field label { font-size: 15px; font-weight: 500; }
.input, textarea {
  width: 100%; background: #FFFFFF; border: 2px solid var(--line); padding: 14px 14px; font-size: 18px; border-radius: 0;
}
.input:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 120px; resize: vertical; }
.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dims .input { text-align: center; font-variant-numeric: tabular-nums; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 18px; color: var(--ink-soft); }
.money .input { padding-left: 30px; font-variant-numeric: tabular-nums; }

.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; font-size: 16px; }
.toggle input { width: 24px; height: 24px; accent-color: var(--ink); flex: none; }

.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 56px; height: 56px; border: 2px solid var(--ink); background: #FFFFFF; font-size: 26px; cursor: pointer; }
.stepper output { min-width: 72px; text-align: center; font-family: var(--display); font-weight: 700; font-size: 34px; font-variant-numeric: tabular-nums; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; background: var(--cream); overflow: hidden; max-width: 100%; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; background: var(--ink); color: var(--paper); font-size: 18px; line-height: 1; cursor: pointer; }
.thumb .busy { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; background: rgba(243,242,235,.85); }
.addphoto {
  display: grid; place-items: center; gap: 4px; aspect-ratio: 1; border: 2px dashed var(--ink); background: #FFFFFF; cursor: pointer; text-align: center; padding: 8px; font-weight: 700; font-size: 15px;
}
.addphoto input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.shotlist { margin: 0; padding-left: 20px; color: var(--ink-soft); font-size: 15px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.slot { position: relative; aspect-ratio: 1; background: #FFFFFF; border: 2px dashed var(--ink); display: grid; place-items: center; text-align: center; cursor: pointer; overflow: hidden; }
.slot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.slot:focus-within { outline: 3px solid var(--ink); outline-offset: 2px; }
.slot .need { display: grid; gap: 2px; font-weight: 700; font-size: 17px; }
.slot .need small { font-weight: 400; font-size: 13px; color: var(--ink-soft); }
.slot.filled { border-style: solid; cursor: default; }
.slot.filled img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot .tag { position: absolute; left: 0; bottom: 0; background: var(--ink); color: var(--paper); font-size: 13px; font-weight: 700; padding: 4px 8px; }
.slot .x { position: absolute; top: 4px; right: 4px; width: 32px; height: 32px; border: 0; background: var(--ink); color: var(--paper); font-size: 18px; line-height: 1; cursor: pointer; }
.slot .busy { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; background: rgba(243,242,235,.85); }
.slotcount { font-size: 15px; font-weight: 700; margin: 0; }
.extras-label { font-size: 15px; font-weight: 700; margin: 8px 0 0; }
.extras-label span { font-weight: 400; color: var(--ink-soft); }

.note { padding: 12px 14px; background: var(--cream); font-size: 15px; }
.note.warn { background: #FBE3DC; color: #7A2412; }
.note.good { background: #DCEBDD; color: #1F4A27; }

.summary { background: #FFFFFF; border: 2px solid var(--line); padding: 14px 16px; display: grid; gap: 6px; }
.summary h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 16px; margin: 0; }
.summary dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 15px; }
.summary dt { color: var(--ink-soft); }
.summary dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.summary .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.minibtn { border: 2px solid var(--ink); background: transparent; padding: 6px 12px; font-size: 14px; font-weight: 700; cursor: pointer; }
.minis { display: flex; gap: 6px; flex-wrap: wrap; }
.minis img { width: 56px; height: 56px; object-fit: cover; display: block; background: var(--cream); }

.actions { position: sticky; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); padding-block: 12px calc(12px + env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; }
.btn { flex: 1; min-height: 56px; border: 2px solid var(--ink); background: transparent; font-weight: 700; font-size: 17px; cursor: pointer; padding: 0 16px; }
.btn.primary { background: var(--ink); color: var(--paper); flex: 2; }
.btn.go { background: var(--rust); border-color: var(--rust); color: #FFFFFF; flex: 2; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* Home + team list */
.big { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 18px; min-height: 72px; background: var(--ink); color: var(--paper); border: 0; cursor: pointer; width: 100%; }
.big.alt { background: transparent; color: var(--ink); border: 2px solid var(--ink); font-size: 15px; min-height: 56px; }
.rush { background: var(--navy); color: var(--paper); padding: 14px 16px; font-size: 16px; }
.where.name { font-family: var(--display); font-weight: 700; letter-spacing: .1em; color: var(--ink); }
.rush b { font-family: var(--display); font-weight: 700; text-transform: uppercase; display: block; font-size: 14px; margin-bottom: 2px; letter-spacing: .04em; }
h2.sec { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 15px; margin: 8px 0 0; display: flex; align-items: center; gap: 10px; }
h2.sec::after { content: ""; flex: 1; height: 2px; background: var(--ink); }
.list { display: grid; gap: 10px; }
.card { background: #FFFFFF; border: 2px solid var(--line); }
.card > button { width: 100%; text-align: left; background: none; border: 0; padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; }
.card .who { font-weight: 700; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.card .meta { font-size: 14px; color: var(--ink-soft); grid-column: 1; }
.pill { grid-row: 1 / span 2; grid-column: 2; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 8px; }
.pill.new { background: var(--rust); color: #FFFFFF; }
.pill.entered { background: var(--cream); color: var(--ok); }
.detail { border-top: 1px solid var(--line); padding: 12px 14px 14px; display: grid; gap: 12px; }
.piece { display: grid; gap: 6px; }
.piece h3 { margin: 0; font-size: 16px; }
.piece dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; }
.piece dt { color: var(--ink-soft); }
.piece dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.piece .minis img { width: 88px; height: 88px; }
.empty { color: var(--ink-soft); font-size: 15px; margin: 0; }
footer.brand { padding-block: 20px 26px; display: flex; justify-content: center; }
footer.brand img { height: 34px; width: auto; display: block; opacity: .9; }

@media (prefers-reduced-motion: reduce) { .bar i { transition: none; } }

/* ---------- PWA additions ---------- */
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
.top { padding-top: max(14px, env(safe-area-inset-top, 0px)); }
.wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
button { touch-action: manipulation; }
.big { padding: 0 16px; line-height: 1.15; display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.big svg { width: 20px; height: 20px; flex: none; }
.minibtn { color: var(--ink); display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.minibtn svg { width: 16px; height: 16px; }
.slot { padding: 0; font: inherit; color: inherit; }
.slot.filled { cursor: pointer; }
.thumb { padding: 0; border: 0; cursor: pointer; }
.thumb .tag, .minis .tag { position: absolute; left: 0; bottom: 0; background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 700; padding: 3px 6px; }
.addphoto { font: inherit; font-weight: 700; font-size: 15px; color: var(--ink); }
.marksrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.marksrow .thumb { width: 56px; height: 56px; aspect-ratio: auto; }
.minis button { padding: 0; border: 0; background: none; cursor: pointer; display: block; }
.testnote { font-size: 15px; color: var(--ink-soft); margin: 0; }
.home-foot { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }

/* Store PIN lock */
.lock { display: grid; gap: 22px; justify-items: center; text-align: center; padding-top: 10px; }
.lock h1 { text-align: center; }
.pin-dots { display: flex; gap: 16px; height: 18px; }
.pin-dots i { width: 16px; height: 16px; border: 2px solid var(--ink); border-radius: 50%; }
.pin-dots i.on { background: var(--ink); }
.pin-dots.shake { animation: shake .32s ease-in-out; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 12px; }
.keypad button { height: 64px; border: 2px solid var(--line); background: #FFFFFF; font-family: var(--display); font-weight: 700; font-size: 26px; cursor: pointer; color: var(--ink); }
.keypad button:active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.keypad .ghost { border-color: transparent; background: transparent; font-family: var(--body); font-size: 15px; font-weight: 700; }
.lock .note { text-align: left; max-width: 340px; }

/* Full-screen camera and photo viewer */
.cam { position: fixed; inset: 0; z-index: 50; background: #000; color: var(--paper); display: grid; grid-template-rows: auto 1fr auto; }
.cam-top { padding: max(8px, env(safe-area-inset-top, 0px)) 12px 12px; display: grid; gap: 8px; justify-items: center; }
.cam-row { width: 100%; display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.cam-row button { width: 44px; height: 44px; border: 0; background: none; color: var(--paper); cursor: pointer; display: grid; place-items: center; padding: 0; }
.cam-row button svg { width: 22px; height: 22px; }
.cam-row button.on { color: var(--rust); }
.cam-title { text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cam-title b { font-family: var(--display); font-weight: 700; font-size: 20px; text-transform: uppercase; }
.cam-title span { font-weight: 500; font-size: 17px; }
.ticks { display: flex; gap: 6px; }
.ticks i { width: 28px; height: 4px; background: rgba(243,242,235,.25); }
.ticks i.done { background: var(--rust); }
.ticks i.now { background: var(--paper); }
.cam-hint { margin: 0; font-size: 14px; opacity: .8; text-align: center; }
.cam-mid { min-height: 0; display: grid; place-items: center; overflow: hidden; }
.cam-frame { position: relative; aspect-ratio: 3 / 4; width: min(100%, calc((100dvh - 260px) * .75)); max-height: 100%; background: #111; overflow: hidden; }
.cam-frame video, .cam-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-frame img.fit { object-fit: contain; }
.cam-flash { position: absolute; inset: 0; background: #FFF; opacity: 0; pointer-events: none; transition: opacity .2s ease-in; }
.cam-flash.on { opacity: 1; transition: none; }
.cam-msg { position: absolute; inset: 0; display: grid; place-content: center; gap: 14px; padding: 24px; text-align: center; }
.cam-msg h2 { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 18px; margin: 0; }
.cam-msg p { margin: 0; font-size: 16px; }
.cam-bottom { padding: 14px 16px max(16px, env(safe-area-inset-bottom, 0px)); display: flex; gap: 10px; justify-content: center; align-items: center; min-height: 110px; }
.shutter { width: 78px; height: 78px; border-radius: 50%; border: 4px solid var(--paper); background: transparent; padding: 0; cursor: pointer; display: grid; place-items: center; }
.shutter::after { content: ""; width: 62px; height: 62px; border-radius: 50%; background: var(--paper); }
.shutter:disabled { opacity: .35; }
.shutter:active::after { transform: scale(.94); }
.cbtn { flex: 1; min-height: 56px; border: 2px solid var(--paper); background: transparent; color: var(--paper); font-weight: 700; font-size: 17px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative; }
.cbtn.go { background: var(--rust); border-color: var(--rust); color: #FFF; }
.cbtn input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.cam-err { color: var(--rust); font-size: 14px; text-align: center; margin: 0 0 -4px; width: 100%; }
.viewer-img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Install hint (Safari, not yet on the home screen) */
.install { border: 2px solid var(--ink); padding: 12px 14px; font-size: 15px; display: grid; gap: 4px; }
.install b { font-family: var(--display); font-weight: 700; text-transform: uppercase; font-size: 14px; letter-spacing: .04em; }
.actions .btn { padding: 0 10px; white-space: nowrap; }
