/* ============================================================
   East of North - poem with interactive plates
   Scoped to .eon. Layout lives here so it can change without
   touching the post body.
   ============================================================ */

.eon {
  /* The plates are drawn light-on-dark in both site themes. */
  --eon-plate: #0a1124;
  --eon-brass: #c8a35a;
  --eon-north: #e4573d;
  --eon-gold: #ffd98a;
  --eon-ana: #8fdcf0;
  --eon-rule: rgba(200, 163, 90, 0.28);
  --eon-frame: rgba(200, 163, 90, 0.42);
  --eon-verse: "IM Fell English", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --eon-wide: max(100%, min(1136px, 100vw - 5rem));

  margin: var(--tn-space-lg) 0 var(--tn-space-2xl);
  color: var(--tn-text);
}

[data-theme="light"] .eon {
  --eon-brass: #8a6420;
  --eon-north: #c43d24;
  --eon-gold: #a8740a;
  --eon-ana: #1d86a3;
  --eon-rule: rgba(138, 100, 32, 0.3);
}

/* --- Opening --- */
.eon .eon-standfirst {
  margin: 0 0 var(--tn-space-lg);
  font-family: var(--eon-verse);
  font-style: italic;
  font-size: clamp(1.3rem, 2.6vw, 1.6rem);
  line-height: 1.35;
  color: var(--tn-text-muted);
  text-wrap: balance;
}

.eon .eon-key {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--tn-space-sm) var(--tn-space-lg);
  margin: 0;
  padding: 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--tn-text-muted);
}

.eon .eon-key li {
  display: flex;
  align-items: center;
  gap: var(--tn-space-sm);
  margin: 0;
}

.eon .eon-k {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 10px currentColor;
}

.eon .eon-k-n { color: var(--eon-north); }
.eon .eon-k-e { color: var(--eon-gold); }
.eon .eon-k-a { color: var(--eon-ana); }

/* --- The spread: breaks out of the 780px article column --- */
.eon .eon-spread {
  width: var(--eon-wide);
  margin: var(--tn-space-xl) 0 0 calc((100% - var(--eon-wide)) / 2);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: clamp(20px, 3vw, 36px);
  align-items: start;
}

.eon .eon-col {
  display: flex;
  flex-direction: column;
  gap: var(--tn-space-lg);
  min-width: 0;
}

/* --- Plates --- */
.eon .eon-plate {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--tn-space-sm);
}

.eon .eon-frame {
  position: relative;
  padding: 5px;
  background: var(--eon-plate);
  border: 1px solid var(--eon-frame);
  border-radius: var(--tn-radius-md);
  box-shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.7);
}

.eon .eon-frame::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(200, 163, 90, 0.14);
  border-radius: calc(var(--tn-radius-md) - 3px);
  pointer-events: none;
}

.eon canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: calc(var(--tn-radius-md) - 4px);
  touch-action: pan-y;
  cursor: grab;
}

.eon canvas:active { cursor: grabbing; }
.eon canvas[data-plate="card"] { cursor: default; }
.eon .eon-plate-big canvas { aspect-ratio: 1 / 0.92; }

.eon figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tn-text-muted);
}

.eon figcaption b { font-weight: 600; color: var(--eon-brass); }
.eon figcaption span:last-child { color: var(--eon-gold); }

/* --- Verse --- */
.eon .eon-stanza {
  margin: 0;
  font-family: var(--eon-verse);
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--tn-text);
}

.eon .eon-stanza .l {
  display: block;
  padding-left: 1.2em;
  text-indent: -1.2em;
}

/* --- Gloss: a balloon note on a word in the verse --- */
.eon .eon-gloss {
  position: relative;
  cursor: help;
  text-decoration: underline dotted var(--eon-brass);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  border-radius: 2px;
  outline: none;
}

.eon .eon-gloss:focus-visible {
  outline: 2px solid var(--tn-accent);
  outline-offset: 2px;
}

