/* Brasiliana in der DDR */

:root {
  --paper: #F5F0E8;
  --paper-dark: #EBE4D8;
  --surface: #FEFCF9;
  --ink: #3A3230;
  --ink-light: #6B6058;
  --ink-faint: #9A9088;
  --ochre: #C4923A;
  --ochre-dark: #A67A2E;
  --ochre-light: #F0DFC0;
  --ochre-bg: #FBF5EA;
  --teal: #1A6B6A;
  --teal-dark: #145554;
  --teal-light: #D0E8E7;
  --terracotta: #B85C3A;
  --terracotta-light: #F5DDD2;
  --brd-blue: #2C5F8A;
  --brazil-green: #2A7D3F;
  --border: #D8D0C4;
  --border-light: #E8E2D8;
  --approved-green: #2A6E3F;
  --pending-amber: #A67A2E;
  --serif: 'Source Serif 4', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
  --measure: 72rem;
  --text-measure: 38rem;
}

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

::selection {
  background: var(--ochre-light);
  color: var(--ink);
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: var(--teal-dark);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
a:hover {
  border-bottom-color: var(--teal);
}

h1, h2, h3, h4 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.01em;
}
h1 { font-size: 2rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 2.5rem 0 0.75rem; }
h3 { font-size: 1.1rem; margin: 1.5rem 0 0.5rem; }

em { font-style: italic; }
strong { font-weight: 700; }

/* --- Geometric pattern divider --- */

.geo-divider {
  display: flex;
  height: 6px;
  gap: 3px;
  margin: 1.5rem 0;
  opacity: 0.7;
}
.geo-divider span {
  flex: 1;
  max-width: 32px;
}
.geo-divider span:nth-child(6n+1) { background: var(--ochre); }
.geo-divider span:nth-child(6n+2) { background: var(--teal); }
.geo-divider span:nth-child(6n+3) { background: var(--terracotta); }
.geo-divider span:nth-child(6n+4) { background: var(--ochre); clip-path: polygon(0 0, 100% 0, 0 100%); }
.geo-divider span:nth-child(6n+5) { background: var(--teal); clip-path: polygon(100% 0, 100% 100%, 0 100%); }
.geo-divider span:nth-child(6n+6) { background: var(--terracotta); clip-path: polygon(0 0, 100% 100%, 0 100%); }

.geo-divider-wide {
  max-width: none;
}
.geo-divider-wide span {
  max-width: 48px;
}

/* --- Layout --- */

.site-main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.5rem 2rem 4rem;
}

/* --- Header --- */

.site-header {
  background: var(--ink);
  color: var(--paper);
}

.header-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  align-items: stretch;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0;
  margin-right: auto;
  text-decoration: none;
  border-bottom: none;
}
.site-logo:hover { border-bottom: none; }
.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.6rem;
  height: 1.6rem;
  background: var(--ochre);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 700;
  font-size: 0.9rem;
}
.logo-text {
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--paper);
  letter-spacing: 0.02em;
}

.main-nav {
  display: flex;
  align-items: stretch;
}
.main-nav a {
  display: flex;
  align-items: center;
  padding: 0 0.85rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.65);
  border-bottom: none;
  border-top: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.main-nav a:hover {
  color: var(--paper);
  border-bottom: none;
}
.main-nav a.active {
  color: var(--ochre);
  border-top-color: var(--ochre);
}

.lang-switch {
  display: flex;
  align-items: center;
  gap: 1px;
  margin-left: 1rem;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.lang-switch a, .lang-switch span {
  padding: 3px 5px;
  border-bottom: none;
}
.lang-switch a:hover { border-bottom: none; }
.lang-current {
  background: var(--ochre);
  color: var(--ink);
}
.lang-switch a {
  color: rgba(245, 240, 232, 0.5);
}
.lang-switch a:hover { color: var(--paper); }

/* --- Opening / Home --- */

.opening {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  padding: 3rem 0 2rem;
  align-items: start;
}

.opening-text {
  max-width: var(--text-measure);
}
.opening-text h1 {
  font-size: 2.5rem;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}
.opening-subtitle {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-style: italic;
  color: var(--ink-light);
  margin-bottom: 1.5rem;
  line-height: 1.5;
}
.opening-intro {
  color: var(--ink-light);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}
.opening-scope {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.02em;
}
.opening-scope strong {
  color: var(--ochre-dark);
}

.opening-aside {
  position: relative;
}
.opening-map {
  height: 320px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.opening-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  margin-top: 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
}
.ostat {
  padding: 0.75rem 1rem;
  border-right: 1px solid var(--border-light);
}
.ostat:last-child { border-right: none; }
.ostat:nth-child(n+4) { border-top: 1px solid var(--border-light); }
.ostat-num {
  display: block;
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--ochre-dark);
  line-height: 1.2;
}
.ostat-label {
  display: block;
  font-family: var(--sans);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

/* --- Home sections --- */

.home-sections {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 2rem;
  padding: 2rem 0 3rem;
}

.home-section h2 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--ochre);
  display: inline-block;
}

