/* Talaiot kit v1: the shared look of talaiot.net and its collection sites.
   Master copy: comic-generator/site/kit/. Every site carries a copy in kit/; never edit a copy,
   edit the master and run scripts/sync_kit.py (docs/talaiot-network.md). */

:root {
  color-scheme: light;
  --tl-paper: #f5efe1;
  --tl-paper-2: #ece2cc;
  --tl-card: #fffaf0;
  --tl-ink: #221d16;
  --tl-muted: #665b4b;
  --tl-rule: #cbbfa6;
  --tl-line: #3a3127;
  --tl-dot: rgba(60, 45, 25, .13);
  --tl-stone: #b97a2c;
  --tl-accent: #9a4a22;
  --tl-accent-2: #b97a2c;
  --tl-on-accent: #fffaf0;
  --tl-focus: #1f6d8c;
  --tl-shadow: rgba(34, 29, 22, .16);
  --tl-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --tl-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tl-radius: 12px;
  --tl-max: 76rem;
}
:root[data-site="rondalles"] { --tl-accent: #a5381f; --tl-accent-2: #c48a1c; }
:root[data-site="olimp"]     { --tl-accent: #1b5a85; --tl-accent-2: #b98515; }
:root[data-site="cthulhu"]   { --tl-accent: #1d6158; --tl-accent-2: #5b4a86; }

/* Dark: the same tokens, set twice (system preference unless the reader chose light, or the reader chose dark). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --tl-paper: #14120e; --tl-paper-2: #1c1914; --tl-card: #211d17; --tl-ink: #f1e8d6; --tl-muted: #b8ab94;
    --tl-rule: #463e32; --tl-line: #7a6e5b; --tl-dot: rgba(240, 225, 195, .07); --tl-stone: #e0a856;
    --tl-accent: #eba77d; --tl-accent-2: #e0a856; --tl-on-accent: #14120e; --tl-focus: #9fd8ef; --tl-shadow: rgba(0, 0, 0, .5);
  }
  :root[data-site="rondalles"]:not([data-theme="light"]) { --tl-accent: #ef9478; --tl-accent-2: #e7b860; }
  :root[data-site="olimp"]:not([data-theme="light"])     { --tl-accent: #8ec6ea; --tl-accent-2: #f0c66c; }
  :root[data-site="cthulhu"]:not([data-theme="light"])   { --tl-accent: #74c8b5; --tl-accent-2: #b5a3e8; }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --tl-paper: #14120e; --tl-paper-2: #1c1914; --tl-card: #211d17; --tl-ink: #f1e8d6; --tl-muted: #b8ab94;
  --tl-rule: #463e32; --tl-line: #7a6e5b; --tl-dot: rgba(240, 225, 195, .07); --tl-stone: #e0a856;
  --tl-accent: #eba77d; --tl-accent-2: #e0a856; --tl-on-accent: #14120e; --tl-focus: #9fd8ef; --tl-shadow: rgba(0, 0, 0, .5);
}
:root[data-site="rondalles"][data-theme="dark"] { --tl-accent: #ef9478; --tl-accent-2: #e7b860; }
:root[data-site="olimp"][data-theme="dark"]     { --tl-accent: #8ec6ea; --tl-accent-2: #f0c66c; }
:root[data-site="cthulhu"][data-theme="dark"]   { --tl-accent: #74c8b5; --tl-accent-2: #b5a3e8; }

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--tl-paper);
  color: var(--tl-ink);
  font: 18px/1.6 var(--tl-serif);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--tl-accent); text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--tl-focus); outline-offset: 3px; }
img { max-width: 100%; }
.tl-wrap { max-width: var(--tl-max); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px); }
.tl-nw { white-space: nowrap; }
.tl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header: the same bar on every site (drawn by talaiot.js into <header class="tl-bar">) */
.tl-bar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--tl-paper) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid var(--tl-line);
}
.tl-bar-inner {
  max-width: var(--tl-max); margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px);
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap; min-height: 60px;
}
.tl-home {
  display: inline-flex; align-items: center; gap: 10px; color: var(--tl-ink); text-decoration: none;
  font: 700 .8rem/1 var(--tl-sans); letter-spacing: .18em; text-transform: uppercase;
}
.tl-home img { width: 52px; height: 32px; object-fit: contain; }
.tl-sites { display: flex; flex-wrap: wrap; gap: 2px 4px; font: 600 .84rem/1.2 var(--tl-sans); }
.tl-sites a {
  color: var(--tl-muted); text-decoration: none; padding: 8px 10px; border-radius: 8px;
}
.tl-sites a:hover { color: var(--tl-ink); background: var(--tl-paper-2); }
.tl-sites a[aria-current="page"] { color: var(--tl-ink); box-shadow: inset 0 -3px 0 var(--tl-accent); border-radius: 8px 8px 0 0; }
.tl-controls { margin-inline-start: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.tl-choice {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--tl-rule); border-radius: 12px; background: var(--tl-card);
}
.tl-choice button, .tl-choice a {
  appearance: none; border: 0; margin: 0; background: transparent; color: var(--tl-ink); cursor: pointer;
  min-width: 40px; height: 38px; padding: 0 9px; border-radius: 9px;
  display: inline-grid; place-items: center; text-decoration: none;
  font: 700 .76rem/1 var(--tl-sans); letter-spacing: .06em;
}
.tl-choice button:hover, .tl-choice a:hover { background: var(--tl-paper-2); }
.tl-choice [aria-pressed="true"], .tl-choice [aria-current="true"] { background: var(--tl-ink); color: var(--tl-paper); }
.tl-choice svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 760px) {
  .tl-bar { position: static; }
  .tl-bar-inner { gap: 4px 8px; padding-top: 6px; padding-bottom: 2px; }
  .tl-sites { order: 3; flex-basis: 100%; margin: 0 -10px; flex-wrap: nowrap; overflow-x: auto; }
  .tl-home span { display: none; }
  .tl-home img { width: 44px; height: 28px; }
  .tl-controls { gap: 6px; }
  .tl-choice { padding: 2px; border-radius: 10px; }
  .tl-choice button, .tl-choice a { min-width: 34px; height: 34px; padding: 0 6px; border-radius: 8px; }
  .tl-choice svg { width: 17px; height: 17px; }
}

