/* Comment DMs admin. Tokens are the Small Apps design system's, which follows
   thewanderingpaddy.com: paper, ink, gold as a stroke only, 4px corners. */

:root {
  --paper: #f3f2f2;
  --paper-2: #eae9e9;
  --tone: #d7d3d3;
  --rule: rgba(32, 31, 29, 0.16);
  --rule-strong: #8a8582;
  --ink: #201f1d;
  --text-2: #444141;
  --text-3: #605d5d;
  --gold: #b68235;
  --gold-ink: #7d5411;
  --gold-ink-deep: #5a3b0a;
  --gold-wash: #fff3e4;
  --sent: #2c4a78;
  --sent-wash: #e6eaf1;
  --failed: #9a2f1c;
  --failed-wash: #f6e4df;
  --space-1: 4.6px;
  --space-2: 9.2px;
  --space-3: 13.8px;
  --space-4: 18.4px;
  --space-6: 27.6px;
  --space-8: 36.8px;
  --radius: 4px;
  --radius-inner: 2px;
  --display: "Cormorant Garamond", Georgia, serif;
  --body: Lora, Georgia, serif;
  --gutter: var(--space-4);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 1.6; }
h1, h2, p, ul, ol, dl, dd, fieldset { margin: 0; padding: 0; }
ul, ol { list-style: none; }
fieldset { border: 0; min-width: 0; }
a { color: var(--gold-ink); text-decoration: none; }
a:hover { color: var(--gold-ink-deep); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
::selection { background: #ffe3bf; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: var(--space-2); top: -60px; z-index: 30; padding: var(--space-2) var(--space-3); background: var(--paper); border: 1px solid var(--gold); border-radius: var(--radius); }
.skip:focus { top: var(--space-2); }
.noscript { padding: var(--space-6); }

/* Type */
.kicker { font-size: 11px; line-height: 1.45; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500; color: var(--gold-ink); }
.label { display: block; font-size: 11px; line-height: 1.45; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 500; color: var(--text-3); }
.title { font-family: var(--display); font-weight: 400; font-size: 40px; line-height: 1.05; letter-spacing: -0.01em; }
.card-title { font-family: var(--display); font-weight: 400; font-size: 25px; line-height: 1.15; }
.small { font-size: 14px; line-height: 1.5; color: var(--text-3); }
.body-2 { color: var(--text-2); }
.strong { font-weight: 600; }
.quote { font-style: italic; color: var(--text-2); overflow-wrap: anywhere; }
.word { font-family: var(--display); font-size: 25px; line-height: 1.15; letter-spacing: 0.08em; text-transform: uppercase; overflow-wrap: anywhere; }
.word.is-off { color: var(--text-3); }
.centre { text-align: center; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: transparent; color: var(--text-2); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; white-space: nowrap; transition: background 320ms ease, color 320ms ease; }
.btn:hover { background: var(--paper-2); color: var(--ink); }
.btn-main { border-color: var(--gold); color: var(--gold-ink); }
.btn-main:hover { background: var(--gold-wash); color: var(--gold-ink-deep); }
.btn-danger { border-color: var(--failed); color: var(--failed); }
.btn-danger:hover { background: var(--failed-wash); color: var(--failed); }
.btn-tall { min-height: 52px; }
.btn-on-art { background: rgba(243, 242, 242, 0.9); }
.btn[disabled] { opacity: 0.55; cursor: default; }
.btn-pick[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0; border: 0; background: none; color: var(--gold-ink); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; }
.link-btn:hover { color: var(--gold-ink-deep); }

/* Switch */
.switch { width: 52px; height: 32px; flex-shrink: 0; padding: 2px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper); display: flex; justify-content: flex-start; transition: background 320ms ease; }
.switch span { width: 26px; height: 26px; border-radius: 999px; background: var(--rule-strong); }
.switch[aria-checked="true"] { border-color: var(--ink); background: var(--ink); justify-content: flex-end; }
.switch[aria-checked="true"] span { background: var(--paper); }

/* Badges: a word, a colour and a dot of its own shape */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px var(--space-2); border-radius: var(--radius-inner); font-size: 11px; line-height: 1.45; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 500; white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: currentColor; }
.badge-sent { background: var(--sent-wash); color: var(--sent); }
.badge-queued { background: var(--gold-wash); color: var(--gold-ink); }
.badge-skipped { background: var(--paper-2); color: var(--text-3); }
.badge-skipped::before { background: none; border: 1.5px solid currentColor; }
.badge-failed { background: var(--failed-wash); color: var(--failed); }
.badge-failed::before { border-radius: 0; }

