/*
 * The Edison Papers - the blog's own look: paper, ink, Cormorant Garamond
 * for display and EB Garamond for reading (both served from this site, see
 * fonts.css). Only /blog/ loads this file.
 */

/* ── Design tokens ── */
:root {
  --paper:      #f4ecdb;
  --paper-2:    #ece1c9;
  --ink:        #211b12;
  --ink-soft:   #5b5140;
  --ink-faint:  #9a8e76;
  --rule:       rgba(33,27,18,.28);
  --accent:     #a9842f;
  --accent-soft:#d8b86c;
  --display:    'Cormorant Garamond', serif;
  --body-font:  'EB Garamond', serif;
  --maxw:       1080px;
}
body[data-accent="burgundy"] { --accent:#7a2433; --accent-soft:#b65a68; }
body[data-accent="ink"]      { --accent:#3a3225; --accent-soft:#7d7159; }

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

/* ── Base ── */
html { background: var(--paper); }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body-font);
  font-size: 18px;
  line-height: 1.62;
  min-height: 100vh;
  padding: 0;
}

/* Paper texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255,252,245,.7) 0%, transparent 70%),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 27px,
      rgba(150,135,100,.05) 27px,
      rgba(150,135,100,.05) 28px
    );
}

.wrapper {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}

/* ── Site navigation (shared with the memorial, in the Papers' own palette) ── */
.site-nav-blog {
  display: flex; align-items: center; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap;
  padding: 10px 18px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  position: relative; z-index: 2;
}
.site-nav-blog .brand {
  font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .3em; text-transform: uppercase;
  color: var(--ink); text-decoration: none; padding: 8px 0; margin: -8px 0;
}
.site-nav-blog nav {
  display: flex; gap: 2px; align-items: center; margin-left: auto;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.site-nav-blog nav::-webkit-scrollbar { display: none; }
.site-nav-blog nav a {
  flex: 0 0 auto; padding: 8px 12px; border-radius: 2px;
  font-family: var(--display); font-weight: 600; font-size: 12.5px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-soft); text-decoration: none;
}
.site-nav-blog nav a:hover { color: var(--ink); background: rgba(33,27,18,.06); }
.site-nav-blog nav a[aria-current="page"] { color: var(--paper); background: var(--accent); }
@media (max-width: 720px) {
  .site-nav-blog nav { flex: 1 0 100%; margin-left: 0; }
}

/* ── Utility bar ── */
.util-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0 12px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--display);
  font-size: 13px;
  font-style: italic;
  color: var(--ink-soft);
}

/* ── Small-caps utility ── */
.sc {
  font-family: var(--display);
  font-variant: small-caps;
  text-transform: uppercase;
  letter-spacing: .28em;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
}

/* ── Ornamental rule ── */
.orn-rule {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}
.orn-rule::before,
.orn-rule::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
}
.orn-rule::after {
  background: linear-gradient(to left, transparent, var(--accent), transparent);
}
.orn-rule span { color: var(--accent); font-size: 14px; }

/* ── Masthead ── */
.masthead {
  text-align: center;
  padding: 44px 0 36px;
}
.masthead-star {
  display: block;
  font-size: 18px;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: .4em;
}
.crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--accent);
  font-family: var(--display);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}
.masthead h1 {
  font-family: var(--display);
  font-size: clamp(52px, 10vw, 104px);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: .92;
  color: var(--ink);
  margin-bottom: 12px;
}
.masthead-sub {
  font-family: var(--display);
  font-size: clamp(14px, 2.2vw, 20px);
  font-style: italic;
  color: var(--ink-soft);
  margin-top: 10px;
}

/* ── Entries ── */
.entries {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 44px;
  padding: 54px 0;
}

/* Each entry is its own box: a double paper frame, the heading on top,
   the pictures and the words inside, the buttons along the foot. */
.entry {
  display: flex;
  flex-direction: column;
  background: rgba(255,250,238,.55);
  border: 1px solid var(--ink);
  outline: 1px solid var(--accent);
  outline-offset: 4px;
  padding: 30px 34px 24px;
  margin: 5px;              /* room for the outer rule */
}
.entry-head { min-width: 0; }
.entry-head h2, .entry-head h3 { overflow-wrap: anywhere; }
/* The words, with the tall picture floated at their side; the box grows
   to fit them. */
.entry-body { min-width: 0; }
.entry-body::after { content: ''; display: block; clear: both; }
.entries-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-family: var(--display);
  font-style: italic;
  color: var(--ink-faint);
  padding: 40px 0;
}

/* ── Photo frames (one per picture, stacked) ── */
figure { margin: 0; }
.plates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px 22px;
  align-content: start;
  padding: 12px;
}
.plates figure:first-child { grid-column: 1 / -1; }
/* The floated plate is sized from the picture's proportions (--pr, width
   over height, set per entry) so a very tall picture does not tower over
   the words. */
