/* css/style.css — the whole design, used by every page.

   Poematica's look (PROJECT.md, "Styl"): the Enlightenment, old paper and
   candlelight. Warm parchment with a fine grain (img/grain.svg), sepia ink,
   gold leaf for ornaments and the edges of primary buttons. The interface is
   set in Inconsolata (the font of trustmrr.com, chosen by the owner); the
   name keeps Cinzel, the sea and the intro keep Cormorant Garamond, and each
   poem is set in the font its author chose.
   Dark mode is the same desk by candlelight; a poem always sits on light paper.
   Structure, spacing and components follow DESIGN.md.

   The fonts are files in /fonts (the CSP allows no font services), cut to
   Latin + Latin Extended so Polish letters work; the browser downloads a font
   only when the page uses it. All are under the SIL Open Font License.

   Keep --brand equal to BRAND in lib/mail.js and the fill in img/logo.svg.

   0. Fonts          5. Header, user menu, footer
   1. Colours        6. Pages: landing, auth, app, account, feedback, admin, legal
   2. Basics         7. Poematica: paper, poems, friends, intro, home page
   3. Buttons        8. Small screens, reduced motion
   4. Forms, cards
*/

/* ---------- 0. Fonts ---------- */

@font-face { font-family: "Inconsolata"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/fonts/inconsolata-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inconsolata"; font-style: normal; font-weight: 200 900; font-display: swap; src: url("/fonts/inconsolata-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/garamond-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/garamond-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("/fonts/garamond-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("/fonts/garamond-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/fonts/cormorant-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 300 700; font-display: swap; src: url("/fonts/cormorant-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/cormorant-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/cormorant-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/cinzel-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Cinzel"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/cinzel-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/playfair-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/playfair-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/playfair-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Playfair Display"; font-style: italic; font-weight: 400; font-display: swap; src: url("/fonts/playfair-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Great Vibes"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/great-vibes-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Great Vibes"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/great-vibes-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Pinyon Script"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/pinyon-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Pinyon Script"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/pinyon-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Dancing Script"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/dancing-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Dancing Script"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/dancing-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/caveat-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Caveat"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("/fonts/caveat-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- 1. Colours ---------- */

:root {
  --brand: #31231e;            /* primary buttons, the avatar: dark leather; --on-brand text on it */
  --danger: #9b2c1f;
  --success: #4f6b2c;

  --bg: #efe3c8;
  --bg-subtle: #e6d7b6;
  --surface: #f7eedb;
  --text: #1e120a;
  --text-2: #34241a;
  --muted: #5a4634;
  --line: #dbc8a2;
  --line-strong: #c2a97c;
  --shadow-sm: 0 1px 2px rgb(60 40 20 / 0.08);
  --shadow: 0 1px 3px rgb(60 40 20 / 0.12), 0 14px 36px rgb(60 40 20 / 0.16);

  --gilt: #a07a3c;             /* gold leaf: ornaments, the rim of primary buttons, focus */
  --on-brand: #f6ead0;         /* cream text on --brand */
  --paper: #f3e5c3;            /* the sheet a poem is written on, in both themes */
  --paper-edge: rgb(140 92 38 / 0.45);
  --ink: #170a03;              /* the poem's ink: nearly black, so every font reads clearly */

  /* worked out from the colours above */
  --brand-hover: color-mix(in srgb, var(--brand) 82%, black);
  --brand-soft: color-mix(in srgb, var(--gilt) 16%, var(--surface));
  --brand-ink: #8a4a22;        /* links: sienna, readable on parchment */
  --danger-soft: color-mix(in srgb, var(--danger) 10%, var(--surface));
  --success-soft: color-mix(in srgb, var(--success) 12%, var(--surface));
  --focus: color-mix(in srgb, var(--gilt) 40%, transparent);

  --font: "Inconsolata", ui-monospace, "Cascadia Mono", Consolas, monospace; /* the interface */
  --font-display: var(--font);                                               /* headings */
  --font-caps: var(--font);                                                  /* small capitals: eyebrows, labels */
  --font-name: "Cinzel", "Cormorant Garamond", Georgia, serif;               /* the name next to the logo */
  --font-poetic: "Cormorant Garamond", "EB Garamond", Georgia, serif;        /* the name on the sea and in the intro */
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --danger: #e07a62;
    --success: #9fc06e;
    --bg: #17110c;
    --bg-subtle: #20180f;
    --surface: #241a12;
    --text: #f7ecd6;
    --text-2: #e8d9bb;
    --muted: #c4ad88;
    --line: #3b2d20;
    --line-strong: #57432e;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.35);
    --shadow: 0 1px 3px rgb(0 0 0 / 0.45), 0 14px 36px rgb(0 0 0 / 0.4);
    --gilt: #c9a35c;
    --brand-hover: color-mix(in srgb, var(--brand) 82%, white);
    --brand-soft: color-mix(in srgb, var(--gilt) 14%, var(--surface));
    --brand-ink: #e3b673;
    --danger-soft: color-mix(in srgb, var(--danger) 16%, var(--surface));
    --success-soft: color-mix(in srgb, var(--success) 16%, var(--surface));
    color-scheme: dark;
  }
}

/* ---------- 2. Basics ---------- */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg) url("/img/grain.svg");
  color: var(--text);
  font: 400 17px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }

