/* Просто так — тихий веб-читач газетного архіву (v2) */

:root {
  --paper:        #efe4c5;
  --paper-warm:   #ebddb4;        /* onionskin: foreword + content highlights */
  --paper-cool:   #e6e2cb;        /* form-paper grey-cream: controls + colophon */
  --paper-soft:   #e7dbb6;
  --paper-edge:   #ddd0a9;
  --ink:          #2a2218;
  --ink-soft:     #5d503e;
  --ink-faint:    #968873;
  --ink-ghost:    #c0b599;
  --rule:         rgba(42, 34, 24, 0.16);
  --rule-soft:    rgba(42, 34, 24, 0.08);
  --rule-strong:  rgba(42, 34, 24, 0.32);
  --carbon:       #485a68;
  --carbon-soft:  rgba(72, 90, 104, 0.55);
  --stamp:        #8a4a36;
  --mark-bg:      #e8c66f;
  --mark-ink:     #2a2218;

  --serif:      "Iowan Old Style", "Charter", "Source Serif Pro", "Cambria", Georgia, "Times New Roman", serif;
  --sans:       ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --typewriter: "Courier New", "Courier", "Liberation Mono", monospace;
  --mono:       ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;

  --gutter: 110px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* paper tone — soft uneven warmth */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(ellipse at 25% 15%, rgba(125, 90, 40, 0.06), transparent 55%),
    radial-gradient(ellipse at 80% 70%, rgba(125, 90, 40, 0.05), transparent 60%),
    radial-gradient(ellipse at 60% 100%, rgba(80, 60, 30, 0.04), transparent 55%);
  z-index: 0;
}

.page {
  position: relative;
  z-index: 1;
  max-width: 880px;
  margin: 0 auto;
  padding: 8vh 32px 16vh 32px;
}

/* ---------- masthead ---------- */

.masthead {
  margin-bottom: 4vh;
  padding-left: var(--gutter);
}

/* ---------- masthead stats strip ---------- */

.stats {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
}
.stat { white-space: nowrap; }
.stat__num {
  color: var(--ink-soft);
  font-weight: 700;
  display: inline-block;
  min-width: 1ch;
  transition: color 700ms ease, transform 300ms ease;
}
.stat__num.is-bumped {
  color: var(--carbon);
  transform: translateY(-1px);
}
.stat__dot { color: var(--ink-ghost); opacity: 0.7; }

/* cycling year — for the eyebrow */
.year-cycle {
  display: inline-block;
  min-width: 1.5em;
  text-align: center;
  transition: opacity 220ms ease, transform 220ms ease;
}
.year-cycle.is-flipping {
  opacity: 0;
  transform: translateY(-3px);
}

.eyebrow {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--carbon);
  margin: 0 0 28px;
}

.title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(56px, 9vw, 96px);
  letter-spacing: -0.025em;
  line-height: 0.98;
  margin: 0 0 22px;
  color: var(--ink);
}

.subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0 0 44px;
  max-width: 38ch;
}

/* foreword — the "why this exists" block — лежит на тёплой бумаге */

.foreword {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--ink-soft);
  max-width: 46ch;
  padding: 18px 22px 18px 22px;
  background: var(--paper-warm);
  border-left: 2px solid var(--rule);
  position: relative;
}

.foreword p {
  margin: 0 0 14px;
}

.foreword p:last-child { margin-bottom: 0; }

/* ---------- hero clipping ---------- */

.hero {
  margin: 18px auto 16px;
  max-width: 720px;
  padding: 32px 48px 28px;
  background: #f4ecce;
  border-top: 3px double var(--ink-soft);
  border-bottom: 1px solid var(--rule-strong);
  position: relative;
  transition: opacity 320ms ease;
}
.hero.is-fading { opacity: 0; }

.hero-clip__dateline {
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 16px;
  text-align: center;
}

.hero-clip__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.2;
  text-align: center;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.hero-clip__rule {
  display: block;
  width: 32px;
  height: 1px;
  background: var(--ink-soft);
  margin: 16px auto 18px;
  border: none;
}

.hero-clip__body {
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink);
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.hero-clip__body p {
  margin: 0 0 0.85em;
  text-indent: 1.3em;
}

