/*
Theme Name: Geschichten
Theme URI: https://geschichten.ursula.philippi.ro/
Author: für Ursula Philippi
Description: Ein ruhiges, gut lesbares Lesethema für die gesammelten Zeitungsbeiträge von Ursula Philippi. Die Farb- und Schriftsprache folgt ursula.philippi.ro (Georgia, Ziegelrot #8E1F0D, warmes Papierweiß), ist aber auf großzügigere Typografie und mobiles Lesen hin überarbeitet.
Version: 1.0
Requires at least: 6.5
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: geschichten
Tags: blog, one-column, custom-colors, translation-ready
*/

/* ============================================================ tokens */

:root {
  /* Palette carried over from ursula.philippi.ro: brick red on warm paper.
     The greys are warmed slightly so nothing reads as cold blue-grey. */
  --paper:      #FDFBF7;
  --card:       #FFFFFF;
  --panel:      #F4F0E9;
  --ink:        #221F1C;
  --ink-soft:   #423C36;
  --muted:      #756B61;
  --muted-2:    #9A9089;
  --rule:       #E3DCD2;
  --rule-soft:  #EFE9E0;
  --accent:     #8E1F0D;
  --accent-hi:  #B3301A;

  --serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Three tracks, all driven from here:
       --measure  the prose column; stays near 70 characters at every size
       --lead     images and galleries, which may exceed the prose
       --list     the chronological index, which is not prose and can be wide
     They widen in steps rather than fluidly so the type scale and the column
     grow together — a 2560px monitor gets a bigger column *and* bigger text,
     not a 1000px line of 17px type. */
  --measure: 37rem;
  --lead:    37rem;
  --list:    37rem;
  --gutter: clamp(1rem, 4vw, 2rem);
}

@media (min-width: 64rem) {   /* ≥1024px */
  :root { --measure: 39rem; --lead: 46rem; --list: 50rem; }
}
@media (min-width: 90rem) {   /* ≥1440px */
  :root { --measure: 42rem; --lead: 54rem; --list: 60rem; }
}
@media (min-width: 120rem) {  /* ≥1920px */
  :root { --measure: 45rem; --lead: 62rem; --list: 68rem; }
}

/* ============================================================== base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  /* 17px on a phone, 19px on a laptop, ~21px on a large monitor - the original
     site's 13px was the single biggest readability problem. */
  font-size: clamp(1.0625rem, 0.99rem + 0.34vw, 1.3125rem);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; border: 0; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover, a:focus { color: var(--accent-hi); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2.5em auto;
  max-width: 8rem;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: .6em 1em;
  background: var(--accent);
  color: #fff;
  font-family: var(--sans);
  font-size: .9rem;
  text-decoration: none;
}
.skip-link:focus { left: .5rem; top: .5rem; color: #fff; }

/* ============================================================ layout */

.wrap {
  width: 100%;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* The index is a scannable list, not prose, so it gets the wide track. */
.wrap--list { max-width: calc(var(--list) + var(--gutter) * 2); }

/* An article page is as wide as its widest picture; the prose inside is pulled
   back to the measure, so photographs use the screen and lines do not. */
.wrap--article { max-width: calc(var(--lead) + var(--gutter) * 2); }
.wrap--article .post__head,
.wrap--article .post__body,
.wrap--article .source,
.wrap--article .post-nav,
.wrap--article .backlink,
.wrap--article .page-body {
  max-width: var(--measure);
  margin-inline: auto;
}

/* =========================================================== masthead */

.topbar {
  border-bottom: 1px solid var(--rule-soft);
  background: var(--panel);
  font-family: var(--sans);
  font-size: .8125rem;
}
.topbar__inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1.25rem;
  min-height: 2.25rem;
}
.topbar a {
  color: var(--muted);
  text-decoration: none;
}
.topbar a:hover { color: var(--accent); text-decoration: underline; }

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  text-align: center;
}
.masthead__inner { padding-block: clamp(1.75rem, 5vw, 3rem) clamp(1.25rem, 4vw, 2rem); }