.pic-tall .plates { float: left; width: min(42%, calc(31rem * var(--pr, 0.75) + 24px)); margin: 6px 32px 16px 0; }
.pic-tall.flip .plates { float: right; margin: 6px 0 16px 32px; }
.pic-wide .plates { width: min(100%, 640px); margin: 0 auto 26px; }
.plates figure:not(:first-child) figcaption { font-size: 12.5px; margin-top: 10px; }
.ph-empty { display: block; aspect-ratio: 4/3; }

body[data-frame="gilded"] .ph,
body:not([data-frame]) .ph {
  padding: 11px;
  box-shadow:
    0 0 0 1px var(--ink),
    0 0 0 9px var(--paper),
    0 0 0 10px var(--accent),
    0 22px 34px -22px rgba(0,0,0,.5);
}
body[data-frame="plain"] .ph {
  padding: 6px;
  box-shadow:
    0 0 0 1px var(--ink),
    0 18px 30px -22px rgba(0,0,0,.4);
}
body[data-frame="oval"] .ph {
  border-radius: 50%;
  padding: 11px;
  box-shadow:
    0 0 0 1px var(--ink),
    0 0 0 9px var(--paper),
    0 0 0 10px var(--accent),
    0 22px 34px -22px rgba(0,0,0,.5);
  overflow: hidden;
}
body[data-frame="oval"] .ph img { border-radius: 50%; }

.ph {
  display: block;
  background: var(--paper-2);
  line-height: 0;
}
.ph img {
  display: block;
  width: 100%;
  height: auto;          /* the width/height attributes only reserve the shape; nothing is cropped */
}

figcaption {
  font-family: var(--display);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 14px;
}

/* ── Entry text ── */
.entry-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-size: 13px;
  margin-bottom: 14px;
}
.entry-num {
  color: var(--accent);
  font-weight: 600;
  letter-spacing: .06em;
}
.entry-sep { color: var(--accent-soft); font-size: 12px; }
.entry-date { font-style: italic; color: var(--ink-soft); }

.entry-head h2 {
  font-family: var(--display);
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 600;
  line-height: 1.08;
  color: var(--ink);
  margin-bottom: 6px;
}
.entry-head h3 {
  font-family: var(--display);
  font-size: clamp(15px, 2vw, 18px);
  font-weight: 400;
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 20px;
}

.body-cat, .body-en {
  font-family: var(--body-font);
  font-size: 17px;
  line-height: 1.68;
  color: var(--ink);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.body-en { display: none; }
.body-en.visible { display: block; }
.body-cat.hidden { display: none; }

/* Drop cap on first entry, first paragraph */
.entry:first-child .body-cat p:first-child::first-letter,
.entry:first-child .body-en p:first-child::first-letter {
  float: left;
  font-family: var(--display);
  font-size: 3.5em;
  font-weight: 700;
  color: var(--accent);
  line-height: .78;
  margin: .04em .1em 0 0;
}

.body-cat p + p,
.body-en p + p { margin-top: .9em; }

/* ── Controls row ── */
.entry-controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}
.translate-btn { flex: 0 0 auto; }

.translate-btn {
  font-family: var(--display);
  font-size: 12.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  padding: 6px 14px 7px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.translate-btn:hover {
  background: var(--ink);
  color: var(--paper);
}
.translate-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Audio player placeholder ── */
.audio-player {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255,250,238,.5);
  border: 1px solid var(--rule);
  padding: 6px 12px 6px 6px;
  flex: 1 1 200px;
  min-width: 0;
  overflow: hidden;
}
.play-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: linear-gradient(160deg, var(--accent-soft), var(--accent));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  flex-shrink: 0;
  cursor: pointer;
}
.waveform {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.waveform i {
  display: block;
  width: 2px;
  background: var(--accent-soft);
  border-radius: 1px;
  font-style: normal;
}
.audio-meta {
  font-family: var(--display);
  font-style: italic;
  font-size: 12px;
  color: var(--ink-faint);
  white-space: nowrap;
}
.audio-real { flex: 1; min-width: 160px; height: 36px; }

/* ── Site footer ── */
.site-footer {
  text-align: center;
  padding: 20px 0 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--display);
  font-size: 13px;
  font-style: italic;
  color: var(--ink-faint);
}
.site-footer a {
  color: var(--ink-soft);
  text-decoration: none;
}
.site-footer a:hover { color: var(--accent); }

/* ── Responsive ── */
@media (max-width: 820px) {
  .entries { gap: 30px; padding: 40px 0; }
  .entry { padding: 22px 18px 18px; }
  .pic-tall .plates, .pic-tall.flip .plates { float: none; width: min(100%, 360px); margin: 0 auto 22px; }
  .wrapper { padding: 0 18px; }
  .masthead h1 { font-size: clamp(42px, 12vw, 72px); }
}