.eon .eon-tip {
  position: absolute;
  left: -0.75rem;
  bottom: calc(100% + 12px);
  z-index: 5;
  width: max-content;
  max-width: min(17rem, calc(100vw - 2.5rem));
  padding: 0.7rem 0.95rem 0.8rem;
  text-indent: 0;
  white-space: normal;
  font-family: var(--tn-font);
  font-style: normal;
  font-size: 0.82rem;
  line-height: 1.5;
  color: #ece5d3;
  background: linear-gradient(180deg, #121c3a 0%, #0a1124 100%);
  border: 1px solid rgba(200, 163, 90, 0.5);
  border-radius: var(--tn-radius-md);
  box-shadow: 0 16px 36px -14px rgba(0, 0, 0, 0.75), inset 0 0 0 3px rgba(10, 17, 36, 0.9), inset 0 0 0 4px rgba(200, 163, 90, 0.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  pointer-events: none;
}

.eon .eon-tip b {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #c8a35a;
}

.eon .eon-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: calc(0.75rem + 0.9em);
  width: 10px;
  height: 10px;
  margin-top: -5px;
  background: #0a1124;
  border-right: 1px solid rgba(200, 163, 90, 0.5);
  border-bottom: 1px solid rgba(200, 163, 90, 0.5);
  transform: rotate(45deg);
}

.eon .eon-gloss:hover .eon-tip,
.eon .eon-gloss:focus-visible .eon-tip,
.eon .eon-gloss.is-open .eon-tip {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {
  .eon .eon-tip { transform: none; transition: none; }
}

.eon .eon-stanzas {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--tn-space-lg) var(--tn-space-xl);
}

.eon .eon-stanzas .eon-stanza { font-size: 1rem; }

/* --- Controls (buttons use the theme's .btn classes) --- */
.eon .eon-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tn-space-sm) var(--tn-space-md);
  font-size: 0.78rem;
}

.eon .eon-controls .btn[aria-pressed="true"] {
  border-color: var(--eon-brass);
  background: rgba(200, 163, 90, 0.14);
}

.eon .eon-controls .btn:focus-visible {
  outline: 2px solid var(--tn-accent);
  outline-offset: 2px;
}

.eon .eon-turn {
  display: inline-flex;
  align-items: center;
  gap: var(--tn-space-sm);
}

.eon .eon-ro {
  min-width: 3.2em;
  font-family: var(--tn-font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--tn-text);
}

.eon .eon-hint {
  margin-left: auto;
  color: var(--tn-text-dim);
}

/* --- Close --- */
.eon .eon-foot {
  width: var(--eon-wide);
  margin: var(--tn-space-2xl) 0 0 calc((100% - var(--eon-wide)) / 2);
  padding-top: var(--tn-space-xl);
  border-top: 1px solid var(--eon-rule);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--tn-space-xl) clamp(24px, 5vw, 72px);
  align-items: end;
}

.eon .eon-close {
  font-style: italic;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  line-height: 1.5;
  color: var(--tn-heading);
}

.eon .eon-note {
  margin: 0;
  max-width: 74ch;
  font-size: 0.8rem;
  line-height: 1.75;
  color: var(--tn-text-muted);
}

/* --- Essay (normal article column, theme typography) --- */
.eon-essay {
  margin-top: var(--tn-space-2xl);
  padding-top: var(--tn-space-xl);
  border-top: 1px solid var(--tn-border);
}

.eon-essay > p:first-child {
  font-size: 1.15em;
  color: var(--tn-text-muted);
}

.eon-essay .eon-essay-note {
  font-size: 0.85rem;
  color: var(--tn-text-dim);
}

@media (max-width: 820px) {
  .eon .eon-spread,
  .eon .eon-foot { grid-template-columns: minmax(0, 1fr); }
  .eon .eon-hint { margin-left: 0; }
}

@media (max-width: 560px) {
  .eon .eon-stanzas { grid-template-columns: minmax(0, 1fr); }
}