/* Hero */
.tl-hero { position: relative; padding: clamp(36px, 7vw, 84px) 0 clamp(28px, 5vw, 56px); overflow: hidden; }
.tl-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(var(--tl-dot) 1.3px, transparent 1.6px) 0 0 / 13px 13px;
  -webkit-mask-image: linear-gradient(170deg, #000 0%, transparent 70%); mask-image: linear-gradient(170deg, #000 0%, transparent 70%);
}
.tl-kicker {
  margin: 0 0 .9em; color: var(--tl-accent);
  font: 700 .78rem/1.4 var(--tl-sans); letter-spacing: .16em; text-transform: uppercase;
}
.tl-title {
  margin: 0 0 .35em; font-family: var(--tl-serif); font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 5.6rem); line-height: 1.02; letter-spacing: -.045em; text-wrap: balance;
}
.tl-title em { color: var(--tl-accent); }
.tl-lead { max-width: 40em; margin: 0; font-size: clamp(1.08rem, 1.6vw, 1.28rem); line-height: 1.55; text-wrap: pretty; }
.tl-stats { display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 30px 0 0; padding: 18px 0 0; border-top: 1px solid var(--tl-rule); }
.tl-stats div { display: flex; flex-direction: column; }
.tl-stats b { font: 500 2rem/1 var(--tl-serif); letter-spacing: -.03em; }
.tl-stats span { font: 700 .7rem/1.6 var(--tl-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--tl-muted); }

/* Notice (work in progress) */
.tl-notice {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  margin: 26px 0 0; padding: 12px 16px; max-width: 52rem;
  border: 1.5px dashed var(--tl-line); border-radius: var(--tl-radius); background: var(--tl-card);
  font-size: 1rem; line-height: 1.5;
}
.tl-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px; background: var(--tl-ink); color: var(--tl-paper);
  font: 700 .68rem/1.4 var(--tl-sans); letter-spacing: .12em; text-transform: uppercase;
}

/* Fact boxes */
.tl-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 18px; margin: 8px 0 0; padding: 0; list-style: none; }
.tl-facts > * { background: var(--tl-card); border: 1.5px solid var(--tl-line); border-radius: var(--tl-radius); padding: 18px 20px 20px; }
.tl-facts h2, .tl-facts h3 { margin: 0 0 .35em; font: 500 1.3rem/1.2 var(--tl-serif); letter-spacing: -.02em; }
.tl-facts p { margin: 0; font-size: 1rem; line-height: 1.55; }
.tl-facts p + p { margin-top: .6em; }

/* Section headings */
.tl-section { margin: clamp(44px, 7vw, 72px) 0 0; }
.tl-h2 {
  display: flex; align-items: center; gap: 16px; margin: 0 0 .3em;
  font: 500 clamp(1.7rem, 3.4vw, 2.5rem)/1.1 var(--tl-serif); letter-spacing: -.035em;
}
.tl-h2::after { content: ""; flex: 1; height: 2px; background: var(--tl-line); opacity: .7; }
.tl-note { margin: 0 0 26px; color: var(--tl-muted); max-width: 52em; }