.hero-clip__body p:first-child {
  text-indent: 0;
}

.hero-clip__body p:first-child::first-letter {
  font-family: var(--serif);
  font-size: 2.8em;
  float: left;
  line-height: 0.85;
  padding: 5px 8px 0 0;
  color: var(--ink);
}

.hero-clip__source {
  margin: 20px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
}

.hero-clip--dream .hero-clip__source { font-style: italic; text-transform: none; letter-spacing: 0; }

.hero-clip__empty-body {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  text-align: center;
  margin: 0;
}
.hero-clip__empty-body em { color: var(--ink); font-style: italic; }

/* hero-meta — caption block + rotate control under hero */

.hero-meta {
  max-width: 720px;
  margin: 0 auto 4vh;
  text-align: center;
}

.hero-rotate {
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 6px 14px;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
  margin-bottom: 14px;
}
.hero-rotate:hover {
  background: rgba(255,255,255,0.3);
  border-color: var(--ink-soft);
  color: var(--ink);
}

.hero-caption {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  text-wrap: pretty;
}

.foreword__sign {
  font-style: normal;
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 22px !important;
}

/* form-section label, sitting on the top edge of a panel frame */
.controls > .panel-label,
.colophon > .panel-label,
.contribute > .panel-label,
.panel-label {
  position: absolute;
  top: -9px;
  left: 22px;
  margin: 0;
  background: var(--paper);
  padding: 0 12px;
  font-family: var(--typewriter);
  font-size: 11px;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 700;
}

/* ---------- controls ---------- */

.controls {
  margin-bottom: 9vh;
  padding: 32px 28px 22px;
  background: var(--paper-cool);
  border: 1px solid var(--rule);
  border-radius: 2px;
  margin-left: var(--gutter);
  position: relative;
}

.search {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: stretch;
}

.search__field,
.search__year {
  display: contents;
}

#q {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.2;
  width: 100%;
  padding: 15px 18px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  outline: none;
  transition: border-color 200ms ease, background-color 200ms ease;
}

#q::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

#q:focus {
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.22);
}

#year {
  font-family: var(--typewriter);
  font-size: 13px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding: 0 30px 0 14px;
  background:
    transparent
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235d503e' stroke-width='1.2' stroke-linecap='round'/></svg>")
    no-repeat right 12px center;
  border: 1px solid var(--rule);
  border-radius: 2px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 200ms ease, background-color 200ms ease;
}

#year:hover { border-color: var(--ink-soft); background-color: rgba(255,255,255,0.18); }
#year:focus { outline: none; border-color: var(--ink-soft); }

.search__random {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0 22px;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease;
  white-space: nowrap;
}

.search__random:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: var(--ink-soft);
}

.search__random:active {
  background: var(--paper-edge);
}

/* «наснити» — explicit dream-generation trigger */
.search__dream {
  font-family: var(--typewriter);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 0 18px;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease;
  white-space: nowrap;
}
.search__dream:hover { background: #1d1812; border-color: #1d1812; }
.search__dream:disabled {
  background: var(--paper-edge);
  color: var(--ink-faint);
  border-color: var(--paper-edge);
  cursor: not-allowed;
}

/* «мої кутики» — скромна, тонша за «просто так» */
.search__bookmarks {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  padding: 0 16px;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease;
  white-space: nowrap;
}
.search__bookmarks:hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- filter toggle ---------- */

.filter {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 6px auto 28px;
  border: 1px solid var(--rule);
  border-radius: 2px;
  background: var(--paper-cool);
  padding: 3px;
  width: max-content;
}
.filter__opt {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  padding: 9px 22px;
  cursor: pointer;
  border-radius: 1px;
  transition: background-color 200ms ease, color 200ms ease;
}
.filter__opt:hover { background: rgba(255,255,255,0.4); color: var(--ink); }
.filter__opt.is-active {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- results ---------- */

.results {
  display: flex;
  flex-direction: column;
}

/* empty state */
.empty {
  padding-left: var(--gutter);
}

.empty__hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-soft);
  margin: 0 0 28px;
}

.empty__hint em { font-style: italic; color: var(--ink); }

.empty__stats {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--carbon);
  margin: 0;
}