.home-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.home-list li {
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.9rem;
  line-height: 1.4;
}
.home-list li:last-child { border-bottom: none; }
.home-list .hl-meta {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
}

/* --- Page headers --- */

.page-header {
  padding: 2rem 0 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  margin-bottom: 0.25rem;
}
.page-header::after {
  content: '';
  display: block;
  width: 4rem;
  height: 3px;
  background: var(--ochre);
  margin-top: 0.75rem;
}

/* --- Filter bar --- */

.filter-bar {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.filter-input, .filter-select {
  font-family: var(--sans);
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--ink);
}
.filter-input { flex: 1; min-width: 160px; }
.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--teal-light);
}
.filter-input::placeholder { color: var(--ink-faint); }

/* --- Data tables --- */

.data-table-wrap { overflow-x: auto; }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.data-table th {
  text-align: left;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--ink);
  white-space: nowrap;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--teal-dark); }
.data-table th.sortable::after {
  content: ' \2195';
  font-size: 0.65em;
  opacity: 0.3;
}
.data-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.data-table td.num, .data-table th.num { text-align: right; }
.data-table tbody tr:hover { background: var(--ochre-bg); }

.data-table a {
  font-weight: 500;
}

/* IDs and catalog numbers in mono */
.data-table .mono {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
}

/* --- Detail pages --- */

.detail-header {
  padding: 2rem 0 1rem;
  margin-bottom: 1.5rem;
}
.detail-header::after {
  content: '';
  display: block;
  width: 3rem;
  height: 3px;
  background: var(--teal);
  margin-top: 1rem;
}

.back-link {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
  margin-bottom: 0.75rem;
  border-bottom: none;
}
.back-link:hover { color: var(--teal-dark); border-bottom: none; }

.detail-header h1 em {
  font-family: var(--serif);
  font-weight: 400;
}

.work-header-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.work-cover {
  flex-shrink: 0;
  width: 160px;
  order: 2;
  margin-left: auto;
}
.work-cover img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--border);
  box-shadow: 2px 2px 8px rgba(58, 50, 48, 0.12);
}
.work-header-text {
  order: 1;
  flex: 1;
}
.work-header-text h1 { margin-top: 0.1rem; }
.work-year {
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink-faint);
  margin-top: 0.25rem;
}

.person-header-row {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}
.person-portrait {
  flex-shrink: 0;
  width: 140px;
  order: 2;
  margin-left: auto;
}
.person-portrait img {
  width: 100%;
  height: auto;
  display: block;
  filter: grayscale(30%);
  border: 1px solid var(--border);
}
.person-header-text {
  order: 1;
  flex: 1;
}
.person-header-text h1 { margin-top: 0.1rem; }

.detail-authors, .detail-roles {
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink-light);
  margin-top: 0.25rem;
}

.detail-meta {
  max-width: var(--text-measure);
  margin-bottom: 2rem;
}

.meta-grid {
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
}
.meta-grid dt {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}
.meta-grid dd {
  margin: 0;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.92rem;
}

.detail-section {
  max-width: var(--text-measure);
  margin-bottom: 2.5rem;
}
.detail-section h2 { margin-top: 0; }

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin-top: 0.75rem;
}
.detail-table th {
  text-align: left;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--ink);
  color: var(--ink-faint);
}
.detail-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border-light);
}
.detail-table tbody tr:hover { background: var(--ochre-bg); }

.translation-card {
  background: var(--surface);
  border-left: 3px solid var(--teal);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.translation-card h3 {
  margin-top: 0;
  font-family: var(--sans);
}

.trl-year {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.trl-indirect {
  font-size: 0.82rem;
  color: var(--terracotta);
  font-style: italic;
  font-family: var(--serif);
}
.trl-translators {
  font-size: 0.88rem;
}

.contribution-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.contribution-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 0.92rem;
}

.contents-list li { padding: 0.3rem 0; font-size: 0.92rem; }

/* --- Tags and badges --- */

.tag, .role-tag {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  background: var(--paper-dark);
  color: var(--ink-light);
}

.status-badge {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
}
.status-badge.approved { background: #e0efe3; color: var(--approved-green); }
.status-badge.pending { background: var(--ochre-light); color: var(--pending-amber); }
.status-badge.reviewed { background: var(--teal-light); color: var(--teal-dark); }

.status-summary {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.absent-tag {
  background: var(--terracotta-light);
  color: var(--terracotta);
}
.absent-notice {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--terracotta);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0.25rem 0 0;
}

.country-tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 5px;
  letter-spacing: 0.04em;
}
.country-tag.ddr { background: var(--terracotta-light); color: var(--terracotta); }
.country-tag.brd { background: #dce8f2; color: var(--brd-blue); }

/* --- Map --- */

.map-container { margin-bottom: 2rem; }

#main-map {
  border: 1px solid var(--border);
  background: var(--surface);
}

.map-legend {
  display: flex;
  gap: 1.5rem;
  padding: 0.75rem 0;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-light);
}
.legend-item { display: flex; align-items: center; gap: 0.4rem; }
.legend-dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--ink);
}
.legend-dot.ddr { background: var(--terracotta); }
.legend-dot.brd { background: var(--brd-blue); }
.legend-dot.other { background: var(--brazil-green); }