h1, h2, h3 { margin: 0 0 0.5em; color: var(--text); font-family: var(--font-display); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: 2.25rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; color: var(--text-2); }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
strong { color: var(--text); font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
img { max-width: 100%; }

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

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.narrow { max-width: 720px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.lead { font-size: 1.125rem; color: var(--text-2); }
.eyebrow { margin: 0 0 8px; color: var(--brand-ink); font: 600 13px var(--font-caps); letter-spacing: 0.14em; text-transform: uppercase; }
.page { padding-block: 32px 64px; }

/* ---------- 3. Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 500 17px/1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  --spinner: var(--text);
}
.btn:hover { background: var(--bg-subtle); text-decoration: none; }
.btn:disabled { opacity: 0.65; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--gilt); color: var(--on-brand); box-shadow: inset 0 0 0 1px rgb(255 230 180 / 0.12); --spinner: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); --spinner: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { min-height: 32px; padding: 0 12px; font-size: 15px; }
.btn-block { width: 100%; }
.btn img { width: 18px; height: 18px; }

.btn.loading { position: relative; color: transparent; }
.btn.loading img { visibility: hidden; }
.btn.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--spinner);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-button { padding: 0; border: 0; background: none; color: var(--brand-ink); font: inherit; cursor: pointer; }
.link-button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 4. Forms, cards, small pieces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card > :last-child { margin-bottom: 0; }

.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, .label { color: var(--text); font-size: 16px; font-weight: 500; }
.label-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.label-row a { font-size: 14px; }

input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: 400 17px/1.5 var(--font); /* 16px or more stops phones from zooming in */
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 160px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--focus); }
input[readonly] { background: var(--bg-subtle); color: var(--text-2); }
.invalid { border-color: var(--danger) !important; }
.field-hint { margin: 0; color: var(--muted); font-size: 13px; }
.field-error { margin: 0; color: var(--danger); font-size: 13px; }
.field .check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; margin: 4px 0 0; accent-color: var(--brand); }
.google-note { margin: 10px 0 0; }

.form-message { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; }
.form-message.error { background: var(--danger-soft); color: var(--danger); }
.form-message.success { background: var(--success-soft); color: var(--success); }

.divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* Two or three choices side by side: links (sign in | sign up) or buttons with aria-pressed */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 20px; background: var(--bg-subtle); border: 1px solid var(--line); border-radius: var(--radius); }
.tabs > a, .tabs > button { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 5px; background: none; color: var(--text-2); font: 500 16px var(--font); text-decoration: none; cursor: pointer; }
.tabs > [aria-current="page"], .tabs > [aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg-subtle); color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-brand { background: var(--brand-soft); border-color: transparent; color: var(--brand-ink); }
.badge-success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.badge-danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }

.notice-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; padding: 12px 16px; border-radius: var(--radius); background: var(--brand-soft); color: var(--brand-ink); font-size: 15px; }
.notice-bar p { margin: 0; color: inherit; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  font-size: 15px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.avatar { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: var(--on-brand); box-shadow: 0 0 0 1px var(--gilt); font: 600 13px var(--font-caps); }

/* ---------- 5. Header, user menu, footer ---------- */

.header { position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font: 600 18px var(--font-name); letter-spacing: 0.08em; }
.logo:hover { text-decoration: none; }
.logo img { width: 28px; height: 28px; border-radius: 7px; }
.header-actions { display: flex; align-items: center; gap: 8px; }

/* A <details> dropdown: works without JavaScript; common.js closes it on outside clicks. */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; border-radius: 50%; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; display: grid; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.menu-head { display: grid; padding: 8px 10px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 14px; }
.menu-head span { overflow: hidden; text-overflow: ellipsis; }
.menu-panel a, .menu-panel button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); font: 400 16px var(--font); text-align: left; text-decoration: none; cursor: pointer; }
.menu-panel a:hover, .menu-panel button:hover { background: var(--bg-subtle); }
.menu-panel .danger { color: var(--danger); }
.icon-button { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--text-2); font-size: 18px; line-height: 1; }
.icon-button:hover { background: var(--bg-subtle); }

.footer { border-top: 1px solid var(--line); padding-block: 24px; color: var(--muted); font-size: 16px; }
.footer p { margin: 4px 0; color: inherit; }
.footer a { color: var(--text-2); }

/* ---------- 6. Pages ---------- */

/* Landing */
.hero { padding-block: clamp(64px, 14vw, 144px); text-align: center; }
.hero h1 { font-size: clamp(2.5rem, 7vw, 4.5rem); }
.hero .lead { max-width: 560px; margin: 0 auto 28px; }
.hero-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }

/* Sign in / sign up / reset, the feedback form and the 404 page: one centred card */
.auth { display: grid; place-items: start center; padding-block: clamp(32px, 8vw, 72px); }
.auth-card { width: 100%; max-width: 420px; padding: 32px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 560px; }
.auth-card h1 { font-size: 2rem; margin-bottom: 4px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-card > .form-message { margin-bottom: 16px; }
.center-page { padding-block: clamp(64px, 14vw, 128px); text-align: center; }
.center-page .lead { margin-bottom: 28px; }
.done-mark { display: inline-grid; place-items: center; width: 48px; height: 48px; margin-bottom: 16px; border-radius: 50%; background: var(--success-soft); color: var(--success); font-size: 24px; }

/* App */
.page-head { margin-bottom: 24px; }
.page-head h1 { margin-bottom: 4px; }
.page-head p { margin: 0; }
.empty { padding: clamp(32px, 8vw, 64px) 24px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); text-align: center; }
.empty p { max-width: 480px; margin-inline: auto; }