.empty__stats strong {
  font-weight: 400;
  color: var(--ink-soft);
}

/* ---------- dream clip styling ---------- */

.clip.is-dream .clip__year {
  font-style: italic;
  color: var(--ink-ghost);
  opacity: 0.85;
}

.clip.is-dream .clip__year::after {
  content: "⌒";
  display: block;
  font-size: 0.7em;
  letter-spacing: 0.2em;
  margin-top: 6px;
  color: var(--ink-faint);
  opacity: 1;
  font-style: normal;
}

.clip.is-dream .clip__title {
  color: var(--ink);
}

.clip.is-dream .clip__source {
  font-style: italic;
  text-transform: none;
  letter-spacing: 0;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-faint);
}

.dream-nudge {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 14px 0 0;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.22);
  border-left: 2px solid var(--rule);
  max-width: 58ch;
}

.dream-nudge .inline-link {
  color: var(--ink);
}

/* dream loading state */
.dreaming {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  padding: 18px 0 0 var(--gutter);
  margin: 0;
}
.dreaming::after {
  content: "·";
  display: inline-block;
  margin-left: 2px;
  animation: dreaming 1.2s infinite;
}
@keyframes dreaming {
  0% { content: "·"; }
  33% { content: "··"; }
  66% { content: "···"; }
}

/* count line above results — оформляется как form-section heading */

.count {
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--carbon);
  margin: 0 0 32px;
  padding-left: var(--gutter);
  display: flex;
  align-items: center;
  gap: 14px;
}

.count::before,
.count::after {
  content: "";
  flex: 0 0 auto;
  height: 1px;
  background: var(--ink-faint);
  opacity: 0.45;
}

.count::before { width: 18px; }
.count::after { flex: 1; }

/* ---------- clip card ---------- */

.results {
  position: relative;
}

/* «корешок» — vertical rule отделяет маргиналии (год/каталог) от контента */
.results::before {
  content: "";
  position: absolute;
  left: calc(var(--gutter) - 18px);
  top: 56px;
  bottom: 0;
  width: 1px;
  background: var(--ink-faint);
  opacity: 0.35;
  pointer-events: none;
}
.results:not(:has(.clip))::before { display: none; }

.clip {
  position: relative;
  padding: 56px 0 36px var(--gutter);
  cursor: pointer;
  animation: clip-in 320ms ease both;
}

/* asterism divider between cards */
.clip + .clip::before {
  content: "⁂";
  position: absolute;
  top: 0;
  left: var(--gutter);
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink-ghost);
  letter-spacing: 0.4em;
  line-height: 1;
}

/* first clip — no top divider, less top padding */
.clip:first-of-type {
  padding-top: 8px;
}

/* year marginalia — large pale numeral in left gutter */
.clip__year {
  position: absolute;
  left: 0;
  top: 56px;
  width: calc(var(--gutter) - 28px);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 34px;
  line-height: 1;
  color: var(--ink-ghost);
  letter-spacing: -0.01em;
  user-select: none;
}

.clip:first-of-type .clip__year { top: 8px; }

/* catalogue number under the year — typewriter, library-card feel */
.clip__catalog {
  position: absolute;
  left: 0;
  top: 100px;
  width: calc(var(--gutter) - 28px);
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--carbon);
  user-select: none;
}
.clip:first-of-type .clip__catalog { top: 52px; }
.clip.is-dream .clip__catalog { font-style: italic; color: var(--ink-faint); }

.clip__meta {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin: 0 0 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.clip__meta .dot {
  color: var(--ink-ghost);
  opacity: 1;
}

.clip__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.25;
  margin: 0 0 12px;
  color: var(--ink);
  letter-spacing: -0.01em;
  max-width: 28ch;
}

.clip__snippet {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 0;
  max-width: 58ch;
}

