@import url("https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap");

/* =========================================================================
   Asymptote — wspólny arkusz stylów
   (strony statyczne numerów + dynamiczne części serwisu)
   ========================================================================= */

:root {
  --bg: #f6f2ea;
  --bg-deep: #efe8db;
  --paper: #fffdf8;
  --paper-soft: rgba(255, 253, 248, 0.78);
  --text: #1b1714;
  --text-soft: rgba(27, 23, 20, 0.78);
  --muted: rgba(27, 23, 20, 0.56);
  --line: rgba(60, 48, 34, 0.14);
  --line-strong: rgba(60, 48, 34, 0.26);
  --accent: #8a2a33;
  --accent-strong: #5f1a22;
  --accent-soft: rgba(138, 42, 51, 0.08);
  --gold: #a8844d;
  --ok: #2f6b46;
  --warn: #9a6a12;
  --err: #a12a2a;
  --shadow: 0 1px 2px rgba(45, 36, 24, 0.05), 0 12px 40px rgba(45, 36, 24, 0.07);
  --shadow-lift: 0 2px 4px rgba(45, 36, 24, 0.06), 0 22px 60px rgba(45, 36, 24, 0.13);
  --serif: "EB Garamond", Garamond, Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --radius: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f;
    --bg-deep: #1c1814;
    --paper: #1f1b17;
    --paper-soft: rgba(36, 31, 26, 0.82);
    --text: #f1eadf;
    --text-soft: rgba(241, 234, 223, 0.82);
    --muted: rgba(241, 234, 223, 0.55);
    --line: rgba(241, 234, 223, 0.12);
    --line-strong: rgba(241, 234, 223, 0.24);
    --accent: #e08a8f;
    --accent-strong: #f3b2b5;
    --accent-soft: rgba(224, 138, 143, 0.1);
    --gold: #cfae78;
    --ok: #7cc79a;
    --warn: #e0b45c;
    --err: #ef8a8a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 40px rgba(0, 0, 0, 0.25);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 22px 60px rgba(0, 0, 0, 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  background:
    radial-gradient(1200px 520px at 85% -120px, var(--accent-soft), transparent 70%),
    linear-gradient(180deg, var(--paper) 0, var(--bg) 460px);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body > main { flex: 1 0 auto; }

::selection { background: var(--accent); color: var(--paper); }

.wrap { width: min(1040px, calc(100% - 32px)); margin: 0 auto; }
.wrap.narrow { width: min(720px, calc(100% - 32px)); }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ----- Pasek górny ----------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
  padding: 6px 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.01em;
}
.brand:hover { color: var(--text); text-decoration: none; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 18px;
  font-size: 14px;
  font-weight: 500;
}
.nav a { color: var(--text-soft); }
.nav a:hover, .nav a.active { color: var(--accent); text-decoration: none; }
.nav form { margin: 0; display: inline; }
.nav .pill {
  padding: 6px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
}
.nav .pill:hover { border-color: var(--accent); }
.linkish {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--text-soft);
  cursor: pointer;
}
.linkish:hover { color: var(--accent); }

/* ----- Nagłówki stron ---------------------------------------------------- */
.hero { padding: 88px 0 56px; position: relative; }
.hero.small { padding: 64px 0 44px; }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 40px;
  align-items: center;
}
.hero-art { color: var(--accent); opacity: 0.9; }
.hero-art svg { width: 100%; height: auto; display: block; }
.hero-art .curve {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 2.6s cubic-bezier(.4, 0, .2, 1) 0.2s forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  .hero-art .curve { animation: none; stroke-dashoffset: 0; }
  .issue, .entry, .card, .btn { transition: none !important; }
}

.kicker {
  margin: 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.kicker a { color: inherit; }
.kicker a:hover { color: var(--accent); }

h1 {
  max-width: 900px;
  font-family: var(--serif);
  font-size: clamp(46px, 7.2vw, 104px);
  font-weight: 500;
  line-height: 0.98;
  margin: 14px 0 18px;
  letter-spacing: -0.01em;
}
.small h1 { font-size: clamp(40px, 6.4vw, 76px); }
.article-hero h1 { font-size: clamp(34px, 5vw, 62px); line-height: 1.06; }

h2 {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: clamp(26px, 3.2vw, 34px);
  font-weight: 500;
  line-height: 1.2;
}
h3 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.25;
}