/* Account settings: one card per topic */
.settings { display: grid; gap: 16px; }
.settings .card h2 { font-size: 1.6rem; margin-bottom: 4px; }
.settings .card h2 + p { margin-bottom: 20px; font-size: 15px; }
.settings .form { max-width: 420px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.card-actions + p { margin-top: 16px; }
.danger-zone > summary { color: var(--danger); font-weight: 600; cursor: pointer; }
.danger-zone[open] > summary { margin-bottom: 12px; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 40px; }
.stat { padding: 16px; text-align: left; font: inherit; color: inherit; }
button.stat { cursor: pointer; }
.stat.highlight { border-color: var(--brand); background: var(--brand-soft); }
.stat-value { display: block; color: var(--text); font-size: 1.75rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.stat-label { color: var(--muted); font-size: 13px; }
.section { margin-bottom: 48px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.toolbar input { max-width: 320px; }
.toolbar select { width: auto; }
.toolbar .tabs { margin: 0; }
.rows { display: grid; gap: 8px; }
.row { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; }
.row-main { flex: 1; min-width: 0; }
.row-title { overflow: hidden; color: var(--text); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.row-sub { color: var(--muted); font-size: 13px; }
.row-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.message-text { margin: 8px 0; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text.folded { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.row-actions select { width: auto; min-height: 32px; padding: 4px 8px; font-size: 14px; }
.load-more { margin-top: 12px; }

/* Legal pages (terms, privacy, refunds): a reading column */
.legal { max-width: 760px; padding-block: 40px 64px; }
.legal h1 { font-size: 2rem; }
.legal h2 { margin-top: 2em; font-size: 1.3rem; }
.legal li { margin-bottom: 8px; color: var(--text-2); }
.notice { margin: 24px 0; background: var(--bg-subtle); box-shadow: none; }
.notice h2 { margin-top: 0; font-size: 1.05rem; }

/* ---------- 7. Poematica ---------- */

/* A sheet of old paper: darker, warmer edges, a fine grain, slightly uneven corners. */
.paper {
  position: relative;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    url("/img/paper.svg"),
    radial-gradient(ellipse at 50% 42%, transparent 52%, var(--paper-edge) 100%),
    linear-gradient(172deg, rgb(255 250 232 / 0.4), transparent 45%, rgb(120 80 30 / 0.1));
  border-radius: 3px 6px 4px 7px / 6px 3px 7px 4px;
  box-shadow:
    inset 0 0 0 1px rgb(110 72 30 / 0.16),
    inset 0 0 46px rgb(120 72 22 / 0.3),
    0 1px 2px rgb(40 24 10 / 0.22),
    0 16px 32px -14px rgb(40 24 10 / 0.5);
}
.paper h2, .paper h3 { color: var(--ink); }

/* An ornamental line between curls; takes the colour of gold leaf. */
.flourish { height: 18px; margin: 4px auto 20px; max-width: 220px; background: var(--gilt); mask: url("/img/flourish.svg") center / contain no-repeat; }
.paper .flourish { background: #8c6a35; opacity: 0.75; }

/* The fonts a poem can be written in (FONTS in server.js and app.js).
   Script fonts look small at the same size, so they get a little more. */
/* Thin fonts get more weight, and the two calligraphic ones (one weight only) a
   hairline outline in the ink colour, so every line reads clearly on the paper. */
.font-cormorant { font-family: "Cormorant Garamond", Georgia, serif; font-size: 1.12em; font-weight: 600; }
.font-garamond { font-family: "EB Garamond", Georgia, serif; font-weight: 500; }
.font-playfair { font-family: "Playfair Display", Georgia, serif; font-size: 0.94em; font-weight: 500; }
.font-vibes { font-family: "Great Vibes", "Pinyon Script", cursive; font-size: 1.5em; line-height: 1.4; -webkit-text-stroke: 0.5px currentColor; }
.font-pinyon { font-family: "Pinyon Script", "Great Vibes", cursive; font-size: 1.3em; line-height: 1.55; -webkit-text-stroke: 0.45px currentColor; }
.font-dancing { font-family: "Dancing Script", cursive; font-size: 1.2em; font-weight: 600; }
.font-caveat { font-family: "Caveat", cursive; font-size: 1.36em; line-height: 1.45; font-weight: 600; }
.verse { white-space: pre-wrap; overflow-wrap: anywhere; }

/* The top of the main screen */
.app-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.app-head h1 { margin-bottom: 2px; font-size: clamp(2.1rem, 4.6vw, 2.75rem); }
.app-head p { margin: 0; }
.app-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.view-tabs { display: inline-grid; margin-bottom: 24px; }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: var(--on-brand); font-size: 12px; font-weight: 600; }
#poems-view .toolbar { justify-content: space-between; margin-bottom: 24px; }
#poems-view .toolbar input { max-width: 300px; }

/* The drawer: poems as sheets lying a little askew */
.poems { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 28px 24px; }
.poems > .empty { grid-column: 1 / -1; }
.poem-card {
  display: flex; flex-direction: column; justify-content: space-between; gap: 16px;
  min-height: 270px; padding: 30px 26px 18px; border: 0; text-align: left; font: inherit; font-size: 16px; cursor: pointer;
  rotate: -0.7deg; transition: rotate 0.25s, translate 0.25s, box-shadow 0.25s;
}
.poem-card:nth-child(3n + 2) { rotate: 0.5deg; }
.poem-card:nth-child(3n) { rotate: -0.2deg; }
.poem-card:hover, .poem-card:focus-visible { rotate: 0deg; translate: 0 -4px; }
.poem-card-body, .poem-card-title, .poem-card-verse { display: block; }
.poem-card-title { margin-bottom: 10px; font-size: 1.35em; font-weight: 600; line-height: 1.2; }
.poem-card-verse { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.55; color: var(--ink); }
.poem-card-meta { display: flex; justify-content: space-between; gap: 8px; padding-top: 10px; border-top: 1px solid rgb(110 72 30 / 0.3); color: #3d2a1a; font: 500 13px var(--font); flex-wrap: wrap; }
.poem-card-meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* A poem received from someone carries their wax seal. */
.poem-card.received::after {
  content: ""; position: absolute; top: 14px; right: 16px; width: 36px; height: 36px;
  border-radius: 52% 46% 50% 48% / 47% 53% 46% 54%;
  background: radial-gradient(circle, #a3301f 0 34%, #7f1f14 35% 40%, #a3301f 41% 62%, #8e2619 63%);
  box-shadow: inset 0 1px 1px rgb(255 200 180 / 0.25), inset 0 -2px 3px rgb(50 5 0 / 0.35), 0 1px 2px rgb(60 10 5 / 0.45);
  rotate: 12deg;
}
.poem-card.received .poem-card-title { padding-right: 36px; }
/* A poem that arrived live and hasn't been read: a gilt glow until it's opened. */
.poem-card.fresh { box-shadow: 0 0 0 2px var(--gilt), 0 0 26px rgb(214 160 70 / 0.55), var(--shadow); animation: arrive 0.6s ease-out; }
@keyframes arrive { from { opacity: 0; translate: 0 -18px; } }

/* Calendar: the months on one sheet, scrolling up and down; a day with a poem is circled in ink */
.calendar-dialog { width: min(560px, 100% - 8px); }
.calendar-heading { font-size: 18px; }
.calendar-sheet { max-height: calc(100dvh - 90px); overflow-y: auto; padding: clamp(24px, 5vw, 40px) clamp(18px, 5vw, 44px); scroll-snap-type: y proximity; }
.calendar-empty { margin: 0 0 24px; color: #3d2a1a; font-size: 15px; text-align: center; }
.calendar-month { padding-bottom: 28px; scroll-snap-align: start; }
.calendar-month + .calendar-month { padding-top: 24px; border-top: 1px solid rgb(110 72 30 / 0.3); }
.calendar-month-name { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 14px; font: 600 20px var(--font-name); letter-spacing: 0.06em; text-transform: capitalize; }
.calendar-month-count { color: #3d2a1a; font: 500 13px var(--font); letter-spacing: 0; text-transform: none; }
.calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.calendar-week { margin-bottom: 6px; color: #5a3f24; font: 600 12px var(--font); letter-spacing: 0.04em; }
.calendar-cell {
  position: relative; display: grid; place-items: center; justify-self: center;
  width: 100%; max-width: 46px; aspect-ratio: 1; border-radius: 50%;
  color: rgb(40 25 12 / 0.75); font: 500 15px var(--font);
}
.calendar-cell.today { color: var(--ink); font-weight: 700; text-decoration: underline 2px var(--gilt); text-underline-offset: 4px; }
.calendar-day {
  padding: 0; border: 2px solid #5a3a1c; background: rgb(255 250 232 / 0.55); color: var(--ink);
  font-weight: 700; cursor: pointer; box-shadow: 0 1px 2px rgb(60 35 10 / 0.25); transition: background 0.15s, transform 0.15s;
}
.calendar-day.received { border-color: #a3301f; color: #7f1f14; }
.calendar-day:hover, .calendar-day:focus-visible, .calendar-day[aria-pressed="true"] { background: #f3e2bc; transform: scale(1.08); }
.calendar-count {
  position: absolute; top: -5px; right: -5px; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand); font: 700 11px var(--font);
}
.calendar-list { margin-top: 14px; padding: 12px 14px; border: 1px solid rgb(110 72 30 / 0.35); border-radius: 6px; background: rgb(255 250 232 / 0.45); }
.calendar-list-title { margin: 0 0 6px; color: #3d2a1a; font: 600 13px var(--font); }
.calendar-poem { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; width: 100%; padding: 8px 4px; border: 0; border-top: 1px solid rgb(110 72 30 / 0.2); background: none; color: var(--ink); text-align: left; cursor: pointer; }
.calendar-poem:first-of-type { border-top: 0; }
.calendar-poem:hover, .calendar-poem:focus-visible { background: rgb(160 122 60 / 0.12); }
.calendar-poem-title { font-size: 19px; font-weight: 600; }
.calendar-poem-meta { flex: none; color: #3d2a1a; font: 500 12px var(--font); }

/* Printing: the choice of look, then only #print-sheet on paper (js/app.js, "Printing") */
.print-choice-title { margin: 0 0 4px; font-size: 20px; }
.print-options { display: grid; gap: 10px; margin: 16px 0 4px; }
.print-option {
  display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--bg-subtle); color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.print-option:hover, .print-option:focus-visible { border-color: var(--gilt); background: var(--brand-soft); }
.print-option span { color: var(--text-2); font-size: 14px; line-height: 1.45; }
.print-sheet { display: none; }

@media print {
  /* No page margins: they'd stay white, and the browser writes its date and
     address into them. The sheet keeps its own margins instead, on every page
     ("clone" repeats the padding where a page breaks). */
  @page { size: A4; margin: 0; }
  html[data-print] body > :not(.print-sheet) { display: none !important; }
  html[data-print], html[data-print] body { display: block; min-height: 0; background: #fff; }
  /* The root's background fills every whole page. Browsers leave backgrounds
     out by default; "exact" keeps this one. */
  html[data-print="paper"] { background: var(--paper) url("/img/paper.svg"); print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  html[data-print="paper"] body { background: none; }
  html[data-print] .print-sheet {
    display: block; padding: 28mm 30mm 26mm; color: #1d1209; font-size: 14pt;
    box-decoration-break: clone; -webkit-box-decoration-break: clone;
  }
  /* Screen-only thickening of thin scripts: in print it would draw every letter twice in the PDF. */
  html[data-print] .print-sheet * { -webkit-text-stroke: 0; }
  /* A fixed box repeats on every page: the gilt frame. */
  .print-frame { position: fixed; inset: 11mm; border: 3px double #a07a3c; border-radius: 2px; }
  .print-title { margin: 0 0 1mm; font: inherit; font-size: 1.75em; line-height: 1.2; text-align: center; break-after: avoid; }
  .print-flourish { margin: 2mm auto 10mm; background: #8c6a35; print-color-adjust: exact; -webkit-print-color-adjust: exact; break-after: avoid; }
  .print-stanza { margin: 0 0 1.15em; line-height: 1.6; break-inside: avoid; }
  .print-line { display: block; padding-left: 1.6em; text-indent: -1.6em; white-space: pre-wrap; }
  .print-end { margin-top: 8mm; padding-right: 0.4em; text-align: right; break-before: avoid; break-inside: avoid; }
  .print-sign { margin: 0; font-style: italic; }
  .print-date { margin: 1.5mm 0 0; color: #4a3320; font: 10pt var(--font); }
  .print-colophon { margin: 12mm 0 0; color: #8c6a35; font: 600 8.5pt var(--font-name); letter-spacing: 0.3em; text-align: center; text-transform: uppercase; break-before: avoid; }
}

/* Live updates: a notice on paper in the corner, and the line above a poem that just arrived */
.notice.paper {
  position: fixed; right: 24px; bottom: 24px; z-index: 60;
  width: min(380px, 100% - 32px); padding: 18px 20px 16px;
  box-shadow: 0 0 0 1px var(--gilt), var(--shadow);
  animation: arrive 0.35s ease-out;
}
.notice-text { margin: 0 0 12px; font-size: 16px; line-height: 1.5; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.reader-new { margin: 0; color: #f3cf86; font: 600 15px var(--font); letter-spacing: 0.02em; }
@media (max-width: 640px) {
  .notice.paper { right: 16px; bottom: 16px; }
}
.empty-drawer .card-actions { justify-content: center; }

/* Dialogs: a sheet of paper over a dimmed room */
dialog { color: var(--text); }
dialog::backdrop { background: rgb(18 10 4 / 0.72); backdrop-filter: blur(3px); }
.sheet-dialog { width: min(804px, 100% - 8px); max-height: calc(100dvh - 16px); padding: 4px 12px 20px; border: 0; background: none; overflow-y: auto; }
.sheet-dialog[open] { animation: unfold 0.35s ease-out; }
/* Reader and calendar: the dialog itself never scrolls, only its sheet does, so
   the bar with "Zamknij" always stays in view. (Two scrolling areas one inside
   the other left it pushed off screen on iPhones.) */
.dialog-fit[open] { display: flex; flex-direction: column; overflow: hidden; }
.dialog-fit > .dialog-bar { flex: none; }
.dialog-fit > .paper, .reader-shell > .paper { flex: 0 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; }
@keyframes unfold { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.dialog-bar, .dialog-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.dialog-foot { margin: 14px 0 0; }
.dialog-foot .btn-primary { margin-left: auto; }
.dialog-actions { display: flex; gap: 8px; }
.dialog-heading { margin: 0; color: #f6ead0; }
.btn-light { background: rgb(255 248 230 / 0.08); border-color: rgb(255 240 210 / 0.28); color: #f6ead0; --spinner: #f6ead0; }
.btn-light:hover { background: rgb(255 248 230 / 0.16); }
.btn-light.danger { color: #f0a08c; }
.sheet-dialog .form-message { margin-top: 12px; }

.reader-sheet { max-height: calc(100dvh - 90px); overflow: auto; padding: clamp(36px, 7vw, 72px) clamp(24px, 8vw, 84px) clamp(32px, 6vw, 56px); font-size: 20px; }
.reader-sheet.turn { animation: turn 0.5s ease-out; }
@keyframes turn { from { opacity: 0.2; transform: perspective(1200px) rotateY(-8deg); } }

/* Opening a poem. The reader is hidden while closed, so all of this plays afresh
   each time it opens: a thin line of golden light widens, then opens into the
   sheet; the words come up like ink soaking into the paper, one part after
   another; and the glow around the sheet settles into slow breathing.
   Another poem while it's open (.turn) turns the page and brings the words up faster. */
#reader[open] { overflow: visible; animation: fade 0.45s ease-out; } /* visible: the glow reaches past the dialog's edge; the sheet still scrolls on its own */
#reader::backdrop { background: radial-gradient(ellipse 75% 65% at 50% 50%, rgb(120 56 24 / 0.42), transparent 75%), rgb(16 9 4 / 0.8); animation: fade 0.6s ease-out; }
@keyframes fade { from { opacity: 0; } }

.reader-sheet { animation: unseal 0.95s cubic-bezier(0.22, 0.8, 0.24, 1) backwards; }
@keyframes unseal {
  0% { clip-path: inset(49.6% 38% round 3px); }
  32% { clip-path: inset(49.6% 0 round 3px); }
  100% { clip-path: inset(-40px round 3px); } /* past the edges, so the sheet's shadow shows at the end */
}
.reader-sheet > * { animation: ink 0.9s ease-out both; }
.reader-sheet > :nth-child(1) { animation-delay: 0.55s; }
.reader-sheet > :nth-child(2) { animation-delay: 0.7s; }
.reader-sheet > :nth-child(3) { animation-delay: 0.85s; }
.reader-sheet > :nth-child(4) { animation-delay: 1.1s; }
.reader-sheet > :nth-child(5) { animation-delay: 1.2s; }
.reader-sheet.turn > * { animation-name: ink-again; animation-duration: 0.6s; } /* a new name restarts it */
.reader-sheet.turn > :nth-child(1) { animation-delay: 0.1s; }
.reader-sheet.turn > :nth-child(2) { animation-delay: 0.16s; }
.reader-sheet.turn > :nth-child(3) { animation-delay: 0.22s; }
.reader-sheet.turn > :nth-child(4) { animation-delay: 0.34s; }
.reader-sheet.turn > :nth-child(5) { animation-delay: 0.4s; }
@keyframes ink { from { opacity: 0; filter: blur(5px); translate: 0 6px; } }
@keyframes ink-again { from { opacity: 0; filter: blur(5px); translate: 0 6px; } }

/* The glow around the sheet: warm gold light under a layer of embers and wine.
   They breathe in turn (one brightens as the other dims), so the glow slowly
   lightens and darkens. Only opacity and transform move, which stays smooth on phones. */
.reader-shell { position: relative; isolation: isolate; display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
.reader-shell::before, .reader-shell::after { content: ""; position: absolute; inset: -6px; z-index: -1; border-radius: 14px; pointer-events: none; filter: blur(18px); }
.reader-shell::before {
  background: linear-gradient(140deg, #f6dc9a, #e8a050 35%, #c9a35c 65%, #f3cf86);
  animation: flare 1.4s ease-out both, breathe 7s ease-in-out 1.4s infinite alternate;
}
.reader-shell::after {
  background: linear-gradient(140deg, #8a4a22, #b5523b 40%, #6e2a2a 70%, #31231e);
  animation: ember 1.4s ease-in both, breathe 7s ease-in-out 1.4s infinite alternate-reverse;
}
@keyframes flare {
  0% { opacity: 0; transform: scale(0.55, 0.02); }
  20% { opacity: 1; transform: scale(1.04, 0.04); }
  42% { opacity: 1; transform: scale(1.05); }
  60% { opacity: 1; transform: scale(1.05); }
  100% { opacity: 0.3; transform: scale(0.985); }
}
@keyframes ember { 0%, 55% { opacity: 0; transform: scale(1.02); } 100% { opacity: 0.85; transform: scale(1.02); } }
@keyframes breathe { from { opacity: 0.3; transform: scale(0.985); } to { opacity: 0.85; transform: scale(1.02); } }
.sheet-title { margin: 0 0 6px; font: inherit; font-size: 1.7em; font-weight: 600; line-height: 1.2; text-align: center; }
.reader-sheet .verse { margin: 0 0 32px; color: var(--ink); line-height: 1.7; }
.signature { margin: 0; color: var(--ink); font-style: italic; text-align: right; }
.signature-date { margin: 2px 0 0; color: #3d2a1a; font: 15px var(--font); text-align: right; }

/* The editor: tools on a card, then the sheet itself is the text box */
.editor-tools { display: grid; grid-template-columns: 1fr 220px; gap: 16px; margin-bottom: 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.editor-tools fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.editor-tools legend { margin-bottom: 6px; padding: 0; }
.font-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.font-choice { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text-2); font-size: 15px; cursor: pointer; }
.font-choice input { position: absolute; opacity: 0; pointer-events: none; }
.font-choice:has(input:checked) { border-color: var(--gilt); background: var(--brand-soft); color: var(--text); }
.font-choice:has(input:focus-visible) { outline: 2px solid var(--gilt); outline-offset: 2px; }
.font-sample { font-size: 1.2em; line-height: 1; }
.editor-sheet { display: grid; padding: clamp(28px, 6vw, 56px) clamp(20px, 7vw, 72px); font-size: 20px; }
.paper input.sheet-title, .paper textarea.sheet-verse {
  min-height: 0; padding: 4px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: var(--ink); font: inherit;
}
.paper input.sheet-title { font-size: 1.7em; font-weight: 600; text-align: center; }
.paper textarea.sheet-verse { min-height: max(360px, 72dvh); line-height: 1.7; resize: none; overflow: hidden; }
.paper input.sheet-title:focus, .paper textarea.sheet-verse:focus { box-shadow: none; }
.paper input.sheet-title::placeholder, .paper textarea.sheet-verse::placeholder { color: rgb(70 45 22 / 0.6); }
.paper .field-error { color: #9b2c1f; font-size: 15px; }

.confirm-dialog { width: min(420px, 100% - 32px); padding: 0; border: 0; background: none; }
.confirm-dialog .card { box-shadow: var(--shadow); }
.confirm-dialog p { color: var(--text); font-size: 18px; }
.confirm-dialog .card-actions { justify-content: flex-end; }

/* Friends */
.friends { display: grid; gap: 16px; max-width: 720px; }
.friends .card h2 { margin-bottom: 4px; }
.friends .card > .muted { font-size: 16px; }
.inline-field { display: flex; gap: 8px; }
.person { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.card > h2 + div > .person:first-child, #found > .person { border-top: 0; }
#found:not(:empty) { margin-top: 16px; padding: 4px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-subtle); }
.person-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }

/* The opening animation */
.intro { position: fixed; inset: 0; z-index: 100; background: #000; cursor: pointer; transition: opacity 1.2s; }
.intro.leaving { opacity: 0; pointer-events: none; }
.intro.fast { transition-duration: 0.45s; }
.intro canvas { display: block; width: 100%; height: 100%; }
.intro-title { position: absolute; inset: 0; display: grid; place-content: center; padding: 16px; text-align: center; pointer-events: none; opacity: 0; transform: scale(0.96); transition: opacity 1.6s, transform 3s ease-out; }
.intro.titled .intro-title { opacity: 1; transform: none; }
.intro-name { margin: 0; color: #fff8e8; font: italic 500 clamp(3.25rem, 13vw, 7.5rem)/1 var(--font-poetic); text-shadow: 0 0 24px rgb(255 190 110 / 0.9), 0 0 60px rgb(255 120 80 / 0.6); }
.intro-line { margin: 0.6em 0 0; color: #fffaf0; font: italic 400 clamp(1.1rem, 3.2vw, 1.45rem) "EB Garamond", Georgia, serif; letter-spacing: 0.05em; text-shadow: 0 1px 3px rgb(90 30 40 / 0.8), 0 0 18px rgb(110 30 60 / 0.7); }
.intro-skip { position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); padding: 8px 16px; border: 1px solid rgb(255 240 210 / 0.35); border-radius: 999px; background: rgb(0 0 0 / 0.25); color: #fff3dc; font: 400 16px var(--font); cursor: pointer; }
.intro-skip:hover { background: rgb(0 0 0 / 0.45); }

/* The home page: the sea at sunset behind the name */
.sea { position: relative; display: grid; place-items: center; min-height: min(86dvh, 780px); padding: 64px var(--gutter) 120px; overflow: hidden; background: #2c2a5c; text-align: center; }
.sea canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.sea::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgb(20 12 30 / 0.35), transparent 40%, transparent 70%, var(--bg)); pointer-events: none; }
.sea-text { position: relative; z-index: 1; max-width: 680px; translate: 0 -8vh; }
.sea h1 { margin-bottom: 12px; color: #fff8e8; font-family: var(--font-poetic); font-size: clamp(3.25rem, 11vw, 6.5rem); font-style: italic; font-weight: 500; letter-spacing: 0; line-height: 1; text-shadow: 0 2px 30px rgb(120 40 20 / 0.6); }
.sea .lead { margin: 0 auto 28px; color: #fff1dc; font-size: clamp(1.2rem, 3vw, 1.45rem); text-shadow: 0 1px 12px rgb(60 20 10 / 0.7); }
.sea .eyebrow { color: #ffe2b0; text-shadow: 0 1px 8px rgb(60 20 10 / 0.6); }
.sea .btn:not(.btn-primary) { background: rgb(40 18 30 / 0.42); border-color: rgb(255 240 210 / 0.55); color: #fff8e8; backdrop-filter: blur(4px); }
.section-home { padding-block: clamp(56px, 9vw, 112px); }
.section-title { max-width: 760px; margin: 0 auto clamp(32px, 5vw, 56px); font-size: clamp(2rem, 4.4vw, 3rem); text-align: center; }
.site-nav { display: flex; gap: 26px; margin-left: auto; margin-right: 12px; }
.site-nav a { color: var(--text-2); font-size: 17px; }
.site-nav a:hover { color: var(--text); text-decoration: none; }

/* The motto under the sea */
.manifest { max-width: 860px; padding-block: clamp(40px, 7vw, 80px) 0; text-align: center; }
.manifest-quote { margin: 0 0 20px; font-size: clamp(1.9rem, 4.6vw, 3rem); line-height: 1.15; }
.manifest-text { max-width: 640px; margin: 0 auto 28px; color: var(--text-2); font-size: 19px; }

/* How it works: roman numerals on a gilt line */
.steps { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; margin: 0; padding: 0; list-style: none; }
.steps::before { content: ""; position: absolute; top: 34px; left: 16%; right: 16%; border-top: 1px solid var(--gilt); opacity: 0.6; }
.steps li { position: relative; text-align: center; }
.step-number { display: inline-grid; place-items: center; width: 68px; height: 68px; margin-bottom: 18px; border: 1px solid var(--gilt); border-radius: 50%; background: var(--bg); color: var(--brand-ink); font: 600 24px var(--font-caps); box-shadow: 0 0 0 6px var(--bg); }
.steps h3 { font-size: 1.6rem; }
.steps p { max-width: 300px; margin: 0 auto; }

/* The app, shown: text beside a real screenshot */
.split { display: grid; grid-template-columns: 5fr 7fr; align-items: center; gap: clamp(32px, 6vw, 72px); margin-bottom: clamp(56px, 8vw, 96px); }
.section-home > .split:last-child { margin-bottom: 0; }
.split-reverse { grid-template-columns: 7fr 5fr; }
.split-reverse .split-text { order: 2; }
.split-text h2, .split-text h3 { font-size: clamp(1.75rem, 3.4vw, 2.4rem); line-height: 1.15; }
.split-text > p:not(.eyebrow) { font-size: 18px; }
.checks { margin: 20px 0 0; padding: 0; list-style: none; }
.checks li { position: relative; margin-bottom: 10px; padding-left: 28px; color: var(--text-2); }
.checks li::before { content: "✦"; position: absolute; left: 2px; top: 1px; color: var(--gilt); font-size: 14px; }
.browser { margin: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: 0 2px 4px rgb(40 24 10 / 0.12), 0 30px 60px -20px rgb(40 24 10 / 0.45); }
.browser-bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--bg-subtle); }
.browser-bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.browser img { display: block; width: 100%; height: auto; }

.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px 48px; margin: 0; padding: clamp(40px, 6vw, 64px) 0 0; border-top: 1px solid var(--line); list-style: none; }
.feature-grid svg { width: 34px; height: 34px; margin-bottom: 12px; fill: none; stroke: var(--gilt); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.feature-grid h3 { margin-bottom: 6px; font-size: 1.45rem; }
.feature-grid p { margin: 0; }

/* Seven fonts, one line in each */
.specimens-section { background: var(--bg-subtle); border-block: 1px solid var(--line); }
/* One sheet, like a page from a type specimen book */
.specimens { max-width: 920px; margin: 0 auto; padding: clamp(12px, 3vw, 28px) clamp(20px, 5vw, 56px); list-style: none; }
.specimens li { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 24px; padding: 18px 0; border-bottom: 1px solid rgb(110 72 30 / 0.22); }
.specimens li:last-child { border-bottom: 0; }
.specimen-line { color: var(--ink); font-size: clamp(24px, 4vw, 32px); line-height: 1.3; }
.specimen-name { color: #3d2a1a; font: 600 12px var(--font-caps); letter-spacing: 0.12em; text-transform: uppercase; }

/* The sample poem, with a wax seal */
.sample { margin: 0; padding: clamp(40px, 6vw, 64px) clamp(28px, 6vw, 60px); rotate: -0.8deg; }
.sample.font-vibes { font-size: clamp(28px, 3.4vw, 36px); }
.sample .verse { margin: 0 0 20px; color: var(--ink); line-height: 1.55; }
.sample .signature { color: var(--ink); }
.seal { position: absolute; top: 18px; right: 22px; width: 46px; height: 46px; border-radius: 52% 46% 50% 48% / 47% 53% 46% 54%; background: radial-gradient(circle, #a3301f 0 34%, #7f1f14 35% 40%, #a3301f 41% 62%, #8e2619 63%); box-shadow: inset 0 1px 1px rgb(255 200 180 / 0.25), inset 0 -2px 3px rgb(50 5 0 / 0.35), 0 1px 2px rgb(60 10 5 / 0.45); rotate: 12deg; }

/* Privacy: a band of dark leather */
.privacy-band { padding-block: clamp(56px, 9vw, 104px); background: #2a1d17 url("/img/grain.svg"); color: #f6ead0; }
.privacy-band .eyebrow { color: #e3b673; }
.privacy-band h2 { color: #fff8e8; }
.privacy-band a { color: #e3b673; }
.privacy-points { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 0 0 32px; padding: 0; overflow: hidden; border: 1px solid rgb(201 163 92 / 0.35); border-radius: var(--radius-lg); background: rgb(201 163 92 / 0.35); list-style: none; }
.privacy-points li { display: grid; align-content: start; gap: 6px; padding: 26px 24px; background: #2a1d17; }
.privacy-points strong { color: #fff8e8; font: 700 1.2rem var(--font-display); }
.privacy-points span { color: #e3d3b4; font-size: 17px; }

/* Questions */
.faq { display: grid; grid-template-columns: 4fr 7fr; gap: clamp(32px, 6vw, 80px); align-items: start; }
.faq-intro h2 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.1; }
.faq-list details { border-bottom: 1px solid var(--line-strong); }
.faq-list details:first-child { border-top: 1px solid var(--line-strong); }
.faq-list summary { display: flex; justify-content: space-between; gap: 16px; padding: 20px 4px; color: var(--text); font: 700 1.15rem var(--font-display); list-style: none; cursor: pointer; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary::after { content: "+"; flex: none; color: var(--gilt); font: 400 1.6rem/1 var(--font); transition: rotate 0.2s; }
.faq-list details[open] summary::after { rotate: 45deg; }
.faq-list details p { max-width: 620px; margin: -6px 4px 20px; }

/* The last invitation */
.cta-band { padding-block: clamp(56px, 8vw, 96px) 0; overflow: hidden; background: linear-gradient(160deg, #3a2a22, #22170f); color: #f6ead0; }
.cta-inner { display: grid; grid-template-columns: 5fr 7fr; align-items: center; gap: clamp(32px, 6vw, 80px); }
.cta-inner h2 { color: #fff8e8; font-size: clamp(2.1rem, 4.6vw, 3.25rem); }
.cta-inner p { max-width: 520px; color: #e8d9bb; font-size: 19px; }
.cta-inner .hero-actions { justify-content: flex-start; padding-bottom: clamp(32px, 5vw, 56px); }
.phone { justify-self: center; width: min(300px, 70vw); margin: 0; padding: 10px 10px 0; border-radius: 42px 42px 0 0; background: #120b07; box-shadow: 0 0 0 1px rgb(201 163 92 / 0.4), 0 30px 60px rgb(0 0 0 / 0.5); }
.phone img { display: block; width: 100%; height: 440px; object-fit: cover; object-position: top; border-radius: 32px 32px 0 0; }
.btn-gilt { background: #c9a35c; border-color: #c9a35c; color: #22170f; }
.btn-gilt:hover { background: #d8b674; }
.btn-outline-light { background: transparent; border-color: rgb(246 234 208 / 0.45); color: #f6ead0; }
.btn-outline-light:hover { background: rgb(246 234 208 / 0.08); }

/* The footer in columns, the same on every page (signed-in pages swap the "Konto" links) */
.footer-wide { margin-top: clamp(72px, 12vw, 160px); padding-block: 48px 24px; } /* room between the poems (or any page) and the footer */
main:has(> .cta-band:last-child) + .footer-wide { margin-top: 0; } /* the home page ends with a dark band that meets the footer */
.footer-grid .link-button { justify-self: start; color: var(--text-2); font-size: inherit; text-align: left; }
section[id] { scroll-margin-top: 72px; } /* the sticky header doesn't cover a section opened with /#jak etc. */
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid p { max-width: 280px; margin-top: 12px; color: var(--muted); }
.footer-grid nav { display: grid; align-content: start; gap: 8px; }
.footer-grid h3 { margin: 0 0 4px; color: var(--text); font: 600 12px var(--font-caps); letter-spacing: 0.14em; text-transform: uppercase; }
.footer-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); }

@media (max-width: 900px) {
  .site-nav { display: none; }
  .split, .split-reverse, .faq, .cta-inner { grid-template-columns: 1fr; }
  .split-reverse .split-text { order: 0; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .privacy-points { grid-template-columns: repeat(2, 1fr); }
  .cta-inner > div { order: -1; text-align: center; }
  .cta-inner p { margin-inline: auto; }
  .cta-inner .hero-actions { justify-content: center; padding-bottom: 8px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .steps { grid-template-columns: 1fr; }
  .steps::before { display: none; }
  .feature-grid, .privacy-points { grid-template-columns: 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .header-actions .btn-ghost { display: none; }
}



/* ---------- 8. Small screens, reduced motion ---------- */

@media (max-width: 560px) {
  .header-inner { min-height: 56px; }
  .header-actions .btn { padding: 0 12px; }
  .auth-card { padding: 24px 20px; }
  .card { padding: 20px; }
  .row { flex-wrap: wrap; }
  .app-actions, .app-actions .btn { flex: 1; }
  #poems-view .toolbar input { max-width: none; }
  .editor-tools { grid-template-columns: 1fr; }
  .person { flex-wrap: wrap; }
  .person-actions { width: 100%; justify-content: flex-start; padding-left: 48px; }
  .inline-field { flex-direction: column; }
  .reader-sheet, .editor-sheet { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  /* The reader's delays would keep the words hidden, and its endless breathing would flicker: a still glow instead. */
  .reader-sheet, .reader-sheet > *, .reader-shell::before, .reader-shell::after { animation: none !important; }
  .reader-shell::before { opacity: 0.6; }
  .reader-shell::after { opacity: 0.35; }
}