/* Header */
.header { border-bottom: 1px solid var(--rule); background: var(--paper); }
.header-inner { display: flex; flex-wrap: wrap; align-items: center; }
.lockup { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--gutter) var(--space-3); color: var(--ink); margin-right: auto; }
.lockup-name { font-family: var(--display); font-size: 20px; line-height: 1; letter-spacing: 0.11em; text-transform: uppercase; white-space: nowrap; }
.lockup-rule { width: 1px; height: 20px; background: var(--gold); flex-shrink: 0; }
.lockup-sub { font-size: 9px; line-height: 1.3; letter-spacing: 0.26em; text-transform: uppercase; font-weight: 500; color: var(--gold-ink); }
#status { width: 100%; }
.status { display: flex; align-items: center; gap: var(--space-2); width: 100%; min-height: 44px; padding: 0 var(--gutter); border-top: 1px solid var(--rule); color: var(--sent); }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.status-word { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 500; white-space: nowrap; }
.status-detail { margin-left: auto; font-size: 14px; line-height: 1.5; color: var(--text-3); text-align: right; }
.status.is-bad { background: var(--failed-wash); border-top-color: var(--failed); color: var(--failed); }
.status.is-bad::before { border-radius: 0; }
.status.is-bad .status-detail { color: var(--ink); }
.status.is-unknown { color: var(--text-3); }

/* Tabs: along the bottom on a phone, in the header on desktop */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--paper); border-top: 1px solid var(--rule); padding-bottom: env(safe-area-inset-bottom); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 60px; margin-top: -1px; border-top: 2px solid transparent; color: var(--text-2); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { border-top-color: var(--gold); color: var(--ink); }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* Hero: the site's island picture under each screen's title */
.hero { position: relative; overflow: hidden; min-height: 232px; border-bottom: 1px solid var(--rule); }
.hero.is-tall { min-height: 272px; }
.hero-art { position: absolute; inset: 0; background: url("img/hero-inkwash.jpg") center 86% / cover no-repeat; }
.hero-scrim { position: absolute; inset: 0; background-image: linear-gradient(to bottom, rgba(243, 242, 242, 0.85), rgba(243, 242, 242, 0.55) 40%, rgba(243, 242, 242, 0) 68%); }
.hero-inner { position: relative; display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-3); padding: var(--space-6) var(--gutter) 0; }
.hero-words { display: flex; flex-direction: column; gap: var(--space-2); }
.hero .kicker.is-bad { color: var(--failed); }