.lead {
  color: var(--text-soft);
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 2.2vw, 23px);
  max-width: 680px;
  margin: 0 0 6px;
}
.article-meta { max-width: 740px; color: var(--muted); font-size: 15px; }

.rule {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--gold);
  margin: 26px 0 0;
}
.rule::before, .rule::after { content: ""; height: 1px; background: currentColor; opacity: 0.45; flex: 1; }
.rule::before { flex: 0 0 48px; }

/* ----- Sekcje -------------------------------------------------------------- */
.grid, .block { border-top: 1px solid var(--line); }
.grid {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 40px;
  padding: 60px 0;
}
.block { padding: 52px 0; }
.label {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 6px;
}
.label::after {
  content: "";
  display: block;
  width: 28px;
  height: 1px;
  margin-top: 12px;
  background: var(--gold);
}
.content { font-size: 18px; color: var(--text-soft); max-width: 760px; }
.content p { margin: 0 0 16px; }
.muted { color: var(--muted); }
.small-text { font-size: 14px; }

.manifest p:first-child::first-letter {
  float: left;
  font-family: var(--serif);
  font-size: 4.2em;
  line-height: 0.82;
  padding: 6px 10px 0 0;
  color: var(--accent);
}
.manifest .closing {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--text);
}

/* ----- Numery ------------------------------------------------------------ */
.issues { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.issue, .entry, .card { background: var(--paper-soft); box-shadow: var(--shadow); }
.issue {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  min-height: 150px;
  padding: 22px 22px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.issue::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s ease;
}
.issue:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: var(--shadow-lift); text-decoration: none; color: var(--text); }
.issue:hover::after { transform: scaleX(1); }
.issue.disabled, .issue.upcoming { opacity: 0.72; border-style: dashed; box-shadow: none; }
.issue.disabled { pointer-events: none; }
.num { font-family: var(--serif); font-size: 52px; font-weight: 500; line-height: 1; letter-spacing: -0.02em; }
.num small { font-size: 18px; color: var(--muted); margin-left: 4px; letter-spacing: 0; }
.date { color: var(--muted); font-size: 14px; }
.issue .tag { position: absolute; top: 16px; right: 16px; }

.tag, .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: var(--paper);
  white-space: nowrap;
}
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.badge.err { color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, transparent); }
.badge.accent, .tag.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }

/* ----- Wpisy (artykuły) ---------------------------------------------------- */
.entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.entry:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.title { color: var(--text); font-family: var(--serif); font-size: 23px; line-height: 1.3; }
span.title { cursor: default; }
a.title:hover { color: var(--accent); text-decoration: none; }
.role, .author { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; font-weight: 600; }
.links { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.links a, .pdf-link {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-soft);
  background: var(--paper);
}
.links a:hover, .pdf-link:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.entry a.pdf-link { align-self: center; flex: 0 0 auto; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.section-head .count { color: var(--muted); font-size: 14px; }

/* ----- Redakcja ------------------------------------------------------------ */
.team { display: grid; gap: 0; margin-bottom: 20px; }
.person { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.name { font-weight: 500; font-family: var(--serif); font-size: 21px; color: var(--text); }

/* ----- Przyciski ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper);
  color: var(--text);
  font: 600 14px/1.2 var(--sans);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease, background .2s ease;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn.primary { color: #1b1714; }
  :root:not([data-theme="light"]) .btn.primary:hover { color: #1b1714; }
}
.btn.small { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.btn.danger { color: var(--err); }
.btn.danger:hover { border-color: var(--err); color: var(--err); }
.download-btn { margin-top: 18px; }
.action-row { display: flex; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.citation-box p { overflow-wrap: anywhere; }

/* ----- Teksty literackie ---------------------------------------------------- */
.poem, .prose { font-family: var(--serif); font-size: 21px; line-height: 1.6; color: var(--text); }
.poem p { margin: 0 0 1.3em; }
.prose p { margin: 0 0 1em; text-indent: 1.4em; }
.prose p:first-child { text-indent: 0; }

.pdf-frame {
  display: block;
  width: 100%;
  height: min(82vh, 1100px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
@media (max-width: 720px) { .pdf-frame { height: 70vh; } }

/* ----- Karty, formularze ---------------------------------------------------- */
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.cards > .card:not(form) {
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.cards > .card:not(form):hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-lift);
}
.card h3 { margin-top: 0; }
.card p:last-child { margin-bottom: 0; }
.card.feature {
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 60%),
    var(--paper-soft);
}

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; }
.field label, .field .label-text { font-size: 14px; font-weight: 600; color: var(--text); }
.field .hint { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="file"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  font: 400 16px/1.45 var(--sans);
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="file"] { padding: 9px 10px; font-size: 14px; }
textarea { min-height: 140px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--text-soft); }
.check input { margin-top: 4px; accent-color: var(--accent); }
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; overflow: hidden; }
.form-card { max-width: 520px; }
.inline-form { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select { width: auto; padding: 6px 10px; font-size: 14px; }

.radio-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.radio-cards label {
  display: block;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--paper);
  cursor: pointer;
  font-weight: 400;
}
.radio-cards input { accent-color: var(--accent); margin-right: 8px; }
.radio-cards label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.radio-cards strong { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.radio-cards span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }

