/* Grofica: three countesses of Celje. Self-hosted type (OFL), no external requests. */

@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(../fonts/cinzel-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Cinzel'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(../fonts/cinzel-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400 800; font-display: swap; src: url(../fonts/eb-garamond-italic-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'EB Garamond'; font-style: italic; font-weight: 400 800; font-display: swap; src: url(../fonts/eb-garamond-italic-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/eb-garamond-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'EB Garamond'; font-style: normal; font-weight: 400 800; font-display: swap; src: url(../fonts/eb-garamond-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* night azure and gold: the colours of the Celje arms */
  --bg: #0b1424; --bg-2: #101c33; --ink: #efe6d1; --mute: #b3a98f; --gold: #dcb04e; --gold-hi: #f2d283;
  --azure: #1c3a75; --azure-hi: #2b55a3; --rule: rgba(220, 176, 78, .32); --plate-bg: #0e1a30;
  --b: #dcb04e; --v: #d98a8a; --k: #8fb6e8;   /* one colour per countess, used for the timeline only */
  --serif: "EB Garamond", Garamond, "Times New Roman", serif; --caps: "Cinzel", "Trajan Pro", serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3ead6; --bg-2: #ebdfc4; --ink: #1d1913; --mute: #5c5244; --gold: #8a6210; --gold-hi: #a87a17;
    --azure: #1f3c7a; --azure-hi: #2a50a0; --rule: rgba(138, 98, 16, .35); --plate-bg: #efe4cc;
    --b: #8a6210; --v: #9b3b3b; --k: #2a5aa0;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1.22rem/1.62 var(--serif); font-kerning: normal;
  font-variant-ligatures: common-ligatures; text-rendering: optimizeLegibility; }
.defs { position: absolute; }
a { color: var(--gold-hi); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--ink); }
a:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 2px; }
i { font-style: italic; }
h1, h2, h3, .label, .kicker, .acts { font-family: var(--caps); font-weight: 500; letter-spacing: .08em; }
h2 { font-size: clamp(1.9rem, 4.2vw, 2.7rem); line-height: 1.15; margin: .1em 0 .7em; font-weight: 700; }
.label { margin: 0; color: var(--gold); font-size: .8rem; letter-spacing: .28em; text-transform: uppercase; }
main > *, footer { width: min(100% - 32px, 46rem); margin-inline: auto; }

/* the gold thread across the top: how far through the story you are (browsers with scroll-driven animations) */
.thread { position: fixed; inset: 0 0 auto; height: 2px; background: var(--gold); transform-origin: 0 50%; transform: scaleX(0); z-index: 5; }
@supports (animation-timeline: scroll()) {
  .thread { animation: thread linear both; animation-timeline: scroll(root); }
  @keyframes thread { to { transform: scaleX(1); } }
}
@supports not (animation-timeline: scroll()) { .thread { display: none; } }