.clip__snippet mark,
.clip__body mark {
  background: var(--mark-bg);
  color: var(--mark-ink);
  padding: 0 3px;
  margin: 0 -2px;
  border-radius: 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* expanded body */

.clip__body {
  margin: 20px 0 4px;
  font-family: var(--serif);
  font-size: 17.5px;
  line-height: 1.78;
  color: var(--ink);
  max-width: 58ch;
  overflow: hidden;
  animation: body-in 420ms ease both;
}

.clip__body p {
  margin: 0 0 1em;
}

.clip__body p:first-child::first-letter {
  font-family: var(--serif);
  font-size: 2.6em;
  float: left;
  line-height: 0.88;
  padding: 6px 10px 0 0;
  font-weight: 400;
  color: var(--ink);
}

.clip__source {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-style: normal;
  margin: 18px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  max-width: 58ch;
}

/* received-stamp block (user contributions) — like a library "received" stamp */
.received-stamp {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  column-gap: 8px;
  row-gap: 2px;
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stamp);
  padding: 6px 12px;
  border: 1.5px solid var(--stamp);
  border-radius: 2px;
  opacity: 0.9;
}
.received-stamp > span { white-space: nowrap; }
.received-stamp__label {
  font-weight: 700;
  letter-spacing: 0.2em;
}
.received-stamp__sep {
  color: var(--stamp);
  opacity: 0.5;
}

/* postal-style year boxes inside the contribute form */
.year-boxes {
  display: inline-grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  width: 140px;
}
.year-boxes input {
  font-family: var(--typewriter);
  font-size: 18px;
  text-align: center;
  padding: 8px 0;
  background: rgba(255,255,255,0.4);
  border: 1px solid var(--rule);
  border-radius: 2px;
  color: var(--ink);
  caret-color: var(--ink);
  outline: none;
  transition: border-color 200ms ease, background-color 200ms ease;
  -moz-appearance: textfield;
}
.year-boxes input::-webkit-outer-spin-button,
.year-boxes input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.year-boxes input:focus {
  border-color: var(--ink-soft);
  background: rgba(255,255,255,0.7);
}

/* perforated tear-line above colophon */
.tear-line {
  height: 1px;
  margin: 14vh 0 0 var(--gutter);
  padding: 0;
  border: none;
  background-image: linear-gradient(to right, var(--ink-faint) 60%, transparent 0%);
  background-position: top;
  background-size: 8px 1px;
  background-repeat: repeat-x;
  opacity: 0.55;
}

.clip__close,
.clip__bookmark,
.clip__print,
.clip__link {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.clip__close:hover,
.clip__bookmark:hover,
.clip__print:hover,
.clip__link:hover { color: var(--ink-soft); }

/* dog-eared corner — pure CSS, no images. Shown when reader bookmarks
   the clip. Sits in the upper-right of the card, like a folded page tip. */
.clip.is-bookmarked::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 28px;
  background:
    linear-gradient(
      225deg,
      transparent 0,
      transparent 50%,
      var(--paper-edge) 50%,
      var(--paper-soft) 100%
    );
  border-left: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  box-shadow: -1px 1px 1px rgba(42, 34, 24, 0.06);
  pointer-events: none;
}

.clip.is-bookmarked.is-open::after {
  width: 34px;
  height: 34px;
}

/* «прочитано» — дуже тиха олівцева риска праворуч від заголовка.
   Видно лише в згорнутому стані; коли картка відкрита — приховуємо,
   щоб не плутати з контентом. */
.clip.is-read:not(.is-open) .clip__title::after {
  content: "";
  display: inline-block;
  width: 1.6em;
  height: 1px;
  margin-left: 0.6em;
  vertical-align: 0.28em;
  background: var(--ink-faint);
  opacity: 0.35;
}

.clip.is-loading .clip__body {
  color: var(--ink-faint);
  font-style: italic;
}

/* nothing-found state */
.nothing {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  padding: 16px 0 0 var(--gutter);
  margin: 0;
  max-width: 50ch;
}

/* ---------- colophon ---------- */

.colophon {
  margin-top: 4vh;
  padding: 22px 28px 24px;
  margin-left: var(--gutter);
  background: var(--paper-cool);
  border: 1px solid var(--rule);
  border-radius: 2px;
  position: relative;
}

.colophon p {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0;
}

/* ---------- inline link inside body copy ---------- */

