/* ============================================================
   Franz Kafka Stories — Dark Atmospheric Theme
   ============================================================ */

:root {
  --bg:           #f4efe6;
  --bg-header:    #1c1916;
  --bg-surface:   #ece7dc;
  --text:         #2c2820;
  --text-muted:   #7a6e5e;
  --text-dim:     #b0a898;
  --accent:       #8b2030;
  --accent-hover: #b02840;
  --border:       #ddd8ce;
  --border-mid:   #c8c2b6;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: 'Lora', Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
}

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Header ────────────────────────────────────────────── */

header {
  background: var(--bg-header);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

.header-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  min-height: 3.5rem;
}

.site-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 700;
  font-style: italic;
  color: #d4c9b8;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  flex-shrink: 0;
}

.site-title:hover {
  color: #fff;
}

nav {
  display: flex;
  gap: 0.1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

nav a {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.72rem;
  color: #8a8078;
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.65rem;
  border-radius: 2px;
  transition: color 0.2s, background 0.2s;
}

nav a:hover,
nav a[aria-current="page"] {
  color: #d4c9b8;
  background: #2a2520;
}

/* ── Main ───────────────────────────────────────────────── */

main {
  flex: 1;
  padding: 3.5rem 1.5rem 6rem;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.content {
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ── Typography ─────────────────────────────────────────── */

h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 0.5rem;
}

h2 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-mid);
}

h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--text-muted);
  margin: 2.5rem 0 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

p {
  margin-bottom: 1.2em;
  overflow-wrap: break-word;
}

a {
  color: var(--accent-hover);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

blockquote {
  font-style: italic;
  border-left: 2px solid var(--accent);
  margin: 1.75rem 0;
  padding: 0.25rem 1.5rem;
  color: var(--text-muted);
}

blockquote p {
  margin: 0;
}

ul, ol {
  padding-left: 1.5rem;
  margin-bottom: 1.2em;
}

li {
  margin-bottom: 0.4em;
}

b, strong {
  font-weight: 700;
  color: var(--text);
}

/* ── Home page ──────────────────────────────────────────── */

.home-intro p {
  font-size: 1.05rem;
  line-height: 1.9;
}

.home-intro ol {
  margin: 0.5rem 0 1rem;
}

.home-intro a {
  color: var(--accent-hover);
}

/* ── Story list ─────────────────────────────────────────── */

.story-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--border);
}

.story-list li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}

.story-list a {
  display: block;
  padding: 0.9rem 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.15s, padding-left 0.2s;
}

.story-list a:hover {
  color: var(--accent-hover);
  padding-left: 0.75rem;
  text-decoration: none;
}

/* ── Story page ─────────────────────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.72rem;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  transition: color 0.2s;
}

.back-link::before {
  content: '←';
  font-style: normal;
}

.back-link:hover {
  color: var(--text);
  text-decoration: none;
}

.story-meta {
  margin-bottom: 3rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--border-mid);
}

.story-meta h1 {
  margin-bottom: 0.6rem;
}

.story-meta .author {
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
}

.story-meta .translator {
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.82rem;
  margin: 0;
}

.story-body p {
  text-indent: 1.75em;
  margin-bottom: 0;
  line-height: 1.95;
}

.story-body p + p {
  margin-top: 0.15em;
}

.story-body p:first-child {
  text-indent: 0;
}

/* ── Bibliography ───────────────────────────────────────── */

.bib-section {
  margin: 0 0 2rem;
}

.bib-section p {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.bib-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.bib-table th {
  text-align: left;
  padding: 0.55rem 0.9rem;
  background: var(--bg-surface);
  color: var(--text-muted);
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  border-bottom: 1px solid var(--border-mid);
}

.bib-table td {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

.bib-table tr:hover td {
  background: var(--bg-surface);
}

.bib-table a {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin-right: 0.35rem;
}

.bib-table a:hover {
  color: var(--accent-hover);
  text-decoration: none;
}

.bib-table .downloads {
  white-space: nowrap;
}

/* ── Translations page ──────────────────────────────────── */

.translations-body p {
  font-size: 1rem;
  line-height: 1.9;
}

.translations-body ul {
  margin: 0.5rem 0 1rem;
}

.translations-body .attribution {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

/* ── Footer ─────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 620px) {
  html { font-size: 16px; }

  .header-inner {
    flex-wrap: wrap;
    padding: 0.7rem 1rem 0.5rem;
    gap: 0.5rem 1rem;
    min-height: unset;
  }

  .site-title {
    font-size: 0.95rem;
  }

  nav {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0;
  }

  nav a {
    padding: 0.2rem 0.45rem;
    font-size: 0.62rem;
    letter-spacing: 0.05em;
  }

  h1 { font-size: 1.7rem; }
  h2 { font-size: 1.25rem; }

  main { padding: 2rem 1rem 4rem; }

  .bib-table thead { display: none; }

  .bib-table tr {
    display: block;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-mid);
  }

  .bib-table td {
    display: block;
    border: none;
    padding: 0.1rem 0;
  }

  .bib-table td:first-child {
    font-weight: 500;
  }

  .bib-table td.downloads {
    white-space: normal;
  }
}