/* Comic grid and cards */
.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 34px 24px; margin: 0; padding: 0; list-style: none; }
.tl-card { display: flex; flex-direction: column; min-width: 0; }
.tl-cover {
  position: relative; display: block; width: 100%; padding: 0; margin: 0; cursor: pointer;
  border: 2px solid var(--tl-line); border-radius: 6px; overflow: hidden; background: var(--tl-paper-2); line-height: 0;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tl-cover img { width: 100%; height: auto; display: block; }
.tl-cover:hover, .tl-cover:focus-visible { transform: translate(-3px, -3px); box-shadow: 6px 6px 0 var(--tl-accent); }
.tl-cover-tag {
  position: absolute; top: 8px; left: 8px; padding: 3px 7px; border-radius: 6px;
  background: color-mix(in srgb, var(--tl-paper) 90%, transparent); color: var(--tl-ink);
  font: 700 .68rem/1.4 var(--tl-sans); letter-spacing: .08em;
}
.tl-num { margin: 12px 0 0; color: var(--tl-accent); font: 700 .72rem/1.4 var(--tl-sans); letter-spacing: .14em; text-transform: uppercase; }
.tl-card h3 { margin: 2px 0 0; font: 500 1.28rem/1.18 var(--tl-serif); letter-spacing: -.02em; }
.tl-card h3 a { color: inherit; text-decoration: none; }
.tl-card h3 a:hover { text-decoration: underline; }
.tl-meta { margin: 5px 0 0; color: var(--tl-muted); font: .8rem/1.45 var(--tl-sans); }
.tl-meta a { white-space: nowrap; }
.tl-hook { margin: 8px 0 0; font-size: .92rem; line-height: 1.45; color: var(--tl-muted);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tl-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.tl-card.tl-soon { opacity: .75; }
.tl-card.tl-soon .tl-cover { cursor: default; display: grid; place-items: center; aspect-ratio: 2 / 3; border-style: dashed;
  font: 700 .74rem/1.4 var(--tl-sans); letter-spacing: .14em; text-transform: uppercase; color: var(--tl-muted); line-height: 1.4; }
.tl-card.tl-soon .tl-cover:hover { transform: none; box-shadow: none; }

/* Buttons */
.tl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  padding: .55em 1em; border: 2px solid var(--tl-line); border-radius: 9px; background: var(--tl-card); color: var(--tl-ink);
  font: 700 .84rem/1.2 var(--tl-sans); text-decoration: none; cursor: pointer; overflow-wrap: anywhere;
  transition: transform .12s ease, box-shadow .12s ease;
}
.tl-btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--tl-line); }
.tl-btn.tl-primary { background: var(--tl-accent); border-color: var(--tl-accent); color: var(--tl-on-accent); }
.tl-btn.tl-primary:hover { box-shadow: 3px 3px 0 var(--tl-ink); }
.tl-btn.tl-small { padding: .38em .7em; font-size: .74rem; border-width: 1.5px; }
.tl-btn[aria-current="true"] { border-color: var(--tl-accent); box-shadow: inset 0 -3px 0 var(--tl-accent); }

/* Feedback box */
.tl-feedback {
  max-width: 50rem; margin: clamp(48px, 7vw, 80px) 0 0; padding: clamp(20px, 3vw, 32px);
  background: var(--tl-card); border: 2px solid var(--tl-line); border-radius: var(--tl-radius); box-shadow: 8px 8px 0 var(--tl-accent);
}
.tl-feedback h2 { margin: 0 0 .4em; font: 500 1.8rem/1.15 var(--tl-serif); letter-spacing: -.03em; }
.tl-feedback p { margin: .6em 0; }

/* Footer */
.tl-foot { margin: clamp(56px, 8vw, 96px) 0 0; border-top: 2px solid var(--tl-line); color: var(--tl-muted); font-size: .9rem; line-height: 1.55; }
.tl-foot .tl-wrap { padding-top: 22px; padding-bottom: 40px; }
.tl-foot p { margin: .35em 0; max-width: 60em; }
.tl-network {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: 0 0 18px; padding: 0 0 16px;
  border-bottom: 1px solid var(--tl-rule); font: 600 .82rem/1.4 var(--tl-sans);
}
.tl-network img { width: 40px; height: 25px; object-fit: contain; }
.tl-network a { color: var(--tl-ink); text-decoration: none; }
.tl-network a:hover { text-decoration: underline; }
.tl-network a[aria-current="page"] { color: var(--tl-accent); }

/* Dialog (cover preview) */
.tl-dialog { border: 2px solid var(--tl-line); border-radius: 14px; padding: 0; max-width: min(860px, calc(100vw - 32px));
  background: var(--tl-card); color: var(--tl-ink); box-shadow: 10px 10px 0 var(--tl-accent); }
.tl-dialog::backdrop { background: rgba(10, 8, 5, .72); backdrop-filter: blur(4px); }
.tl-dialog-body { display: grid; grid-template-columns: minmax(200px, 320px) 1fr; }
.tl-dialog-body > img { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--tl-paper-2); }
.tl-dialog-info { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.tl-dialog-info h3 { margin: 0; font: 500 1.6rem/1.15 var(--tl-serif); letter-spacing: -.02em; }
.tl-dialog-info p { margin: 0; font-size: .98rem; }
.tl-dialog-close { align-self: flex-end; }
@media (max-width: 640px) { .tl-dialog-body { grid-template-columns: 1fr; } .tl-dialog-body > img { max-height: 46vh; object-fit: contain; } }

/* Preview banner (a build that is not ready to publish) */
.tl-preview { background: var(--tl-accent); color: var(--tl-on-accent); font: 14px/1.4 var(--tl-sans); padding: 8px 20px; text-align: center; }

@media (max-width: 480px) {
  body { font-size: 17px; }
  .tl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .tl-card h3 { font-size: 1.1rem; }
}
@media (prefers-reduced-motion: reduce) { .tl-cover, .tl-btn { transition: none; } }