.inline-link {
  font-family: inherit;
  font-style: italic;
  font-size: inherit;
  color: var(--ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-bottom: 1px solid var(--ink-faint);
  line-height: inherit;
  transition: border-color 200ms ease, color 200ms ease;
}
.inline-link:hover { border-bottom-color: var(--ink); }

/* ---------- contribution slot ---------- */

.controls__slot {
  margin: 24px 0 0;
}

.slot {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  padding: 22px 24px;
  cursor: pointer;
  font-family: var(--serif);
  color: inherit;
  position: relative;
  transition: border-color 220ms ease, background-color 220ms ease;
}

.slot:hover {
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.22);
}

.slot__title {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.3;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.slot__sub {
  display: block;
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--carbon);
  margin-top: 8px;
}

/* tiny folded-corner ornament — like an empty slot waiting for paper */
.slot__corner {
  position: absolute;
  top: -1px; right: -1px;
  width: 22px; height: 22px;
  background:
    linear-gradient(225deg, transparent 49%, var(--rule) 49%, var(--rule) 51%, transparent 51%);
  opacity: 0.7;
}
.slot:hover .slot__corner {
  background:
    linear-gradient(225deg, transparent 49%, var(--ink-soft) 49%, var(--ink-soft) 51%, transparent 51%);
}

/* ---------- ghost link (still used in a few places) ---------- */

.ghost-link {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 200ms ease;
  letter-spacing: 0;
}
.ghost-link:hover { color: var(--ink); }
.ghost-link span { transition: transform 200ms ease; display: inline-block; }
.ghost-link:hover span { transform: translateX(3px); }

.controls__extra {
  margin: 18px 0 0;
  text-align: left;
}

/* ---------- contribute form ---------- */

.contribute {
  padding: 32px 28px 28px;
  margin: 0 0 9vh var(--gutter);
  background: var(--paper-cool);
  border: 1px solid var(--rule);
  border-radius: 2px;
  animation: clip-in 320ms ease both;
  position: relative;
}

.contribute__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 22px;
  gap: 16px;
}

.contribute__title {
  font-family: var(--serif);
  font-weight: 400;
  font-style: italic;
  font-size: 20px;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.005em;
}

.contribute__close {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.contribute__close:hover { color: var(--ink-soft); }

.contribute__tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--rule-soft);
}

.tab {
  font-family: var(--typewriter);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: none;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  margin-bottom: -1px;
  transition: color 200ms ease, border-color 200ms ease;
}
.tab:hover { color: var(--ink-soft); }
.tab.is-active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.contribute__body textarea,
.contribute__body input[type="text"],
.contribute__body input[type="number"] {
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.6;
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.4);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  outline: none;
  transition: border-color 200ms ease, background-color 200ms ease;
}

.contribute__body textarea {
  min-height: 140px;
  resize: vertical;
  font-family: var(--serif);
  line-height: 1.7;
}

.contribute__body textarea:focus,
.contribute__body input:focus {
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}

.contribute__body textarea::placeholder,
.contribute__body input::placeholder {
  color: var(--ink-faint);
  font-style: italic;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}

.field-row label,
.field-stack label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-stack { margin-top: 12px; }

.field-row .label,
.field-stack .label,
.label {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--carbon);
}

/* photo drop zone */
.photo-zone {
  position: relative;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  padding: 28px 18px;
  text-align: center;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.photo-zone:hover { border-color: var(--ink-soft); background: rgba(255,255,255,0.32); }
.photo-zone.is-drag { border-color: var(--ink); background: rgba(255,255,255,0.5); }
.photo-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.photo-zone__hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--ink-soft);
  margin: 0;
}
.photo-zone__sub {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--carbon);
  margin: 6px 0 0;
}
.photo-zone__preview {
  display: none;
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto;
  border-radius: 2px;
  box-shadow: 0 1px 0 var(--rule);
}
.photo-zone.has-file .photo-zone__hint,
.photo-zone.has-file .photo-zone__sub { display: none; }
.photo-zone.has-file .photo-zone__preview { display: inline-block; }

