/* The History page: The Coffee Chronicle, a vintage masthead over a timeline of the History Agent's
 * entries, on crumpled old paper (no site nav). Each entry opens as a Chronicle article in a dialog.
 * Fonts: UnifrakturMaguntia for the masthead, IM Fell English for the text, Special Elite for typewriter labels. */
/* UnifrakturMaguntia and IM Fell English (SIL Open Font License); Special Elite (Apache License 2.0). */
@font-face { font-family: 'UnifrakturMaguntia'; src: url('fonts/unifraktur-maguntia.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IM Fell English'; src: url('fonts/im-fell-english.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'IM Fell English'; src: url('fonts/im-fell-english-italic.woff2') format('woff2'); font-style: italic; font-display: swap; }
@font-face { font-family: 'IM Fell English SC'; src: url('fonts/im-fell-english-sc.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Special Elite'; src: url('fonts/special-elite.woff2') format('woff2'); font-display: swap; }

.hx-body {
  --paper: #ecdfc4; --paper-2: #e2d2b2; --ink: #3a2219; --rust: #8f3f26; --faded: #5a6a72; --clay: #8fa9bc;
  --black: 'UnifrakturMaguntia', 'IM Fell English', Georgia, serif;
  --fell: 'IM Fell English', 'Cormorant Garamond', Georgia, serif;
  --fell-sc: 'IM Fell English SC', 'IM Fell English', 'Cormorant Garamond', Georgia, serif;
  --type: 'Special Elite', 'Courier New', monospace;
  color: var(--ink);
  /* The page: light, fine-grained old paper. The article dialog uses the darker crumpled paper
     (--paper-bg: foxed edges, stains, two fold lines, grain and lit fractal creases). */
  --paper-bg: radial-gradient(ellipse at 50% 40%, rgba(0, 0, 0, 0) 55%, rgba(110, 66, 28, .30) 100%),
    radial-gradient(circle at 12% 18%, rgba(140, 90, 40, .16), rgba(140, 90, 40, 0) 9%),
    radial-gradient(circle at 86% 62%, rgba(140, 90, 40, .13), rgba(140, 90, 40, 0) 11%),
    radial-gradient(circle at 30% 88%, rgba(120, 75, 30, .12), rgba(120, 75, 30, 0) 7%),
    linear-gradient(92deg, rgba(0, 0, 0, 0) 49.6%, rgba(255, 250, 238, .5) 49.9%, rgba(90, 55, 25, .16) 50.2%, rgba(0, 0, 0, 0) 50.7%),
    linear-gradient(178deg, rgba(0, 0, 0, 0) 32.6%, rgba(255, 250, 238, .4) 32.85%, rgba(90, 55, 25, .13) 33.1%, rgba(0, 0, 0, 0) 33.6%),
    var(--grain),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='c' x='0' y='0'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .009' numOctaves='6' seed='11' stitchTiles='stitch'/%3E%3CfeDiffuseLighting surfaceScale='4' diffuseConstant='1.25' lighting-color='%23fff6e4'%3E%3CfeDistantLight azimuth='225' elevation='52'/%3E%3C/feDiffuseLighting%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23c)'/%3E%3C/svg%3E");
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .23 0 0 0 0 .13 0 0 0 0 .08 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background: #f3ecdd var(--grain);
}
/* The faint picture of the era you are reading, fixed behind the timeline (assets/history/history.js
   switches it as you scroll through the years). */
.hx-era { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.hx-era > div { position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease; }
.hx-era > div.on { opacity: 1; }
.hx-era svg { position: absolute; right: -3vw; bottom: -3vh; width: min(64vw, 860px); height: auto; opacity: .085; }
.hx-era-name { position: absolute; left: 3vw; bottom: 4vh; font: 400 clamp(40px, 7vw, 110px)/1 var(--black); color: var(--ink); opacity: .06; max-width: 60vw; }
.hx, .hx-body footer { position: relative; z-index: 1; }
@media (max-width: 760px) { .hx-era svg { width: 120vw; right: -30vw; opacity: .07; } .hx-era-name { display: none; } }
@media (prefers-reduced-motion: reduce) { .hx-era > div { transition: none; } }
.hx { font-family: var(--fell); padding-bottom: 70px; }
.hx-back { padding-top: 24px; }
.hx-back a { color: var(--ink); font: 14px var(--type); letter-spacing: .04em; text-transform: none; }
.hx-back a:hover { color: var(--rust); }

/* The site footer, in ink on the same paper. */
.hx-body footer { background: transparent; color: var(--ink); border-top: 4px double var(--ink); padding-top: 50px; }
.hx-body .footer-top { border-bottom-color: rgba(58, 34, 25, .3); }
.hx-body .footer-tag, .hx-body .footer-col h2, .hx-body .footer-bottom, .hx-body .footer-soon, .hx-body .footer-muted { color: var(--faded); }
.hx-body .footer-col a, .hx-body .footer-bottom a { color: var(--ink); }
.hx-body .footer-col a:hover { color: var(--rust); }

/* ── masthead ── */
.hx-demo { margin: 0 0 14px; padding: 8px 14px; border: 1px dashed var(--rust); color: var(--rust); font: 14px var(--type); text-align: center; }
.hx-mast { padding-top: 28px; }
.hx-strip { display: flex; justify-content: space-between; gap: 16px; font: 500 12px/1.4 'Jost', sans-serif; letter-spacing: .24em; text-transform: uppercase; border-bottom: 1px solid var(--ink); padding-bottom: 10px; }
.hx-strip span:nth-child(2) { text-align: center; }
.hx-title { font: 400 clamp(38px, 6.4vw, 84px)/1.1 var(--black); text-align: center; margin: 16px 0 6px; letter-spacing: .01em; }
.hx-rule { border-top: 4px double var(--ink); }
.hx-filters { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 34px; border-bottom: 1px solid var(--ink); padding: 10px 0; }
.hx-filters button { font: 20px var(--fell-sc); letter-spacing: .06em; color: var(--ink); background: none; border: 0; padding: 4px 2px; cursor: pointer; border-bottom: 2px solid transparent; }
.hx-filters button[aria-pressed="true"] { color: var(--rust); border-bottom-color: var(--rust); }
.hx-filters button:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }
.hx-lede { text-align: center; font: italic 26px/1.35 var(--fell); color: var(--faded); margin: 26px auto 0; max-width: 760px; }
.hx-orn { text-align: center; color: var(--rust); letter-spacing: .6em; font-size: 20px; margin-top: 18px; }

/* ── timeline ── */
.hx-line { position: relative; margin-top: 50px; }
.hx-line::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 3px double var(--ink); }
.hx-century { position: relative; text-align: center; margin: 10px 0 34px; }
.hx-century span { position: relative; background: #efe3ca; padding: 6px 18px; font: 22px var(--fell-sc); letter-spacing: .08em; color: var(--rust); border: 1px solid var(--ink); }
.hx-stop { display: grid; grid-template-columns: 1fr 130px 1fr; align-items: start; margin-bottom: 44px; }
.hx-year { grid-column: 2; justify-self: center; width: 112px; height: 112px; border-radius: 50%; border: 2px solid var(--ink); background: #efe3ca; display: grid; place-items: center; text-align: center; font: 30px/1.05 var(--fell); position: relative; z-index: 1; padding: 6px; }
.hx-year.small { font-size: 22px; }
.hx-card { grid-row: 1; background: rgba(247, 238, 218, .82); border: 1px solid rgba(58, 34, 25, .3); box-shadow: 0 6px 16px rgba(58, 34, 25, .16), inset 0 0 40px rgba(150, 100, 45, .14); padding: 26px 30px; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform .2s, box-shadow .2s; }
.hx-card:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(58, 34, 25, .18); }
.hx-card:focus-visible { outline: 2px solid var(--rust); outline-offset: 4px; }
.hx-stop.left .hx-card { grid-column: 1; }
.hx-stop.right .hx-card { grid-column: 3; }
.hx-kicker { font: 18px var(--fell-sc); letter-spacing: .06em; color: var(--rust); }
.hx-head { font: 400 38px/1.06 var(--fell); margin: 8px 0 12px; }
.hx-card-body { display: grid; grid-template-columns: 1fr 120px; gap: 18px; align-items: center; }
.hx-sum { font-size: 19px; line-height: 1.5; }
.hx-more { display: block; margin-top: 14px; font: 500 12px 'Jost', sans-serif; letter-spacing: .24em; text-transform: uppercase; color: var(--rust); }
.hx-fig svg { width: 100%; height: auto; }
.hx-empty, .hx-next { text-align: center; font: italic 24px var(--fell); color: var(--faded); position: relative; background: #efe3ca; padding: 10px; max-width: 640px; margin: 0 auto; }
.hx-next { margin-top: 10px; border: 2px dashed var(--clay); }
.hx-stop[hidden], .hx-century[hidden] { display: none; }

@media (max-width: 760px) {
  .hx-strip span:nth-child(2) { display: none; }
  .hx-filters { gap: 4px 18px; }
  .hx-filters button { font-size: 17px; }
  .hx-lede { font-size: 20px; }
  .hx-line::before { left: 28px; }
  .hx-century { text-align: left; padding-left: 0; }
  .hx-stop { grid-template-columns: 58px 1fr; gap: 0 12px; }
  .hx-year { grid-column: 1; width: 58px; height: 58px; font-size: 16px; padding: 2px; }
  .hx-year.small { font-size: 12px; }
  .hx-stop.left .hx-card, .hx-stop.right .hx-card { grid-column: 2; grid-row: 1; }
  .hx-card { padding: 18px; }
  .hx-head { font-size: 28px; }
  .hx-card-body { grid-template-columns: 1fr; }
  .hx-fig { display: none; }
  .hx-sum { font-size: 17px; }
}

/* ── the article: a Chronicle page in a dialog ── */
.hx-dialog { width: min(1080px, calc(100vw - 32px)); max-height: calc(100vh - 40px); border: 0; padding: 0; background-color: var(--paper); background-image: var(--paper-bg); background-size: auto, auto, auto, auto, auto, auto, 300px 300px, 900px 900px; background-blend-mode: multiply, multiply, multiply, multiply, normal, normal, multiply, multiply; background-attachment: local; color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .45); font-family: var(--fell); }
.hx-dialog::backdrop { background: rgba(43, 26, 20, .6); }
.hx-sheet { background: transparent; padding: 34px 48px 44px; }
.hx-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; position: sticky; top: 0; background: #e9dbbd; padding: 12px 0 10px; border-bottom: 1px solid var(--ink); z-index: 2; }
.hx-bar .hx-brand { font: 26px var(--black); }
.hx-bar nav { display: flex; gap: 8px; }
.hx-bar button { font: 500 12px 'Jost', sans-serif; letter-spacing: .18em; text-transform: uppercase; background: none; color: var(--ink); border: 1px solid var(--ink); padding: 9px 14px; cursor: pointer; }
.hx-bar button:hover { background: var(--ink); color: var(--paper); }
.hx-bar button:disabled { opacity: .35; cursor: default; background: none; color: var(--ink); }
.hx-dateline { display: flex; justify-content: space-between; font: 15px var(--type); color: var(--faded); margin: 18px 0 0; border-bottom: 4px double var(--ink); padding-bottom: 10px; }
.hx-a-head { font: 400 clamp(36px, 6vw, 68px)/1.02 var(--fell); margin: 18px 0 12px; }
.hx-a-sum { font: italic 24px/1.4 var(--fell); color: var(--faded); margin-bottom: 26px; }
.hx-a-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; }
.hx-a-story { columns: 2; column-gap: 32px; font-size: 19px; line-height: 1.6; text-align: justify; hyphens: auto; }
.hx-a-story p { margin: 0 0 14px; }
.hx-a-story p:first-child::first-letter { float: left; font: 400 84px/.8 var(--fell); color: var(--rust); padding: 8px 10px 0 0; }
.hx-a-today { font-style: italic; color: var(--faded); }
.hx-side > * + * { margin-top: 24px; }
.hx-figbox { border: 1px solid var(--ink); background: var(--paper-2); padding: 14px; text-align: center; }
.hx-figbox svg { width: 100%; max-width: 260px; height: auto; }
.hx-quote { border-top: 3px double var(--ink); border-bottom: 3px double var(--ink); padding: 16px 0; text-align: center; font: italic 25px/1.3 var(--fell); }
.hx-box { border: 2px solid var(--ink); padding: 18px 20px; }
.hx-box h3, .hx-box .hx-box-h { font: 20px var(--fell-sc); letter-spacing: .06em; text-align: center; margin: 0 0 10px; }
.hx-box ol { list-style: none; margin: 0; padding: 0; }
.hx-box li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; border-top: 1px dotted var(--ink); padding: 9px 0; font-size: 16px; line-height: 1.4; }
.hx-box li b { font: 17px var(--fell-sc); color: var(--rust); font-weight: 400; }
.hx-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border-top: 4px double var(--ink); margin-top: 34px; padding-top: 18px; }
.hx-facts h3, .hx-facts .hx-box-h { grid-column: 1 / -1; font: 22px var(--fell-sc); letter-spacing: .06em; margin: 0 0 12px; }
.hx-facts div { padding: 0 18px; border-left: 1px solid var(--ink); font-size: 17px; line-height: 1.5; }
.hx-facts div:nth-child(2) { border-left: 0; padding-left: 0; }
.hx-facts b { display: block; font: 26px var(--fell-sc); color: var(--rust); font-weight: 400; }
.hx-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-top: 30px; background: rgba(247, 238, 218, .7); border: 1px solid rgba(58, 34, 25, .3); padding: 22px 26px; font: 15px/1.65 var(--type); }
.hx-legend b { color: var(--rust); font-weight: 400; }
.hx-legend div + div b { color: var(--faded); }
.hx-sources { margin-top: 28px; font: 14px/1.7 var(--type); color: var(--faded); }
.hx-sources a { color: var(--ink); }
@media (max-width: 760px) {
  .hx-sheet { padding: 0 18px 30px; }
  .hx-bar .hx-brand { font-size: 20px; }
  .hx-bar button { padding: 8px 12px; font-size: 16px; }
  .hx-bar button span { display: none; }
  .hx-a-grid { grid-template-columns: 1fr; }
  .hx-a-story { columns: 1; font-size: 18px; text-align: left; }
  .hx-legend { grid-template-columns: 1fr; }
  .hx-facts div { border-left: 0; padding: 0 0 12px; }
}

