/* dubcard, Oktoberfest edition: a Bavarian blue-and-white tent, cream beer-coaster
   cards, and beer-gold caption strips. */
:root {
  --ink: #0B3F7A;          /* Bavarian blue, the tent */
  --ink-2: #0F4E93;
  --ink-3: #1A5FAD;
  --lozenge: rgba(255,255,255,0.09);
  --paper: #FFF6DF;        /* coaster cream */
  --paper-2: #F6E7C4;
  --paper-line: #E3CFA0;
  --sub: #F2B632;          /* beer gold */
  --sub-deep: #D69A16;
  --coral: #C8102E;        /* gingerbread-heart red */
  --mint: #3C7A3F;         /* hops green */
  --sky: #9CC4F5;
  --on-paper: #2B1B10;     /* pretzel brown */
  --on-paper-muted: #7A6650;
  --on-ink: #FFF6DF;
  --on-ink-muted: #C9DBF2;
  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --body: "Instrument Sans", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --radius: 18px;
  --gutter: 16px;
  --shadow: 0 14px 34px rgba(4, 22, 48, 0.45);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--ink);
  /* The Bavarian lozenge, drawn with two diagonal gradients. */
  background-image:
    linear-gradient(45deg, var(--lozenge) 25%, transparent 25%, transparent 75%, var(--lozenge) 75%),
    linear-gradient(-45deg, var(--lozenge) 25%, transparent 25%, transparent 75%, var(--lozenge) 75%);
  background-size: 56px 56px;
  background-attachment: fixed;
  color: var(--on-ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: inherit; }
button, input { font: inherit; }
code { font-family: var(--mono); font-size: 0.85em; background: rgba(255,255,255,0.08); padding: 1px 5px; border-radius: 6px; }
.card-paper code { background: rgba(27,21,48,0.08); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: var(--gutter); background: var(--sub); color: var(--on-paper); padding: 8px 12px; z-index: 10; }
:focus-visible { outline: 3px solid var(--sub); outline-offset: 2px; }

/* Top bar */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px;
  background: var(--ink);
  border-bottom: 10px solid transparent;
  border-image: repeating-linear-gradient(-45deg, #FFF6DF 0 10px, var(--ink-3) 10px 20px) 10;
}
.wordmark {
  font-family: var(--display); font-weight: 900; font-size: 28px; letter-spacing: -0.02em;
  text-decoration: none; color: var(--on-ink); line-height: 1;
  font-variation-settings: "opsz" 144, "SOFT" 100;
}
.wordmark span {
  display: inline-block; background: var(--sub); color: var(--on-paper);
  padding: 2px 8px 4px; margin-left: 2px; border-radius: 10px; transform: rotate(-2deg);
}
.icon-btn { background: none; border: 0; color: var(--on-ink-muted); padding: 8px; border-radius: 12px; cursor: pointer; }
.icon-btn:hover { color: var(--on-ink); background: var(--ink-2); }

.main { padding: 4px var(--gutter) 48px; max-width: 640px; margin: 0 auto; }
.view { animation: rise 0.28s ease-out both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Type */
.display {
  font-family: var(--display); font-weight: 900; letter-spacing: -0.02em; line-height: 1.02;
  font-size: clamp(30px, 8vw, 40px); margin: 0 0 12px; font-variation-settings: "opsz" 144, "SOFT" 100;
}
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--on-ink-muted); margin: 0;
}
.card-paper h2, .card-paper .eyebrow { color: var(--on-paper-muted); }

/* Buttons and fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 600; cursor: pointer;
  background: var(--ink-3); color: var(--on-ink); min-height: 44px; text-decoration: none;
  transition: transform 0.12s ease, background 0.12s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--sub); color: var(--on-paper); }
.btn-primary:hover { background: #F8C654; }
.btn-danger { background: rgba(200,16,46,0.22); color: #FFD5DA; }
.btn-danger.armed { background: var(--coral); color: #fff; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.card-paper .btn { background: var(--ink); color: var(--on-ink); }
.card-paper .btn-primary { background: var(--sub); color: var(--on-paper); }
.card-paper .btn-danger { background: rgba(200,16,46,0.12); color: #A10D25; }
.card-paper .btn-danger.armed { background: var(--coral); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .dub-row input {
  width: 100%; border: 2px solid transparent; border-radius: 14px; padding: 12px 14px;
  background: rgba(27,21,48,0.07); color: inherit; min-height: 46px;
}
.field input:focus, .dub-row input:focus { outline: none; border-color: var(--sub); }
.error { color: #FFD5DA; font-weight: 500; margin: 10px 0 0; }
.card-paper .error { color: #A10D25; }

/* Gate */
.gate { margin-top: 28px; }
.gate p { margin: 0 0 8px; }

/* Paper cards */
.card-paper {
  background: var(--paper); color: var(--on-paper); border-radius: var(--radius);
  padding: 20px 18px; box-shadow: var(--shadow);
  border: 3px solid var(--sub);            /* the coaster rim */
  outline: 3px solid var(--paper); outline-offset: -8px;
}
.card-paper h2 { font-family: var(--mono); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; margin: 22px 0 8px; }
.card-paper section:first-of-type h2 { margin-top: 12px; }