.brand { display: inline-block; text-decoration: none; color: inherit; }
.brand__title {
  display: block;
  font-family: var(--serif);
  font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem);
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: .01em;
  color: var(--accent);
}
.brand:hover .brand__title { color: var(--accent-hi); }
.brand__sub {
  display: block;
  margin-top: .5rem;
  font-family: var(--sans);
  font-size: clamp(.8125rem, .75rem + .2vw, .9375rem);
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The thin double rule is the one ornament the theme allows itself; it echoes
   the printed-newspaper feel of the source material. */
.masthead__rule {
  width: 100%;
  max-width: 12rem;
  margin: 1.25rem auto 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  height: 3px;
}

.site-nav { margin-top: 1.25rem; }
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .35rem 1.5rem;
  margin: 0; padding: 0;
  list-style: none;
}
.site-nav a {
  font-family: var(--sans);
  font-size: .875rem;
  letter-spacing: .04em;
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover,
.site-nav .current-menu-item > a { color: var(--accent); }

/* ============================================================== intro */

.intro {
  margin-block: clamp(2rem, 5vw, 3rem) 0;
  text-align: center;
  color: var(--ink-soft);
}
.intro p {
  margin: 0 auto;
  max-width: 32rem;
  font-size: 1.0625em;
  font-style: italic;
  line-height: 1.65;
}
.intro__count {
  margin-top: 1rem;
  font-family: var(--sans);
  font-style: normal;
  font-size: .8125rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* Compact jump-list of years on the front page. */
.yearjump {
  margin: 1.75rem auto 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .4rem .5rem;
  max-width: 34rem;
}
.yearjump a {
  font-family: var(--sans);
  font-size: .8125rem;
  line-height: 1;
  padding: .45em .7em;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  background: var(--card);
}
.yearjump a:hover { color: var(--accent); border-color: var(--accent); }

/* ========================================================= post list */

.postlist { margin-block: clamp(2rem, 5vw, 3.25rem) 0; }

.year-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0 1.5rem;
  font-family: var(--sans);
  font-size: .875rem;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--muted-2);
  scroll-margin-top: 1rem;
}
.year-head::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--rule);
}
.postlist > .year-head:first-child { margin-top: 0; }

/* Grid rather than flex so the date can move into its own column on wide
   screens without reordering the markup. */
.post-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "date main-thumb"
    "main main-thumb";
  column-gap: 1.25rem;
  align-items: start;
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule-soft);
}
.post-item:last-child { border-bottom: 0; }

.post-item__date  { grid-area: date; }
.post-item__main  { grid-area: main; min-width: 0; }
.post-item__thumb { grid-area: main-thumb; }

.post-item__date {
  margin: 0 0 .3rem;
  font-family: var(--sans);
  font-size: .78125rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted-2);
}

.post-item__title {
  margin: 0;
  font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem);
  line-height: 1.3;
  font-weight: 400;
}
.post-item__title a { color: var(--accent); text-decoration: none; }
.post-item__title a:hover { color: var(--accent-hi); text-decoration: underline; }

.post-item__sub {
  margin: .3rem 0 0;
  font-style: italic;
  color: var(--muted);
  line-height: 1.45;
}

.post-item__byline {
  margin: .3rem 0 0;
  font-family: var(--sans);
  font-size: .75rem;
  letter-spacing: .04em;
  color: var(--muted-2);
}

.post-item__teaser {
  margin: .55rem 0 0;
  color: var(--ink-soft);
  font-size: .9375em;
  line-height: 1.62;
}

.post-item__thumb {
  flex: 0 0 auto;
  width: 122px;
  display: block;
  line-height: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--panel);
}
.post-item__thumb img {
  display: block;
  width: 100%;
  height: 92px;
  object-fit: cover;
  transition: opacity .15s ease;
}
.post-item__thumb:hover img { opacity: .85; }

/* Phones: one column, picture first. */
@media (max-width: 34rem) {
  .post-item {
    grid-template-columns: 1fr;
    grid-template-areas: "main-thumb" "date" "main";
    row-gap: .8rem;
  }
  .post-item__thumb { width: 100%; }
  .post-item__thumb img { height: 170px; }
}