/* Share link at the foot of an article, and the /chronicle/<slug> page's "turn the page" row. */
.hx-share { margin-top: 22px; font: 15px var(--type); }
.hx-share a, .hx-turn a { color: var(--rust); }
.hx-turn { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 16px; border-top: 4px double var(--ink); font: 15px var(--type); }
.hx-page .hx-dateline { margin-top: 6px; }

/* Stops still to come: a faint dot on the line and one line of text, in the gaps of the timeline. */
.hx-soon { display: grid; grid-template-columns: 1fr 130px 1fr; align-items: center; margin: -18px 0 26px; color: var(--faded); }
.hx-soon-dot { grid-column: 2; justify-self: center; width: 16px; height: 16px; border-radius: 50%; border: 2px dashed var(--faded); background: #f3ecdd; position: relative; z-index: 1; }
.hx-soon-text { grid-column: 3; font: italic 18px/1.3 var(--fell); }
.hx-soon:nth-of-type(odd) .hx-soon-text { grid-column: 1; grid-row: 1; text-align: right; }
.hx-soon b { font: 17px var(--fell-sc); font-weight: 400; color: var(--rust); font-style: normal; }
.hx-soon em { font-style: italic; opacity: .75; }
.hx-soon[hidden] { display: none; }
@media (max-width: 760px) {
  .hx-soon { grid-template-columns: 58px 1fr; gap: 0 12px; margin: -10px 0 22px; }
  .hx-soon-dot { grid-column: 1; }
  .hx-soon-text, .hx-soon:nth-of-type(odd) .hx-soon-text { grid-column: 2; grid-row: 1; text-align: left; font-size: 16px; }
}

/* Archive pictures (public domain or freely licensed), in sepia. */
.hx-photo img { display: block; width: 100%; height: auto; filter: sepia(.55) contrast(1.05); mix-blend-mode: multiply; }
.hx-fig.hx-photo img { max-height: 130px; object-fit: cover; border: 1px solid rgba(58, 34, 25, .3); }
.hx-figbox.hx-photo { padding: 10px; margin: 0; }
.hx-figbox.hx-photo figcaption { font: 12px/1.45 var(--type); color: var(--faded); margin-top: 8px; text-align: left; }
.hx-figbox.hx-photo figcaption a { color: var(--ink); }

/* Test yourself, links to the journal, and the next stop, at the foot of an article. */
.hx-recipe { margin-top: 28px; border: 3px double var(--ink); padding: 18px 24px; background: rgba(255,250,235,.35); }
.hx-recipe h3, .hx-recipe .hx-box-h { font: 20px var(--fell-sc); letter-spacing: .06em; margin: 0 0 10px; }
.hx-recipe h3 i, .hx-recipe .hx-box-h i { font-family: var(--fell); letter-spacing: 0; text-transform: none; }
.hx-recipe ul { columns: 2; column-gap: 28px; margin: 0 0 12px; padding-left: 20px; font-size: 18px; }
.hx-recipe ol { margin: 0; padding-left: 22px; font-size: 18px; line-height: 1.5; }
.hx-recipe-now { margin: 12px 0 0; font-style: italic; font-size: 17px; }
@media (max-width: 600px) { .hx-recipe ul { columns: 1; } }
.hx-quiz, .hx-related { margin-top: 28px; border: 2px solid var(--ink); padding: 18px 22px; }
.hx-quiz h3, .hx-related h3, .hx-related .hx-box-h { font: 20px var(--fell-sc); letter-spacing: .06em; margin: 0 0 8px; }
.hx-quiz p { font-size: 19px; margin: 0 0 12px; }
.hx-quiz-opts { display: flex; flex-wrap: wrap; gap: 10px; }
.hx-quiz-opts button { font: 18px var(--fell); color: var(--ink); background: rgba(247, 238, 218, .7); border: 1px solid var(--ink); padding: 8px 16px; cursor: pointer; }
.hx-quiz-opts button:hover:not(:disabled) { background: var(--ink); color: var(--paper); }
.hx-quiz-opts button.right { background: #4f6b3a; color: #f3ecdd; border-color: #4f6b3a; }
.hx-quiz-opts button.wrong { background: var(--rust); color: #f3ecdd; border-color: var(--rust); text-decoration: line-through; }
.hx-quiz-out { font: 15px var(--type); color: var(--faded); margin: 12px 0 0 !important; min-height: 1em; }
.hx-related { display: flex; flex-wrap: wrap; gap: 8px 26px; align-items: baseline; }
.hx-related h3, .hx-related .hx-box-h { width: 100%; }
.hx-related a { font: italic 21px var(--fell); color: var(--rust); }
.hx-read-next { display: block; width: 100%; margin-top: 30px; padding: 16px 20px; font: 22px var(--fell); color: var(--paper); background: var(--ink); border: 0; cursor: pointer; text-align: center; }
.hx-read-next:hover { background: var(--rust); }
.hx-read-next.done { background: none; color: var(--faded); font-style: italic; border-top: 3px double var(--ink); }

/* On this day. */
.hx-today { max-width: 760px; margin: 18px auto 0; text-align: center; font: 19px/1.45 var(--fell); border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 10px 14px; }
.hx-today b { font: 18px var(--fell-sc); color: var(--rust); font-weight: 400; letter-spacing: .04em; }
.hx-today button { font: italic 18px var(--fell); color: var(--rust); background: none; border: 0; cursor: pointer; text-decoration: underline; }

/* The century rail (right) and the map (bottom left), on wide screens only. */
.hx-rail, .hx-map { display: none; }
@media (min-width: 1180px) {
  .hx-rail { display: flex; flex-direction: column; gap: 4px; position: fixed; right: 6px; top: 50%; transform: translateY(-50%); z-index: 3; }
  .hx-rail button { font: 14px var(--fell-sc); color: var(--faded); background: rgba(243, 236, 221, .85); border: 1px solid rgba(58, 34, 25, .25); width: 40px; padding: 5px 0; cursor: pointer; }
  .hx-rail button[aria-current="true"] { color: #f3ecdd; background: var(--ink); border-color: var(--ink); }
  .hx-rail button[hidden] { display: none; }
  .hx-map { display: block; position: fixed; left: 14px; bottom: 14px; width: 320px; z-index: 3; background: rgba(243, 236, 221, .94); border: 1px solid var(--ink); box-shadow: 0 10px 24px rgba(58, 34, 25, .18); padding: 10px 12px; }
  .hx-map[hidden] { display: none; }
  .hx-map-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font: 15px var(--fell-sc); letter-spacing: .04em; }
  .hx-map-now { font: italic 15px var(--fell); letter-spacing: 0; color: var(--rust); }
  .hx-map-toggle { font: 12px var(--type); background: none; border: 1px solid var(--ink); color: var(--ink); padding: 2px 8px; cursor: pointer; }
  .hx-map svg { display: block; width: 100%; height: auto; margin-top: 6px; }
  .hx-land { fill: #e3d3b2; stroke: #8a6a4a; stroke-width: .35; }
  .hx-route { fill: none; stroke: var(--rust); stroke-width: .9; stroke-dasharray: 2.5 2; }
  .hx-pin { fill: #f3ecdd; stroke: var(--faded); stroke-width: .7; transition: r .4s; }
  .hx-pin.past { fill: var(--ink); stroke: var(--ink); }
  .hx-pin.now { fill: var(--rust); stroke: #f3ecdd; stroke-width: 1; }
  .hx-map-cap { font: 13px var(--type); color: var(--faded); margin: 4px 0 0; }
}