/* Paste box */
.dub-form { margin: 8px 0 22px; }
.dub-row { display: flex; gap: 8px; }
.dub-row input { flex: 1; background: var(--ink-2); color: var(--on-ink); font-size: 16px; }
.dub-row input::placeholder { color: var(--on-ink-muted); }
.dub-row .btn { flex: none; }

/* Queue */
.queue { margin-bottom: 22px; }
.queue-list { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.queue-item {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center;
  background: var(--ink-2); border-radius: 14px; padding: 12px 14px;
}
.queue-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sub); animation: blink 1.2s ease-in-out infinite; }
.queue-item.failed .dot { background: var(--coral); animation: none; }
@keyframes blink { 0%, 100% { opacity: 1; transform: scale(1);} 50% { opacity: 0.35; transform: scale(0.7);} }
.queue-item .q-url { font-family: var(--mono); font-size: 12px; color: var(--on-ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item .q-status { font-weight: 600; }
.queue-item.failed .q-status { color: #FFD5DA; }
.queue-item .q-actions { display: flex; gap: 6px; }
.queue-item .q-actions .btn { padding: 6px 12px; min-height: 34px; font-size: 14px; }

/* Card list: a fanned stack of paper */
.cards-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.seg { display: inline-flex; background: var(--ink-2); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--on-ink-muted); padding: 6px 14px; border-radius: 999px; font-weight: 600; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--sub); color: var(--on-paper); }
.card-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.tile {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: stretch;
  background: var(--paper); color: var(--on-paper); border-radius: var(--radius); overflow: hidden;
  border: 3px solid var(--sub);
  box-shadow: var(--shadow); text-decoration: none; cursor: pointer; border: 0; text-align: left; padding: 0; width: 100%;
  transition: transform 0.15s ease;
}
.card-list li:nth-child(odd) .tile { transform: rotate(-0.6deg); }
.card-list li:nth-child(even) .tile { transform: rotate(0.5deg); }
.tile:hover, .tile:focus-visible { transform: rotate(0) scale(1.01); }
.tile .thumb { position: relative; background: var(--ink-2); min-height: 120px; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile .thumb .sub-strip { position: absolute; left: 0; right: 0; bottom: 0; }
.tile .body { padding: 12px 14px 12px 0; min-width: 0; }
.tile .title { font-family: var(--display); font-weight: 900; font-size: 20px; letter-spacing: -0.01em; line-height: 1.1; margin: 0 0 4px; font-variation-settings: "opsz" 48, "SOFT" 60; }
.tile .gist { margin: 0; font-size: 14px; color: var(--on-paper); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.tile.unseen .title::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--coral); margin-right: 7px; vertical-align: middle; }
.lang-pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; background: var(--ink); color: var(--on-ink);
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.when { font-size: 12px; color: var(--on-paper-muted); }
.empty { color: var(--on-ink-muted); text-align: center; padding: 28px 12px; }

/* The subtitle strip: the one thing to remember */
.sub-strip {
  display: block; background: var(--sub); color: var(--on-paper);
  font-family: var(--display); font-weight: 900; font-size: 13px; line-height: 1.2; letter-spacing: 0;
  font-variation-settings: "opsz" 48, "SOFT" 100;
  padding: 6px 8px; margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* One card */
.card-view .cover { margin: -20px -18px 14px; position: relative; background: var(--ink); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; }
.card-view .cover img, .card-view .cover video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: var(--ink); }
.card-view .cover .sub-strip { position: absolute; left: 0; right: 0; bottom: 0; font-size: 16px; padding: 10px 14px; -webkit-line-clamp: 3; }
.card-view .strip-row { display: flex; gap: 8px; overflow-x: auto; margin: -20px -18px 14px; padding: 0 18px; scroll-snap-type: x mandatory; }
.card-view .strip-row img { height: 220px; border-radius: 12px; scroll-snap-align: start; }
.card-title { font-family: var(--display); font-weight: 900; font-size: clamp(26px, 7vw, 34px); letter-spacing: -0.01em; line-height: 1.05; margin: 0 0 6px; font-variation-settings: "opsz" 144, "SOFT" 100; }
.byline { margin: 0 0 6px; color: var(--on-paper-muted); font-size: 14px; }
.byline a { color: var(--on-paper); font-weight: 600; }
.summary { padding-left: 0; list-style: none; margin: 0; display: grid; gap: 8px; }
.summary li { position: relative; padding-left: 20px; font-size: 17px; line-height: 1.35; }
.summary li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 11px; height: 11px; background: var(--ink); transform: rotate(45deg); border-radius: 2px; } /* a lozenge */
.places { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.places li { display: grid; gap: 2px; padding: 10px 12px; background: var(--paper-2); border-radius: 12px; }
.places li span { font-size: 14px; color: var(--on-paper-muted); }
.places li em { font-style: normal; font-size: 14px; }
.items { list-style: none; padding: 0; margin: 0; }
.items li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--paper-line); }
.items li:last-child { border-bottom: 0; }
.items .nm { display: grid; }
.items .nm .en { color: var(--on-paper-muted); font-size: 14px; }
.items .nm em { font-style: normal; font-size: 13px; color: var(--on-paper-muted); }
.items .pr { font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.note { background: var(--paper-2); padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.transcript { margin-top: 20px; border-top: 1px solid var(--paper-line); padding-top: 10px; }
.transcript summary { cursor: pointer; font-weight: 600; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-paper-muted); }
.segments { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.segments li { display: grid; gap: 2px; }
.segments .src { color: var(--on-paper-muted); font-size: 14px; }
.segments .en { font-size: 15px; }
.source { margin: 18px 0 0; }
.source a { font-weight: 600; color: var(--on-paper); }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; }
.actions .btn { width: 100%; }
.actions .wide { grid-column: 1 / -1; }
.disclaimer { margin: 18px 0 0; font-size: 12px; color: var(--on-paper-muted); }
.caption-box { margin-top: 12px; }
.caption-box summary { cursor: pointer; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--on-paper-muted); }
.caption-box pre { white-space: pre-wrap; font: inherit; font-size: 14px; color: var(--on-paper-muted); margin: 8px 0 0; }
.share-link { margin-top: 10px; font-family: var(--mono); font-size: 12px; word-break: break-all; }
.back { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 12px; color: var(--on-ink-muted); text-decoration: none; font-weight: 600; background: none; border: 0; cursor: pointer; padding: 0; }
.back:hover { color: var(--on-ink); }