/* Wide screens: a newspaper index — date rail, text, picture. */
@media (min-width: 64rem) {
  .post-item {
    grid-template-columns: 8.5rem minmax(0, 1fr) auto;
    grid-template-areas: "date main main-thumb";
    column-gap: 2rem;
    padding-block: 1.75rem;
  }
  .post-item__date {
    margin: 0;
    padding-top: .45rem;
    text-align: right;
  }
  .post-item__thumb { width: 168px; }
  .post-item__thumb img { height: 118px; }
  /* The title may run the full column, but the teaser is prose and stops. */
  .post-item__teaser { max-width: 40rem; }
}

/* ============================================================ article */

.post { margin-block: clamp(2rem, 5vw, 3rem) 0; }

.post__head { margin-bottom: 2rem; }

.post__kicker {
  margin: 0 0 .75rem;
  font-family: var(--sans);
  font-size: .78125rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.post__kicker a { color: inherit; text-decoration: none; }
.post__kicker a:hover { color: var(--accent); text-decoration: underline; }

.post__title {
  margin: 0;
  font-size: clamp(1.75rem, 1.35rem + 1.9vw, 2.5rem);
  line-height: 1.2;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -.005em;
}

.post__sub {
  margin: .6rem 0 0;
  font-size: clamp(1.0625rem, 1rem + .35vw, 1.25rem);
  font-style: italic;
  line-height: 1.4;
  color: var(--muted);
}

/* Only appears on the handful of pieces that are not hers alone. */
.post__byline {
  margin: .75rem 0 0;
  font-family: var(--sans);
  font-size: .8125rem;
  letter-spacing: .04em;
  color: var(--muted);
}

.post__body > *:first-child { margin-top: 0; }
.post__body p { margin: 0 0 1.35em; }
.post__body p:last-child { margin-bottom: 0; }
.post__body strong { font-weight: 700; }
.post__body h2, .post__body h3 {
  margin: 2em 0 .6em;
  font-weight: 400;
  line-height: 1.3;
  color: var(--accent);
}
.post__body h2 { font-size: 1.4em; }
.post__body h3 { font-size: 1.18em; }
.post__body blockquote {
  margin: 1.8em 0;
  padding-left: 1.1em;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}
.post__body ul, .post__body ol { margin: 0 0 1.35em; padding-left: 1.3em; }
.post__body li { margin-bottom: .4em; }

/* First paragraph gets a touch more presence, like a printed lead. */
.post__body > p:first-of-type { font-size: 1.06em; color: var(--ink); }

/* ------------------------------------------------------------ figures */

figure { margin: 0; }

/* ADZ never publishes anything wider than ~800px, so the lead picture is sized
   to its own pixels and centred rather than stretched to the track — upscaling
   it to fill a large monitor only makes it soft. The figure shrink-wraps so the
   caption lines up with the image, not with the column. */
.post__lead {
  margin: 0 auto 2rem;
  width: fit-content;
  max-width: 100%;
}
.post__lead img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 3px;
  background: var(--panel);
}

figcaption {
  margin-top: .5rem;
  font-family: var(--sans);
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--muted);
}

.gallery-more { margin-top: 2.5rem; }
.gallery-more__head {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: .78125rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}
.gallery-grid figure { margin: 0; }
.gallery-grid img {
  display: block;
  width: 100%;
  height: 150px;
  /* contain, not cover: these are documentary photographs and scans of sheet
     music - cropping would cut away the very thing being shown. */
  object-fit: contain;
  border-radius: 3px;
  background: var(--panel);
}

/* Zoomable images */
a.zoom { display: block; line-height: 0; cursor: zoom-in; }
a.zoom:hover img { opacity: .88; }

/* ------------------------------------------------------------- source */