/* signature row */
.signature-row {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.signature-saved {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  margin: 18px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.signature-saved button {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  background: none; border: none; padding: 0; cursor: pointer;
}
.signature-saved button:hover { color: var(--ink-soft); }

/* submit row */
.contribute__actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.btn-primary,
.btn-ghost {
  font-family: var(--serif);
  font-size: 15px;
  border-radius: 2px;
  padding: 11px 22px;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
}
.btn-primary:hover { background: #1d1812; border-color: #1d1812; }
.btn-primary:disabled {
  background: var(--paper-edge);
  color: var(--ink-faint);
  border-color: var(--paper-edge);
  cursor: not-allowed;
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
  font-style: italic;
}
.btn-ghost:hover { color: var(--ink); }

.contribute__error {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: #8a4a2c;
  margin: 12px 0 0;
}

/* user-contributed clip marker */
.clip__meta .badge {
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--carbon);
  padding: 2px 6px;
  border: 1px solid var(--carbon-soft);
  border-radius: 2px;
}

/* clip body — embedded image */
.clip__image {
  display: block;
  max-width: 100%;
  max-height: 480px;
  margin: 12px 0 22px;
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}

/* ---------- margin notes ---------- */

.margins {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--rule-soft);
  max-width: 58ch;
}

.margins__title {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--carbon);
  margin: 0 0 18px;
}

.margins__list { margin: 0 0 18px; }

.note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink);
  margin: 0 0 16px;
}
.note + .note::before {
  content: "⁂";
  display: block;
  text-align: center;
  font-style: normal;
  font-size: 12px;
  color: var(--ink-ghost);
  letter-spacing: 0.4em;
  margin: 18px 0;
}
.note__sig {
  font-family: var(--typewriter);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--carbon);
  display: block;
  margin-top: 8px;
}

.note-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.note-form textarea {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.7;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.32);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 2px;
  outline: none;
  resize: vertical;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.note-form textarea:focus { border-color: var(--ink-soft); background: rgba(255,255,255,0.6); }
.note-form textarea::placeholder { color: var(--ink-faint); }

.note-form__actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.note-form__sig {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.note-form__sig em {
  font-family: var(--serif);
  font-style: italic;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}
.note-form__submit {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background-color 200ms ease, border-color 200ms ease;
}
.note-form__submit:hover { background: rgba(255,255,255,0.32); border-color: var(--ink-soft); }
.note-form__submit:disabled { color: var(--ink-faint); cursor: not-allowed; }

/* ---------- recognize ---------- */

.recognize {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule-soft);
  max-width: 58ch;
}

.recognize__list {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.recognize__list strong {
  font-weight: 400;
  color: var(--ink);
}

.recognize__btn {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
  background: transparent;
  border: 1px dashed var(--rule);
  border-radius: 2px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.recognize__btn:hover {
  background: rgba(255,255,255,0.32);
  border-color: var(--ink-soft);
  color: var(--ink);
}
.recognize__btn.is-marked {
  color: var(--ink-faint);
  border-style: solid;
  border-color: var(--rule-soft);
  background: rgba(255,255,255,0.18);
  cursor: default;
}

/* colophon latest */
.colophon__latest {
  margin-top: 10px;
  font-family: var(--typewriter);
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--carbon);
}
.colophon__latest:empty { display: none; }

.colophon__forget {
  margin-top: 14px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
}

.letter {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px dashed var(--rule);
  font-family: var(--serif);
  color: var(--ink-soft);
  max-width: 56ch;
}

.letter__opener {
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}

.letter__form { margin: 0; }

.letter__label {
  display: block;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-faint);
  margin: 0 0 8px;
  line-height: 1.5;
}

.letter__form textarea {
  width: 100%;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.35);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 10px 12px;
  resize: vertical;
  outline: none;
  transition: border-color 200ms ease, background-color 200ms ease;
}
.letter__form textarea:focus {
  border-color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.6);
}

.letter__actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin: 10px 0 0;
}