/* ----- Komunikaty ----------------------------------------------------------- */
.flashes { display: grid; gap: 10px; margin: 24px auto 0; }
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  font-size: 15px;
  border-left: 4px solid var(--gold);
}
.flash.success { border-left-color: var(--ok); }
.flash.error { border-left-color: var(--err); }
.flash.info { border-left-color: var(--accent); }

/* ----- Tabele ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-soft); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 600; background: var(--bg-deep); }
tr:last-child td { border-bottom: 0; }
td .title { font-size: 17px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs a { padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--text-soft); border: 1px solid var(--line); }
.tabs a.active, .tabs a:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

.stat-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 8px; }
.stat { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper-soft); }
.stat b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 500; line-height: 1.1; color: var(--text); }
.stat span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); }

/* ----- Podgląd LaTeX ---------------------------------------------------------- */
.tex-view {
  margin: 0;
  max-height: 75vh;
  overflow: auto;
  padding: 18px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  font: 13.5px/1.6 var(--mono);
  counter-reset: line;
  tab-size: 2;
}
.tex-view code { display: block; }
.tex-view .ln { display: block; padding: 0 18px 0 0; white-space: pre-wrap; word-break: break-word; }
.tex-view .ln::before {
  counter-increment: line;
  content: counter(line);
  display: inline-block;
  width: 3.6em;
  margin-right: 14px;
  padding-right: 10px;
  text-align: right;
  color: var(--muted);
  border-right: 1px solid var(--line);
  user-select: none;
}
.tex-view .ln:hover { background: var(--accent-soft); }

/* ----- Stopka -------------------------------------------------------------- */
.footer {
  padding: 56px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 14px;
  text-align: center;
  margin-top: 40px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
  text-align: left;
}
.footer h4 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text); }
.footer p { margin: 0 0 8px; }
.footer .brand { font-size: 26px; margin-bottom: 8px; }
.footer-bottom { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; font-size: 13px; }

.empty { padding: 28px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ----- Responsywność ---------------------------------------------------------- */
@media (max-width: 820px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { max-width: 420px; }
  .footer-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hero { padding: 48px 0 32px; }
  .hero.small { padding: 40px 0 28px; }
  .grid { grid-template-columns: 1fr; gap: 16px; padding: 40px 0; }
  .block { padding: 40px 0; }
  .entry, .person { align-items: flex-start; flex-direction: column; }
  .links { justify-content: flex-start; }
  .entry a.pdf-link { align-self: flex-start; }
  .nav { gap: 4px 14px; font-size: 13px; }
  .poem, .prose { font-size: 19px; }
  .num { font-size: 44px; }
}

@media print {
  .topbar, .footer, .btn, .links { display: none !important; }
  body { background: #fff; color: #000; }
}
