/* «Собачка». Tokens first, then the shell, the card (which mirrors src/server/card/render.ts), the pages. */
@font-face { font-family: 'Golos Text'; font-weight: 400; font-style: normal; font-display: swap; src: url(/static/fonts/GolosText-Regular.ttf) format('truetype'); }
@font-face { font-family: 'Golos Text'; font-weight: 700; font-style: normal; font-display: swap; src: url(/static/fonts/GolosText-Bold.ttf) format('truetype'); }

:root {
  --bg: #f4eee3; --surface: #fffcf7; --surface-2: #f6efe2; --text: #1f1a16; --muted: #6f655b; --border: #e4dacb;
  --accent: #e8862b; --accent-dark: #c96d14; --danger: #b8392b; --link: #2f66c2;
  --radius: 16px; --shadow: 0 1px 2px rgba(31, 26, 22, .06), 0 10px 28px -14px rgba(31, 26, 22, .22);
  --sans: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120e; --surface: #1f1a15; --surface-2: #2a2319; --text: #f1e9dc; --muted: #a79b8d; --border: #37302a; --link: #86b0f0;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  --bg: #15120e; --surface: #1f1a15; --surface-2: #2a2319; --text: #f1e9dc; --muted: #a79b8d; --border: #37302a; --link: #86b0f0;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 17px; line-height: 1.5; }
a { color: var(--link); }
h1, h2 { line-height: 1.2; letter-spacing: -0.01em; }
button { font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* the «Без мата» switch: both spellings are in the HTML, CSS shows one */
.w-mild { display: none; }
.sfw .w-strong { display: none; }
.sfw .w-mild { display: inline; }

/* shell */
.site-header { max-width: 760px; margin: 0 auto; padding: 20px 16px 6px; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
.logo { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 700; font-size: 26px; }
.logo img { border-radius: 50%; }
.tagline { margin: 0; flex: 1 1 220px; color: var(--muted); font-size: 15px; }
.sfw-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.sfw-toggle[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs { max-width: 760px; margin: 0 auto; padding: 8px 16px; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); text-decoration: none; white-space: nowrap; font-size: 15px; }
.tab.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.tab-tell { margin-left: auto; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.tab-tell.on { background: var(--accent-dark); color: #fff; }
.page { max-width: 760px; margin: 0 auto; padding: 8px 16px 48px; }
.site-footer { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; color: var(--muted); font-size: 14px; }
.site-footer a { color: inherit; }

.lead h1 { margin: 18px 0 6px; font-size: 30px; }
.intro { margin: 0 0 16px; color: var(--muted); }
.empty { padding: 32px 0; text-align: center; color: var(--muted); }
.error { margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--danger); }
.button, .primary { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; font-size: 15px; cursor: pointer; }
.button.accent, .primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.button:hover { border-color: var(--text); }
.primary:hover, .button.accent:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* the card, mirroring src/server/card/render.ts at 1200 px: white panel with the story, the photo below
   (object-position keeps both heads in view), the signature as the meme caption; sizes in cqw */
.card { position: relative; margin: 0; aspect-ratio: 1200 / 630; container-type: inline-size; overflow: hidden; border-radius: var(--radius); background: #fff; color: #1f1a16; font-family: var(--sans); display: flex; flex-direction: column; }
.card .panel { flex: none; max-height: 47.6%; overflow: hidden; padding: 2.167cqw 3.333cqw 2cqw; background: #fff; }
.card .bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.25; }
.card.len-s .bubble-text { font-size: 3.667cqw; }
.card.len-m .bubble-text { font-size: 3.083cqw; }
.card.len-l .bubble-text { font-size: 2.583cqw; }
.card.len-xl .bubble-text { font-size: 2.167cqw; }
.card.len-xxl .bubble-text { font-size: 1.6cqw; }
.card .reply { margin-top: 0.833cqw; font-size: 2.4cqw; color: #5b4f44; line-height: 1.25; }
.card.len-xl .reply, .card.len-xxl .reply { font-size: 1.8cqw; }
.card .reply b { color: #c96d14; }
.card .reply[hidden] { display: none; }
.card .photo { position: relative; flex: 1; min-height: 0; overflow: hidden; }
/* the photo's frame: full width at the photo's own ratio (770×513 → 66.62cqw tall), moved up so the heads
   stay in view like object-position 50% 42% would; the fried eyes are placed inside it in % of the photo */
.card .photo .frame { position: absolute; left: 0; right: 0; top: calc(42% - 27.98cqw); aspect-ratio: 770 / 513; }
.card .photo img { width: 100%; height: 100%; display: block; }
.card .eye, .card .fry { display: none; }
.card.fried .panel, .card.fried .photo .frame img { filter: saturate(3) contrast(1.55) brightness(1.05) sepia(.25); }
.card.fried .eye { display: block; position: absolute; width: 9.5cqw; height: 9.5cqw; transform: translate(-50%, -50%); border-radius: 50%; background: radial-gradient(circle, #fff 0, #ff3b1f 20%, rgba(255, 32, 0, 0) 70%); }
.card.fried .eye::before, .card.fried .eye::after { content: ""; position: absolute; left: 50%; top: 50%; background: #fff4c8; opacity: .85; transform: translate(-50%, -50%); }
.card.fried .eye::before { width: 15cqw; height: .25cqw; }
.card.fried .eye::after { width: .25cqw; height: 11.7cqw; }
.card.fried .fry { display: block; position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.card.fried .fry span { position: absolute; transform: translate(-50%, -50%); color: #ffd400; text-shadow: 0 0 .5cqw #000; line-height: 1; }

/* fried positions: TIGER_EYES (in the 770×513 photo) and FRY_EMOJI (in the 1200×630 card) from card/render.ts */
.card .eye-1 { left: 56.36%; top: 38.01%; }
.card .eye-2 { left: 52.34%; top: 42.30%; }
.card .fe-1 { left: 88.33%; top: 53.97%; font-size: 7.67cqw; }
.card .fe-2 { left: 3.33%; top: 52.38%; font-size: 6.67cqw; }
.card .fe-3 { left: 77.50%; top: 74.60%; font-size: 6.17cqw; }
.card .fe-4 { left: 25.00%; top: 68.25%; font-size: 5.83cqw; }
.card .fe-5 { left: 10.83%; top: 92.86%; font-size: 5.00cqw; }
.card .photo::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 12.5cqw; background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.55)); }
.card .signature { position: absolute; z-index: 1; left: 0; right: 0; bottom: 1cqw; text-align: center; color: #fff; font-weight: 700; font-size: 4.333cqw; white-space: nowrap; text-shadow: 0 0 .5cqw #000, .17cqw .17cqw 0 #000, -.17cqw .17cqw 0 #000, .17cqw -.17cqw 0 #000, -.17cqw -.17cqw 0 #000; }

/* stories */
.feed { display: grid; gap: 24px; }
.story { padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); box-shadow: var(--shadow); }
.card-link { display: block; color: inherit; text-decoration: none; }
.story-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 4px 2px; }
.reactions { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.react { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font-size: 14px; cursor: pointer; }
.react:hover { border-color: var(--text); }
.react.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.react .n { font-weight: 700; }
.react .n:empty { display: none; }
.story-time { color: var(--muted); font-size: 14px; text-decoration: none; }
.story.full .story-text { padding: 12px 8px 4px; }
.story.full .story-text p { margin: 0 0 8px; }
.story.full .story-text .body { white-space: pre-wrap; overflow-wrap: anywhere; }
.story.full .sig { color: var(--muted); }
.dog-line .who { font-weight: 700; color: var(--accent-dark); }
.dog-wait { color: var(--muted); font-style: italic; }
.share { display: flex; gap: 8px; flex-wrap: wrap; padding: 8px 8px 4px; }
.report { padding: 10px 8px 4px; color: var(--muted); font-size: 14px; }
.report form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.report input { font: inherit; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); min-width: 220px; }
.more { text-align: center; margin: 24px 0; }

/* telling */
.tell { display: grid; gap: 12px; margin-bottom: 20px; }
.tell textarea { width: 100%; font: inherit; line-height: 1.4; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); resize: vertical; }
.tell textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.tell-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.degree { position: relative; display: inline-flex; margin: 0; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.degree input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.degree label { padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 15px; }
.degree input:checked + label { background: var(--text); color: var(--bg); }
.degree input:focus-visible + label { outline: 2px solid var(--accent); }
.counter { color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.want-reply { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.tell .primary { justify-self: start; padding: 11px 22px; font-size: 16px; }
.tell-inline { margin: 4px 0 20px; }
.tell-inline summary { cursor: pointer; display: inline-flex; padding: 11px 22px; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 700; list-style: none; }
.tell-inline summary::-webkit-details-marker { display: none; }
.tell-inline[open] summary { margin-bottom: 12px; }
.preview { margin-top: 8px; }

/* prose (about) */
.prose h1 { font-size: 30px; margin: 18px 0 12px; }
.prose h2 { font-size: 21px; margin: 28px 0 8px; }
.prose p, .prose li { margin: 0 0 10px; }
.prose ul { padding-left: 22px; }

/* admin */
.admin-login { display: grid; gap: 12px; max-width: 360px; }
.admin-login input { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; width: 100%; background: var(--surface); color: var(--text); }
.inline { display: inline; }
.inline button, .acts button { font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; margin: 2px 2px 2px 0; }
.acts .danger { color: var(--danger); }
table.admin { width: 100%; border-collapse: collapse; font-size: 14px; }
table.admin td { padding: 8px 6px; border-top: 1px solid var(--border); vertical-align: top; }
table.admin .t { white-space: nowrap; width: 1%; }
table.admin .flags { color: var(--danger); }
h2 small { color: var(--muted); font-weight: 400; font-size: 15px; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .lead h1 { font-size: 26px; }
  .story { padding: 6px; }
  .react { padding: 6px 10px; font-size: 13px; }
}