.letter__send {
  font-family: var(--typewriter);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background-color 200ms ease;
}
.letter__send:hover { background: #1d1812; }
.letter__send:disabled {
  background: var(--paper-edge);
  color: var(--ink-faint);
  border-color: var(--paper-edge);
  cursor: not-allowed;
}

.letter__status {
  margin: 8px 0 0;
  font-style: italic;
  font-size: 13px;
  color: var(--ink-soft);
}
.letter__status:empty { display: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---------- animations ---------- */

@keyframes clip-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes body-in {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 4000px; }
}

@media (prefers-reduced-motion: reduce) {
  .clip, .clip__body { animation: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  :root { --gutter: 0px; }

  .page { padding: 8vh 22px 12vh; }
  .masthead { margin-bottom: 7vh; }
  .controls { margin-bottom: 7vh; }

  .title { font-size: clamp(44px, 12vw, 64px); }
  .subtitle { font-size: 17px; margin-bottom: 32px; }
  .foreword { font-size: 15px; padding-left: 14px; }

  .search {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  #year, .search__random {
    padding: 13px 16px;
    text-align: left;
  }
  #year {
    background-position: right 14px center;
  }
  .search__random { text-align: center; }

  /* year stamp becomes inline meta on mobile */
  .clip {
    padding: 48px 0 32px;
  }
  .clip:first-of-type { padding-top: 0; }

  .clip__year {
    position: static;
    width: auto;
    display: inline-block;
    font-size: 14px;
    font-style: italic;
    color: var(--ink-faint);
    margin: 0 0 8px;
    letter-spacing: 0.04em;
  }

  .clip + .clip::before {
    left: 0;
    right: 0;
    text-align: left;
  }

  .clip__title { font-size: 22px; line-height: 1.3; }
  .clip__snippet { font-size: 16.5px; }
  .clip__body { font-size: 16.5px; line-height: 1.72; }
  .clip__body p:first-child::first-letter {
    font-size: 2.2em;
    padding: 3px 8px 0 0;
  }

  .hero { padding: 22px 20px 20px; margin-top: 18px; }
  .hero-clip__title { font-size: 22px; }
  .hero-clip__body { font-size: 15px; line-height: 1.62; }
  .hero-clip__body p:first-child::first-letter { font-size: 2.4em; padding: 4px 7px 0 0; }
  .hero-meta { padding: 0 8px; }

  .stats { font-size: 10px; gap: 6px 8px; letter-spacing: 0.12em; }

  .contribute { padding: 22px 18px 20px; margin-bottom: 7vh; }
  .field-row { grid-template-columns: 1fr; gap: 10px; }
  .signature-row { grid-template-columns: 1fr; }
  .contribute__actions { flex-direction: column-reverse; align-items: stretch; }
  .btn-primary, .btn-ghost { width: 100%; padding: 13px 18px; }

  .note-form__actions { flex-direction: column; align-items: stretch; gap: 8px; }
  .note-form__submit { width: 100%; }
}

/* «Сьогодні в підшивці» — same-day clips across years */
.today { margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px dashed #c9c2b6; }
.today .count { font-style: italic; opacity: 0.78; }

/* «наснити ще» button next to a freshly rendered dream */
.dream-again { margin-top: 12px; padding-top: 8px; opacity: 0.7; }
.dream-again .inline-link { font-size: 0.92em; }

/* ---------- print: keep only the expanded clip on the page,
   stripped of UI furniture, set as a clean grayscale paper page. */
@media print {
  body { background: #fff; color: #000; }
  .masthead,
  .filter,
  .hero,
  .hero-meta,
  .controls,
  .contribute,
  .tear-line,
  .colophon,
  .today,
  .nothing,
  .count,
  .dream-nudge,
  .dream-again,
  .clip__bookmark,
  .clip__print,
  .clip__link,
  .clip__close,
  .margins,
  .recognize,
  .clip__catalog,
  .clip__year { display: none !important; }

  /* hide every clip that is NOT currently expanded */
  .clip:not(.is-open) { display: none !important; }

  .page { max-width: 100%; padding: 0; margin: 0; }
  .results { padding: 0; margin: 0; }
  .clip {
    padding: 0 !important;
    cursor: default;
    page-break-inside: avoid;
    animation: none !important;
  }
  .clip::after { display: none !important; }
  .clip__title {
    font-family: var(--serif);
    font-size: 28px;
    color: #000;
    max-width: none;
    margin-bottom: 14px;
  }
  .clip__meta {
    color: #000;
    opacity: 0.8;
    margin-bottom: 18px;
  }
  .clip__body {
    color: #000;
    font-size: 14pt;
    line-height: 1.55;
    max-width: none;
  }
  .clip__source {
    color: #000;
    border-top: 1px solid #000;
    margin-top: 24px;
    padding-top: 10px;
    display: block;
  }
}