/* Page */
.main { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-4) var(--gutter) calc(60px + var(--space-8) + env(safe-area-inset-bottom)); }
.main:focus { outline: none; }
.plain-top { display: flex; align-items: center; padding: var(--space-1) var(--gutter); border-bottom: 1px solid var(--rule); }
.stack { display: flex; flex-direction: column; gap: var(--space-6); }
.stack-s { display: flex; flex-direction: column; gap: var(--space-2); }
.stack-m { display: flex; flex-direction: column; gap: var(--space-3); }
.rule-line { height: 1px; background: var(--rule); }
.card { border: 1px solid var(--rule); border-radius: var(--radius); }
.pad { padding: var(--space-4); }
.row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.row-baseline { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.grow { flex: 1; min-width: 0; }
.wrap { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.message { padding: var(--space-3) var(--space-4); border: 1px solid var(--failed); border-radius: var(--radius); background: var(--failed-wash); }
.empty { padding: var(--space-8) var(--space-4); text-align: center; }
.loading { padding: var(--space-8) 0; text-align: center; color: var(--text-3); }

/* Rules list */
.rule-top { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4); }
.rule-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 0 var(--space-4); border-top: 1px solid var(--rule); }
.thumb { width: 56px; height: 56px; flex-shrink: 0; border-radius: var(--radius-inner); object-fit: cover; background-color: var(--tone); background-image: repeating-linear-gradient(135deg, rgba(32, 31, 29, 0.07) 0 6px, transparent 6px 12px); }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Forms */
.field { display: flex; flex-direction: column; gap: var(--space-2); }
.input { width: 100%; min-height: 48px; padding: 0 var(--space-3); border: 1px solid var(--rule-strong); border-radius: var(--radius); background: var(--paper); }
textarea.input { padding: 11px var(--space-3); line-height: 1.6; resize: vertical; }
.input-word { min-height: 52px; font-family: var(--display); font-size: 25px; letter-spacing: 0.08em; text-transform: uppercase; }
.check { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; color: var(--text-2); }
.check input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--ink); }
.posts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.post { position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--rule-strong); border-radius: var(--radius); background-color: var(--tone); background-image: repeating-linear-gradient(135deg, rgba(32, 31, 29, 0.07) 0 6px, transparent 6px 12px); }
.post img { display: block; width: 100%; height: 100%; object-fit: cover; }
.post[aria-pressed="true"] { border: 3px solid var(--gold); }
.post[aria-pressed="true"]::after { content: ""; position: absolute; right: 4px; top: 4px; width: 20px; height: 20px; border-radius: 999px; background: var(--gold-wash) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d5411' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12l4 4 8-9'/%3E%3C/svg%3E") center / 14px no-repeat; border: 1px solid var(--gold); }
.posts.is-off { opacity: 0.45; }
.preview { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-4); background: var(--paper-2); border-radius: var(--radius); }
.bubble { align-self: flex-start; max-width: 280px; padding: 11px var(--space-3); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble .bubble-link { display: block; color: var(--gold-ink); text-decoration: underline; }
.reply-line { padding-left: var(--space-3); border-left: 1px solid var(--gold); overflow-wrap: anywhere; }

/* Posts */
.post-item + .post-item { border-top: 1px solid var(--rule); }
.post-row { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); color: var(--ink); }
.post-row:hover { color: var(--ink); background: var(--paper-2); }
.post-row .grow { display: flex; flex-direction: column; gap: 2px; }
.slide-thumb { display: block; width: 56px; height: 70px; flex-shrink: 0; object-fit: cover; border: 1px solid var(--rule); border-radius: var(--radius-inner); background: #efe9df url("img/hero-inkwash.jpg") center bottom / 100% auto no-repeat; }
img.slide-thumb { background: #efe9df; }
.line-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.line-input { flex: 1 1 220px; min-height: 44px; font-size: 15px; }
.is-italic { font-style: italic; }
.indent-1 { padding-left: 30px; } .indent-2 { padding-left: 46px; } .indent-3 { padding-left: 62px; } .indent-4 { padding-left: 78px; }
.indent-5 { padding-left: 94px; } .indent-6 { padding-left: 110px; } .indent-7 { padding-left: 126px; } .indent-8 { padding-left: 142px; }
.line-tools { display: flex; gap: 6px; margin-left: auto; }
.tool { width: 44px; height: 44px; flex-shrink: 0; padding: 0; border: 1px solid var(--rule-strong); border-radius: var(--radius); background: transparent; color: var(--text-2); font-size: 17px; line-height: 1; }
.tool:hover { background: var(--paper-2); color: var(--ink); }
.tool-italic { font-style: italic; }
.tool[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper); }
.line-mark { display: flex; align-items: center; gap: var(--space-2); min-height: 44px; }
.mark-rule { flex: 1; height: 1px; background: var(--rule); }
.line-mark .link-btn { margin-left: auto; }
.slide-canvas { display: block; width: 100%; max-width: 432px; height: auto; box-shadow: 0 12px 32px rgba(45, 43, 43, 0.18); }
.bleed { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); border-radius: 0; }
.note { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper-2); }
.message .btn, .note .btn { background: var(--paper); }
.message { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Activity */
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figure { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); }
.figure + .figure { border-left: 1px solid var(--rule); }
.figure-number { font-family: var(--display); font-weight: 400; font-size: 52px; line-height: 1.05; letter-spacing: -0.01em; }
.filters { display: flex; flex-wrap: wrap; gap: 0 var(--space-4); border-bottom: 1px solid var(--rule); }
.filter { min-height: 44px; padding: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--text-2); font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; }
.filter[aria-pressed="true"] { border-bottom-color: var(--gold); color: var(--ink); }
.act { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-4); }
.act + .act, .health-row + .health-row { border-top: 1px solid var(--rule); }
.act-rule { display: none; }

/* Health */
.health-row { display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4); }
.fix { display: flex; flex-direction: column; gap: var(--space-2); padding: var(--space-3) var(--space-4); background: var(--paper-2); border-radius: var(--radius-inner); }
.fix ol { list-style: decimal; padding-left: 20px; font-size: 14px; line-height: 1.5; color: var(--text-2); }
.card-bad { border-color: var(--failed); }

/* Sign in */
.signin { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding: var(--space-8) var(--gutter); }
.signin .hero-art { background-position: center; }
.signin .lockup { position: relative; padding: 0; margin: 0; }
.signin-panel { position: relative; width: 100%; max-width: 400px; margin-top: clamp(96px, 23vh, 196px); display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6) var(--space-4); background: rgba(243, 242, 242, 0.94); border: 1px solid var(--rule); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(45, 43, 43, 0.18); }

.steps { list-style: decimal; padding-left: 20px; color: var(--text-2); }
.qr { display: block; align-self: center; width: 200px; height: 200px; padding: var(--space-2); background: #ffffff; border: 1px solid var(--rule); border-radius: var(--radius); }
.secret { margin-top: var(--space-2); font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: 0.08em; overflow-wrap: anywhere; color: var(--ink); }
details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--gold-ink); }
.signin-panel .input-word { text-transform: none; letter-spacing: 0.3em; text-align: center; }