/* ---------- hero ---------- */
/* the other language, top right */
.lang { position: absolute; top: 18px; right: 22px; margin: 0; font: 600 .76rem/1 var(--caps); letter-spacing: .22em; text-transform: uppercase; }
.lang a { color: var(--mute); text-decoration: none; padding: 8px 2px; border-bottom: 1px solid var(--rule); }
.lang a:hover { color: var(--gold-hi); border-color: var(--gold); }
.hero { position: relative; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 72px 16px 56px; background: radial-gradient(60% 50% at 50% 38%, color-mix(in srgb, var(--azure) 55%, transparent), transparent 70%); }
.arms { width: clamp(150px, 22vw, 210px); height: auto; overflow: visible; filter: drop-shadow(0 18px 40px rgba(0, 0, 0, .35)); }
.shield { fill: var(--azure); }
.shield-edge { fill: none; stroke: var(--gold); stroke-width: 1.4; opacity: .8; }
.arms .s, .stars .s { fill: var(--gold-hi); }
@media (prefers-color-scheme: light) {
  .arms .s { fill: #e9c25c; } .shield-edge { stroke: #e9c25c; }
  .hero { background: radial-gradient(55% 45% at 50% 36%, rgba(31, 60, 122, .1), transparent 70%); }
  .arms { filter: drop-shadow(0 14px 24px rgba(31, 60, 122, .22)); }
}
@media (prefers-reduced-motion: no-preference) {
  .arms .s { opacity: 0; animation: rise .9s cubic-bezier(.2, .7, .2, 1) forwards; }
  .arms .s2 { animation-delay: .35s; } .arms .s3 { animation-delay: .7s; }
  @keyframes rise { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
}
.kicker { margin: 34px 0 0; color: var(--gold); font-size: .82rem; letter-spacing: .32em; text-transform: uppercase; }
h1 { margin: .12em 0 .18em; font-size: clamp(3.4rem, 12vw, 7.2rem); line-height: 1; font-weight: 700; letter-spacing: .1em; }
.lede { max-width: 30em; margin: 0 auto; font-size: clamp(1.2rem, 2.4vw, 1.45rem); font-style: italic; color: var(--mute); }
.acts { display: flex; gap: clamp(14px, 4vw, 44px); justify-content: center; flex-wrap: wrap; margin-top: 40px; font-size: .95rem; text-transform: uppercase; }
.acts a { color: var(--ink); text-decoration: none; display: grid; justify-items: center; gap: 4px; padding: 6px 4px; }
.acts a span { color: var(--gold); font-size: .78rem; letter-spacing: .2em; }
.acts a:hover { color: var(--gold-hi); }

/* ---------- prologue and engravings ---------- */
.prologue { padding: 72px 0 24px; }
.plate { margin: 40px 0 0; }
.plate.wide { grid-column: 1 / -1; }
.plate img { display: block; width: 100%; height: auto; border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: 5px;
  background: var(--plate-bg); mix-blend-mode: multiply; filter: sepia(.35) contrast(1.05); }
/* dark: the engraving becomes pale lines on the night background */
@media (prefers-color-scheme: dark) { .plate img { filter: invert(1) sepia(.45) brightness(.9) contrast(1.15); mix-blend-mode: screen; } }
.plate figcaption { margin-top: 16px; font-size: .95rem; line-height: 1.45; color: var(--mute); }

/* ---------- the years ---------- */
.years { padding: 56px 0 8px; width: min(100% - 32px, 66rem); }
/* fades out at the right edge while there is more to scroll to */
.years ol { mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); }
.years ol { list-style: none; margin: 18px 0 0; padding: 0 0 14px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(9.5rem, 1fr);
  gap: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.years li { scroll-snap-align: start; position: relative; padding: 26px 18px 0 0; font-size: .98rem; line-height: 1.35; color: var(--mute); border-top: 1px solid var(--rule); }
.years li::before { content: ""; position: absolute; top: -6px; left: 0; width: 9px; height: 9px; border: 1px solid var(--gold); background: var(--bg); transform: rotate(45deg); }
.years li.b::before { background: var(--b); border-color: var(--b); } .years li.v::before { background: var(--v); border-color: var(--v); }
.years li.k::before { background: var(--k); border-color: var(--k); }
.years b { display: block; font: 700 1.25rem/1 var(--caps); color: var(--ink); letter-spacing: .06em; margin-bottom: 6px; }

/* ---------- the three acts ---------- */
.act { display: grid; grid-template-columns: 190px 1fr; gap: 20px 44px; align-items: start; padding: 96px 0 24px; scroll-margin-top: 12px; }
.act.flip { grid-template-columns: 1fr 190px; }
.act.flip .seal { grid-column: 2; grid-row: 1; }
.act.flip .text { grid-column: 1; grid-row: 1; }
.seal { width: 100%; height: auto; position: sticky; top: 40px; }
.act:has(.plate) .seal { position: static; }   /* sticky would carry it down over the engraving below the text */
.seal .ring { fill: none; stroke: var(--gold); stroke-width: 1.5; } .seal .ring.thin { stroke-width: .8; opacity: .7; }
.seal .legend { font: 600 15px var(--caps); fill: var(--gold); letter-spacing: 0; }
.seal .initial { font: 700 76px var(--caps); fill: var(--ink); text-anchor: middle; }
.seal .mini { fill: var(--gold); }
.act h2 { margin-bottom: .55em; }
.act .first::first-letter { float: left; font: 700 3.6em/.82 var(--caps); color: var(--gold); margin: .06em .1em 0 0; }
.act p { margin: 0 0 1em; hyphens: auto; }
.aside { font-style: italic; color: var(--mute); }

/* ---------- epilogue and footer ---------- */
.epilogue { text-align: center; padding: 120px 0 96px; }
.stars { width: 150px; height: auto; margin-bottom: 26px; overflow: visible; }
.epilogue p:last-child { max-width: 32em; margin: 0 auto; }
footer { border-top: 1px solid var(--rule); padding: 36px 0 56px; font-size: .98rem; color: var(--mute); }
footer .draft { font-style: italic; margin: 0 0 26px; }
footer .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
footer h3 { font-size: .8rem; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); margin: 0 0 10px; }
footer ul { margin: 0; padding-left: 1.1em; }
footer li { margin-bottom: 6px; }
footer .sig { margin: 32px 0 0; font-size: .9rem; }

@media (max-width: 700px) {
  body { font-size: 1.14rem; }
  .act, .act.flip { grid-template-columns: 1fr; padding-top: 72px; }
  .act.flip .seal, .act.flip .text { grid-column: auto; grid-row: auto; }
  .seal { position: static; width: 150px; margin: 0 auto 6px; }
  .act .text { text-align: left; }
  footer .cols { grid-template-columns: 1fr; }
}