.source {
  margin-top: 2.75rem;
  padding: 1.15rem 1.35rem;
  background: var(--panel);
  border-left: 3px solid var(--accent);
  border-radius: 2px;
  font-family: var(--sans);
  font-size: .875rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.source p { margin: 0; }
.source p + p { margin-top: .5rem; }
.source__label {
  display: block;
  margin-bottom: .3rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------- post nav */

.post-nav {
  display: flex;
  gap: 1.25rem;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: .875rem;
}
.post-nav a { text-decoration: none; color: var(--muted); display: block; max-width: 20rem; }
.post-nav a:hover { color: var(--accent); }
.post-nav .nav-next { text-align: right; margin-left: auto; }
.post-nav .nav-label {
  display: block;
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: .2rem;
}
.post-nav .nav-title { color: var(--accent); }

.backlink {
  margin-top: 2.5rem;
  font-family: var(--sans);
  font-size: .875rem;
}
.backlink a { text-decoration: none; }
.backlink a:hover { text-decoration: underline; }

/* ============================================================== pages */

.page-body h2 { font-size: 1.4em; font-weight: 400; color: var(--accent); margin: 2em 0 .6em; }
.page-body p { margin: 0 0 1.35em; }

/* ============================================================= footer */

.site-footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding-block: 2rem 2.5rem;
  border-top: 1px solid var(--rule);
  background: var(--panel);
  font-family: var(--sans);
  font-size: .8125rem;
  line-height: 1.7;
  color: var(--muted);
  text-align: center;
}
.site-footer p { margin: 0 0 .4rem; }

/* Separators are drawn by CSS so the links wrap cleanly on a phone instead of
   leaving a stranded "·" at the start of a line. */
.site-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .15rem 0;
}
.site-footer__links a { padding-inline: .55rem; }
.site-footer__links a + a { border-left: 1px solid var(--rule); }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }

/* ============================================================= consent */

/* A quiet strip at the foot of the page, not a modal: it never covers the
   text, needs no overlay, and the reader can ignore it and keep reading. */
.consent {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 900;
  background: var(--card);
  border-top: 1px solid var(--rule);
  box-shadow: 0 -1px 12px rgba(34, 31, 28, .07);
  font-family: var(--sans);
  font-size: .8125rem;
  line-height: 1.5;
  color: var(--ink-soft);
}
.consent[hidden] { display: none; }

.consent__inner {
  /* Match the index track so the bar lines up with the content above it. */
  max-width: calc(var(--list) + var(--gutter) * 2);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.5rem;
  padding-block: .8rem;
}

.consent__text { margin: 0; max-width: 46ch; }
.consent__text a { color: var(--accent); }

.consent__actions {
  display: flex;
  gap: .5rem;
  flex: 0 0 auto;
}

/* Reject and accept get identical weight — a consent choice where refusing is
   visually harder than agreeing is not a choice. */
.consent__actions button {
  font: inherit;
  padding: .5em 1.1em;
  border: 1px solid var(--accent);
  border-radius: 3px;
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.consent__actions button:hover { background: var(--panel); }
.consent__actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 30rem) {
  .consent__inner { justify-content: stretch; }
  .consent__actions { width: 100%; }
  .consent__actions button { flex: 1 1 auto; }
}

/* ============================================================ lightbox */

body.lb-lock { overflow: hidden; }

.lb {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(.75rem, 3vw, 1.5rem);
  background: rgba(20, 18, 15, .94);
}
.lb.is-open { display: flex; }

.lb__fig {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .75rem;
  max-width: 100%;
  max-height: 100%;
}
.lb__img {
  max-width: 100%;
  max-height: calc(100vh - 8rem);
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 2px;
  background: #2a2622;
}
.lb__cap {
  max-width: 60ch;
  color: #EDE6DA;
  font-family: var(--sans);
  font-size: .8125rem;
  line-height: 1.5;
  text-align: center;
}
.lb button {
  position: absolute;
  padding: .6rem .75rem;
  background: none;
  border: 0;
  border-radius: 4px;
  color: #F5F0E7;
  line-height: 1;
  cursor: pointer;
  font-family: var(--sans);
}
.lb button:hover { background: rgba(255,255,255,.12); color: #fff; }
.lb button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lb__close { top: .5rem; right: .75rem; font-size: 2rem; }
.lb__prev  { left: .25rem;  font-size: 2.5rem; }
.lb__next  { right: .25rem; font-size: 2.5rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ============================================================= print */

@media print {
  .topbar, .site-nav, .post-nav, .site-footer, .backlink, .lb, .consent { display: none !important; }
  body { background: #fff; font-size: 11pt; }
  .post__title, .post-item__title a { color: #000; }
  a { text-decoration: none; color: #000; }
  .source { border-left: 0; background: none; padding-left: 0; }
}
