/* ==========================================================================
   PAPER ARCHIVE // DESIGN SPECIFICATION
   Inspired by dukope.com style: book serif, thin rules, archival layout
   ========================================================================== */

:root {
  /* Light theme (default) */
  --surface-100: #fbfaf6;
  --ink: #151515;
  --ink-muted: #55534c;
  --rule: #151515;
  --plate: #3d4250;
  --tint: #cfe3e8;
  --signal: #b3322b;
  --chip: #5e5e5e;
  --chip-ink: #fbfaf6;

  --font-serif: 'Libre Baskerville', 'Times New Roman', Times, serif;
  --font-mono: 'Courier Prime', 'Courier New', Courier, monospace;

  --max-w: 780px;
}

/* Dark theme overrides */
[data-theme="dark"] {
  --surface-100: #181816;
  --ink: #ece9df;
  --ink-muted: #a8a598;
  --rule: #c9c5b8;
  --plate: #2b2f3b;
  --tint: #2f4d56;
  --signal: #e8766d;
  --chip: #d6d3c9;
  --chip-ink: #181816;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-100: #181816;
    --ink: #ece9df;
    --ink-muted: #a8a598;
    --rule: #c9c5b8;
    --plate: #2b2f3b;
    --tint: #2f4d56;
    --signal: #e8766d;
    --chip: #d6d3c9;
    --chip-ink: #181816;
  }
}

/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border-radius: 0; /* Hard rule: 0px except 3px for pill buttons */
}

html {
  font-size: 15px;
  background-color: var(--surface-100);
  color: var(--ink);
  font-family: var(--font-serif);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
  background-color: var(--surface-100);
  color: var(--ink);
  line-height: 24px;
}

/* Typography styles */
.display-title {
  font-family: var(--font-serif);
  font-size: 44px;
  line-height: 48px;
  font-weight: 400;
  text-align: center;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--ink);
}

.font-title,
.entry-title {
  font-family: var(--font-serif);
  font-size: 24px;
  line-height: 30px;
  font-weight: 700;
  color: var(--ink);
}

.font-subtitle,
.entry-subtitle {
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 24px;
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 8px;
}

.font-body,
.entry-body {
  font-family: var(--font-serif);
  font-size: 15px;
  line-height: 24px;
  font-weight: 400;
  color: var(--ink);
  max-width: 65ch;
  margin-bottom: 12px;
}

.font-caption {
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  color: var(--ink-muted);
}

.font-label,
.entry-platform {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  font-weight: 400;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

/* Layout container */
.page-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 16px 48px 16px;
}

@media (min-width: 640px) {
  .page-wrap {
    padding: 48px 24px 64px 24px;
  }
}

/* Page Header */
.page-header {
  margin-bottom: 32px;
  text-align: center;
}

.header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
}

.control-label {
  color: var(--ink-muted);
}

.controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.text-toggle {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  color: var(--ink);
  cursor: pointer;
  padding: 0 2px;
  text-decoration: underline;
}

.text-toggle:hover {
  color: var(--ink-muted);
}

.sep-rule {
  color: var(--ink-muted);
}

.header-tagline {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
  font-style: italic;
  margin-top: 4px;
}

/* Entries (Записи) */
.entry-item {
  border-top: 1px solid var(--rule);
  padding-top: 16px;
  margin-bottom: 32px;
}

.entry-meta-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 12px;
}

.entry-meta-right {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.entry-date {
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Entry Two-Column Grid */
.entry-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 580px) {
  .entry-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .entry-col-text {
    flex: 1 1 58%;
  }

  .entry-col-art {
    flex: 0 0 38%;
  }
}

/* Action Line (Строка действия) */
.action-line {
  font-family: var(--font-serif);
  font-size: 14px;
  line-height: 22px;
  margin-bottom: 8px;
  color: var(--ink);
}

.arrow-glyph {
  font-family: var(--font-mono);
  display: inline-block;
  margin-right: 4px;
}

/* Links (Ссылки) */
a,
.inline-link {
  color: var(--ink);
  text-decoration: underline;
  cursor: pointer;
}

a:hover,
.inline-link:hover {
  color: var(--ink-muted);
}

/* Pill-кнопка */
.button-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.pill-btn {
  background-color: var(--chip);
  color: var(--chip-ink);
  border-radius: 3px; /* Only element with radius per spec */
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 16px;
  padding: 4px 12px;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  border: none;
}

.pill-btn:hover {
  opacity: 0.85;
  text-decoration: none;
}

.stamp-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 14px;
  color: var(--signal);
  border: 1px solid var(--signal);
  padding: 1px 6px;
  border-radius: 0;
  text-transform: uppercase;
  display: inline-block;
}

/* Раскрывающийся блок (Notes ▾) */
.notes-block {
  margin-top: 8px;
  margin-bottom: 8px;
}

.notes-summary {
  font-family: var(--font-serif);
  font-size: 13px;
  line-height: 18px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: underline;
  list-style: none;
}

.notes-summary::-webkit-details-marker {
  display: none;
}

.notes-content {
  margin-top: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--rule);
  color: var(--ink-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Art Frames (Арт-рамка) */
.entry-col-art {
  display: flex;
  flex-direction: column;
  gap: 16px; /* 16px between art frames in a column */
}

.art-frame {
  background-color: var(--plate);
  border: 1px solid var(--rule);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.art-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--rule);
  image-rendering: auto;
}

/* Address card */
.address-card {
  margin-top: 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background-color: var(--surface-100);
  border: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Footer (Double rule before footer) */
.page-footer {
  margin-top: 48px; /* 48px before footer */
  text-align: center;
}

.footer-double-rule {
  display: flex;
  flex-direction: column;
  gap: 4px; /* two 1px lines separated by 4px */
  margin-bottom: 24px;
}

.rule-line {
  height: 1px;
  background-color: var(--rule);
  width: 100%;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.footer-copy {
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  color: var(--ink-muted);
}

.footer-link {
  color: var(--ink);
  text-decoration: underline;
}

.footer-link:hover {
  color: var(--ink-muted);
}

.sep {
  margin: 0 6px;
  color: var(--ink-muted);
}