/* Confirm dialog */
dialog { width: min(92vw, 420px); padding: var(--space-6) var(--space-4); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 12px 32px rgba(45, 43, 43, 0.18); }
dialog::backdrop { background: rgba(32, 31, 29, 0.45); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--space-2); margin-top: var(--space-4); }

/* Wider than a phone: the picture stops growing with the window. It sits in
   a box of limited width on the right, fading into the paper, so the island
   stays about the same size on a tablet, a laptop or a wide monitor. */
@media (min-width: 600px) {
  .hero-art {
    --fade-x: linear-gradient(to right, transparent, #000 28%);
    --fade-y: linear-gradient(to bottom, transparent, #000 16%, #000 86%, transparent);
    left: auto; right: 0; width: min(640px, 72%); background-position: center 84%;
    -webkit-mask-image: var(--fade-x), var(--fade-y); mask-image: var(--fade-x), var(--fade-y);
    -webkit-mask-composite: source-in; mask-composite: intersect;
  }
  .hero-scrim { display: none; }
  /* Sign-in: the whole picture, centred behind the panel, no wider than it is tall. */
  .signin .hero-art { left: 50%; right: auto; width: min(100%, 90vh); transform: translateX(-50%); background-position: center; -webkit-mask-image: linear-gradient(to right, transparent, #000 20%, #000 80%, transparent); mask-image: linear-gradient(to right, transparent, #000 20%, #000 80%, transparent); }
}

/* Desktop */
@media (min-width: 860px) {
  :root { --gutter: var(--space-8); }
  .header-inner, .hero-inner, .main, .plain-top-inner { max-width: 1180px; margin-left: auto; margin-right: auto; }
  .header-inner { flex-wrap: nowrap; gap: var(--space-8); padding: 0 var(--gutter); }
  .lockup { padding: var(--space-4) 0; }
  .lockup-name { font-size: 23px; }
  .lockup-rule { height: 23px; }
  #status { order: 3; width: auto; }
  .status { width: auto; min-height: 44px; padding: 0; border-top: 0; }
  .status.is-bad { padding: 0 var(--space-3); border: 1px solid var(--failed); border-radius: var(--radius); }
  .status-detail { display: none; }
  .tabs { position: static; order: 2; display: flex; gap: var(--space-6); border-top: 0; padding: 0; background: none; }
  .tab { flex-direction: row; min-height: 44px; margin: 0; border-top: 0; border-bottom: 1px solid transparent; font-size: 12px; letter-spacing: 0.12em; }
  .tab[aria-current="page"] { border-bottom-color: var(--gold); }
  .tab svg { display: none; }
  .hero, .hero.is-tall { min-height: 320px; }
  /* Lined up with the right edge of the content column. */
  .hero-art { --fade-x: linear-gradient(to right, transparent, #000 24%, #000 80%, transparent); right: max(0px, calc((100% - 1180px) / 2)); width: min(820px, 62%); }
  .signin .hero-art { right: auto; }
  .hero-scrim { background-image: linear-gradient(to right, rgba(243, 242, 242, 0.78) 0%, rgba(243, 242, 242, 0.62) 42%, rgba(243, 242, 242, 0.22) 68%, rgba(243, 242, 242, 0) 100%); }
  .hero-inner { align-items: flex-start; padding-top: 64px; padding-bottom: 55px; width: 100%; }
  .hero .title { font-weight: 300; font-size: 72px; line-height: 0.98; letter-spacing: -0.025em; }
  .main { width: 100%; padding-top: var(--space-6); padding-bottom: 55px; gap: var(--space-6); }
  .main.is-form { max-width: 720px; }
  .pad, .rule-top, .act, .health-row, .figure { padding: var(--space-6); }
  .rule-foot { padding: 0 var(--space-6); }
  .posts { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .act { display: grid; grid-template-columns: 130px 170px minmax(0, 1.2fr) 150px minmax(0, 1.6fr); align-items: baseline; gap: var(--space-4); padding-top: var(--space-3); padding-bottom: var(--space-3); }
  .act-head { display: contents; }
  .act-rule { display: block; }
  .act-when { order: -1; }
  .act-cols { display: grid; grid-template-columns: 130px 170px minmax(0, 1.2fr) 150px minmax(0, 1.6fr); gap: var(--space-4); padding: var(--space-3) var(--space-6); background: var(--paper-2); }
  .word-s { font-size: 20px; }
}
@media (max-width: 859px) {
  .act-cols { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