/* --- Timeline --- */

.timeline-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.timeline-chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.timeline-list { margin-bottom: 2rem; }

.tl-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr auto auto auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 0.88rem;
}
.tl-year {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--ochre-dark);
}
.tl-title a {
  font-weight: 500;
}
.tl-author {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-light);
  font-size: 0.82rem;
}
.tl-pub {
  font-family: var(--sans);
  color: var(--ink-faint);
  font-size: 0.75rem;
}
.tl-tag {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 700;
  padding: 1px 4px;
  letter-spacing: 0.04em;
}
.tl-tag.ddr { background: var(--terracotta-light); color: var(--terracotta); }
.tl-tag.brd { background: #dce8f2; color: var(--brd-blue); }

/* --- Methods page --- */

.methods-content {
  max-width: var(--text-measure);
}
.methods-section:first-child p:first-of-type::first-letter {
  font-family: var(--sans);
  font-size: 3.2rem;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  padding-right: 0.15rem;
  padding-top: 0.1rem;
  color: var(--ochre-dark);
}

.methods-section {
  margin-bottom: 2.5rem;
}
.methods-section h2 {
  margin-top: 0;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid var(--teal);
  display: inline-block;
}
.methods-section p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}
.methods-section ul {
  padding-left: 1.25rem;
  margin-bottom: 0.75rem;
}
.methods-section li {
  margin-bottom: 0.4rem;
  line-height: 1.6;
}

.cite-block {
  font-family: var(--serif);
  font-size: 0.92rem;
  line-height: 1.6;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0;
  border-left: 3px solid var(--ochre);
  background: var(--ochre-bg);
  color: var(--ink);
}

.methods-table {
  border-collapse: collapse;
  font-size: 0.88rem;
}
.methods-table th, .methods-table td {
  text-align: left;
  padding: 0.35rem 1.5rem 0.35rem 0;
  border-bottom: 1px solid var(--border-light);
}
.methods-table th {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.methods-table td:last-child {
  font-family: var(--mono);
  font-size: 0.85rem;
}

/* --- Footer --- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 2rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.footer-inner {
  max-width: var(--measure);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.footer-inner p { margin: 0; }
.footer-inner a { font-weight: 500; }

/* --- Responsive --- */

@media (max-width: 900px) {
  .opening { grid-template-columns: 1fr; }
  .opening-aside { order: -1; }
  .home-sections { grid-template-columns: 1fr; }
  .tl-item { grid-template-columns: 3rem 1fr; gap: 0.4rem; }
  .tl-author, .tl-pub, .tl-tag { grid-column: 2; }
}

@media (max-width: 600px) {
  .header-inner { flex-wrap: wrap; }
  .main-nav { width: 100%; overflow-x: auto; }
  .site-main { padding: 1rem 1rem 3rem; }
  .opening-text h1 { font-size: 1.75rem; }
  .opening-stats { grid-template-columns: repeat(2, 1fr); }
  .meta-grid { grid-template-columns: 1fr; }
  .meta-grid dt { border-bottom: none; padding-bottom: 0; }
  .footer-inner { flex-direction: column; }
  .work-header-row { flex-direction: column; }
  .work-cover { width: 120px; }
  .person-header-row { flex-direction: column; }
  .person-portrait { width: 100px; }
}

/* --- Print --- */

@media print {
  .site-header, .site-footer, .filter-bar, .lang-switch,
  .main-nav, .map-container, .timeline-chart-wrap,
  .timeline-controls, .back-link { display: none; }

  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
  }
  .site-main { max-width: none; padding: 0; }
  .data-table { font-size: 9pt; }
  .data-table th { border-bottom: 1pt solid #000; }
  .data-table td { border-bottom: 0.5pt solid #ccc; }
  a { color: #000; border-bottom: none; }
  a[href]::after { content: none; }
  .translation-card { border-left: 2pt solid #999; }
  .geo-divider { display: none; }
  h1, h2, h3 { page-break-after: avoid; }
  .detail-section, .methods-section { page-break-inside: avoid; }
}