/* Settings */
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 8px; font-size: 14px; }
.kv dt { color: var(--on-paper-muted); }
.kv dd { margin: 0; font-family: var(--mono); font-size: 13px; word-break: break-all; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--sub); color: var(--on-paper); padding: 10px 16px; border-radius: 999px; font-weight: 700; z-index: 20;
  box-shadow: var(--shadow); max-width: calc(100vw - 32px);
}

/* Public share page */
.share-body .main, .share { max-width: 640px; margin: 0 auto; padding: 8px var(--gutter) 40px; }
.share-head { display: flex; align-items: center; justify-content: space-between; padding: calc(10px + env(safe-area-inset-top)) 0 14px; }
.share .cover img { border-radius: 12px 12px 0 0; }
.share .cover { margin: -20px -18px 14px; position: relative; }
.share .cover img { display: block; width: 100%; max-height: 62vh; object-fit: cover; border-radius: var(--radius) var(--radius) 0 0; }
.share .cover .sub-strip { position: absolute; left: 0; right: 0; bottom: 0; font-size: 16px; padding: 10px 14px; -webkit-line-clamp: 3; }
.share-foot { text-align: center; color: var(--on-ink-muted); font-size: 12px; margin-top: 18px; }

@media (prefers-reduced-motion: reduce) {
  .view, .queue-item .dot { animation: none; }
  .tile, .btn { transition: none; }
}
@media (min-width: 640px) {
  .tile { grid-template-columns: 128px 1fr; }
}

/* A failed job needs room for its message; drop the buttons to a second row. */
.queue-item.failed { grid-template-columns: 14px 1fr; }
.queue-item.failed .q-actions { grid-column: 2; }

/* Failure details and the Siri block */
.q-details { margin-top: 8px; }
.q-details summary { cursor: pointer; font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-ink-muted); }
.q-details pre { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: 11px; line-height: 1.4; background: rgba(0,0,0,0.25); color: var(--on-ink); padding: 10px; border-radius: 10px; margin: 8px 0; max-height: 40vh; overflow: auto; }
.q-details .btn { padding: 6px 12px; min-height: 34px; font-size: 14px; }
.siri { width: 100%; border: 2px solid var(--paper-line); border-radius: 12px; padding: 10px 12px; font: 14px/1.4 var(--body); background: var(--paper-2); color: var(--on-paper); resize: vertical; }
.inline-form .field { margin: 8px 0; }
.card-paper h2 + p { margin-top: 0; }

/* Photo buttons: labels wrapping hidden inputs, because iOS Safari ignores a
   programmatic click on a hidden capture input. */
.photo-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.photo-row .or { width: 100%; font-size: 13px; color: var(--on-ink-muted); }
.photo-btn { cursor: pointer; }
.photo-btn:focus-within { outline: 3px solid var(--sub); outline-offset: 2px; }

/* Admin: every phone */
.phones { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.phones li { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; background: var(--paper-2); border-radius: 12px; padding: 10px 12px; }
.phones .ph-name { font-weight: 600; }
.phones .ph-meta { grid-column: 1 / -1; font-family: var(--mono); font-size: 11px; color: var(--on-paper-muted); word-break: break-all; }
.phones .btn { padding: 6px 12px; min-height: 34px; font-size: 14px; }
