/* ===== LIGHT DARK MODE =====
   Flexoki colour palette: https://stephango.com/flexoki
   Three states, not two: an explicit choice (the footer switcher)
   stamps data-theme="dark"/"light" on <html> and wins outright; with
   no explicit choice, the OS preference decides via the media query;
   :root itself is the light values, the default when neither applies.
   The switcher's own JS is in _footer.php, the flash-of-wrong-theme
   guard in _head.php. Jonny, 2026-09-19: "light/dark mode switcher in
   a footer." */

:root {
  color-scheme: light dark;
  --bg: #FFFCF0;
  --bg-2: #F2F0E5;
  --text: #100F0F;
  --text-2: #6F6E69;
  --re: #D14D41; /* Red */
  --or: #AF3029; /* Orange */
  --ye: #C0A062; /* Yellow */
  --gr: #689468; /* Green */
  --cy: #24837B; /* Cyan */
  --bl: #205EA6; /* Blue */
  --pu: #5E409D; /* Purple */
  --ma: #A02F6F; /* Magenta */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #100F0F;
    --bg-2: #1C1B1A;
    --text: #CECDC3;
    --text-2: #9a9a96;
    --re: #E67763;
    --or: #D14D41;
    --ye: #D4B064;
    --gr: #8AA872;
    --cy: #3AA99F;
    --bl: #4385BE;
    --pu: #8B7EC8;
    --ma: #CE5D97;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #100F0F;
  --bg-2: #1C1B1A;
  --text: #CECDC3;
  --text-2: #9a9a96;
  --re: #E67763;
  --or: #D14D41;
  --ye: #D4B064;
  --gr: #8AA872;
  --cy: #3AA99F;
  --bl: #4385BE;
  --pu: #8B7EC8;
  --ma: #CE5D97;
}


body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Averia', Verdana, sans-serif;
}



/* ===== RESET AND GRID ===== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Section: Full-width wrapper */
.section {
  width: 100%;
  padding: 2rem 0;
}

/* Container: Centered content with max-width */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Row: Flex container for columns */
.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.5rem;
  
}

/* Column: Single column with padding and max-width */
.col {
  padding: 0 0.5rem;
  max-width: 800px;
  width: 100%;
}

/* Column sizes for medium screens and up */
@media (min-width: 768px) {
  .col-md-4 {
    flex: 0 0 33.333333%;
    max-width: 33.333333%;
  }
   .col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .col-md-8 {
    flex: 0 0 66.666667%;
    max-width: 66.666667%;
  }
}



@font-face {
  font-family: 'Averia';
  src: url('./fonts/AveriaSerifLibre-Regular.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Averia';
  src: url('./fonts/AveriaSerifLibre-Bold.ttf') format('truetype');
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Averia';
  src: url('./fonts/AveriaSerifLibre-Italic.ttf') format('truetype');
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

/* Nav list with no bullets*/
.nav {
  list-style-type: none;
  padding-left: 0;
  margin-left: 0;
}
/* Same belt-and-braces as .writings-grid-item above: set on the li
   directly too, not just relied on as inherited from .nav. */
.nav li {
  list-style-type: none;
}
.nav li:last-child {
  margin-top: 4rem;
}

/* Reapply margins for typography AFTER the reset */
h1, h2, h3, h4, h5, h6 {
  margin-bottom: 1em;
  line-height: 1.2;
}

h1 {
  font-size: 2rem
}

/* Text balance: Ensures text wraps nicely in the column */
.text-balance {
  text-wrap: balance; /* Modern browsers support this for better text wrapping */
}


.poemh1 {
 display: inline-block;
  vertical-align: bottom;
}

p {
  font-size: 1.2rem;
  margin-bottom: 1em;
  line-height: 1.3;
}

.poem {
  padding-top:0.8rem;
  display: inline-block;
  vertical-align: bottom;
}

ol, ul {
  margin-bottom: 1em;
  padding-left: 1.5em;
}

ol ol, ul ul, ol ul, ul ol {
  margin-bottom: 0.5em;
}

li {
  margin-bottom: 0.25em;
  line-height: 1.5;
}

/* ===== LINKS ===== */
a {
  color: var(--bl);
  text-decoration: underline;
}

a:hover {
  color: var(--re);
}

a:visited {
  color: var(--pu);
}

/* ==== SONG LYRICS ==== */
/* Chords sit over the word they belong to. Each chord+word is an inline-block
   chunk, so wrapped lines keep chords with their words. The hidden ::before
   copy of the chord makes a chunk at least as wide as its chord, so two
   chords close together never overlap. Chords stay in reading order. */

.song-sheet {
  font-size: 1.2rem;
  line-height: 1.4;
}
@media (min-width: 768px) {
  .song-sheet { font-size: 1.25rem; }
}
.song-stanza {
  margin: 0 0 1.6em;
}
.song-line {
  display: block;
  padding-top: 1.3em;
  margin: 0;
}
.song-note {
  font-style: italic;
  color: var(--text-2);
}
.song-chunk {
  display: inline-block;
  position: relative;
  white-space: nowrap;
  vertical-align: baseline;
}
.song-chunk::before {
  content: attr(data-chord);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  font-size: 0.85em;
  font-weight: 700;
  padding-right: 0.2em;
}
.song-chunk-bare {
  min-width: 1.5em;
}
.chord {
  position: absolute;
  left: 0;
  bottom: 100%;
  margin-bottom: 0.05em;
  font-size: 0.85em;
  font-weight: 700;
  line-height: 1.2;
  color: var(--bl);
  white-space: nowrap;
}
.song-sheet.chords-hidden .chord,
.song-sheet.chords-hidden .song-note,
.song-sheet.chords-hidden .song-chunk::before { display: none; }
.song-sheet.chords-hidden .song-line { padding-top: 0; margin-bottom: 0.4em; }
.song-sheet.chords-hidden .song-chunk { display: inline; }

.song-side {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}
.chords-toggle,
.photo-close {
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: 1px solid var(--text-2);
  border-radius: 0.35rem;
  padding: 0.4rem 0.8rem;
  color: var(--text);
  cursor: pointer;
}
.chords-toggle:hover,
.photo-close:hover { border-color: var(--text); }
.chords-toggle:focus-visible,
.photo-open:focus-visible,
.photo-close:focus-visible { outline: 2px solid var(--bl); outline-offset: 2px; }

/* Photo thumbnail that opens the dialog */
.photo-open {
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-2);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  max-width: 10rem;
}
.photo-open img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 0.35rem;
}
.photo-open:hover .photo-open-label { color: var(--text); text-decoration: underline; }

.song-listen h2 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-2);
  margin: 0 0 0.35rem;
}
.song-listen ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.95rem;
}

.photo-dialog {
  margin: auto; /* the site reset zeroes margins; keep the dialog centred */
  border: none;
  border-radius: 0.5rem;
  padding: 0.75rem;
  background: var(--bg);
  color: var(--text);
  max-width: min(92vw, 1600px);
  max-height: 92vh;
  box-sizing: border-box;
}
.photo-dialog::backdrop { background: rgba(16, 15, 15, 0.8); }
.photo-dialog-bar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.5rem;
}
.photo-close { font-size: 1.25rem; line-height: 1; padding: 0.2rem 0.6rem; }
.photo-dialog img {
  display: block;
  max-width: 100%;
  max-height: calc(92vh - 4.5rem);
  width: auto;
  height: auto;
  margin: 0 auto;
}

@media print {
  .chords-toggle, .photo-open { display: none; }
  .song-sheet.chords-hidden .chord { display: block; }
  .song-sheet.chords-hidden .song-note { display: block; }
}

/* ==== SPACING ==== */

./* Padding: Top */
.pt-0 { padding-top: 0; }
.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pt-5 { padding-top: 1.25rem; }
.pt-6 { padding-top: 1.5rem; }
.pt-8 { padding-top: 2rem; }
.pt-10 { padding-top: 2.5rem; }
.pt-12 { padding-top: 3rem; }

/* Padding: Right */
.pr-0 { padding-right: 0; }
.pr-1 { padding-right: 0.25rem; }
.pr-2 { padding-right: 0.5rem; }
.pr-3 { padding-right: 0.75rem; }
.pr-4 { padding-right: 1rem; }
.pr-5 { padding-right: 1.25rem; }
.pr-6 { padding-right: 1.5rem; }
.pr-8 { padding-right: 2rem; }
.pr-10 { padding-right: 2.5rem; }
.pr-12 { padding-right: 3rem; }

/* Padding: Bottom */
.pb-0 { padding-bottom: 0; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 0.75rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-5 { padding-bottom: 1.25rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pb-8 { padding-bottom: 2rem; }
.pb-10 { padding-bottom: 2.5rem; }
.pb-12 { padding-bottom: 3rem; }

/* Padding: Left */
.pl-0 { padding-left: 0; }
.pl-1 { padding-left: 0.25rem; }
.pl-2 { padding-left: 0.5rem; }
.pl-3 { padding-left: 0.75rem; }
.pl-4 { padding-left: 1rem; }
.pl-5 { padding-left: 1.25rem; }
.pl-6 { padding-left: 1.5rem; }
.pl-8 { padding-left: 2rem; }
.pl-10 { padding-left: 2.5rem; }
.pl-12 { padding-left: 3rem; }

/* Padding: All sides */
.p-0 { padding: 0; }
.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.p-12 { padding: 3rem; }

/* Padding: Horizontal (left + right) */
.px-0 { padding-left: 0; padding-right: 0; }
.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

/* Padding: Vertical (top + bottom) */
.py-0 { padding-top: 0; padding-bottom: 0; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }

/* Margin: Top */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mt-10 { margin-top: 2.5rem; }
.mt-12 { margin-top: 3rem; }

/* Margin: Right */
.mr-0 { margin-right: 0; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 0.75rem; }
.mr-4 { margin-right: 1rem; }
.mr-5 { margin-right: 1.25rem; }
.mr-6 { margin-right: 1.5rem; }

/* Margin: Bottom */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-12 { margin-bottom: 3rem; }

/* Margin: Left */
.ml-0 { margin-left: 0; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 0.75rem; }
.ml-4 { margin-left: 1rem; }
.ml-5 { margin-left: 1.25rem; }
.ml-6 { margin-left: 1.5rem; }

/* Margin: All sides */
.m-0 { margin: 0; }
.m-1 { margin: 0.25rem; }
.m-2 { margin: 0.5rem; }
.m-3 { margin: 0.75rem; }
.m-4 { margin: 1rem; }
.m-5 { margin: 1.25rem; }
.m-6 { margin: 1.5rem; }

/* Margin: Horizontal (left + right) */
.mx-0 { margin-left: 0; margin-right: 0; }
.mx-1 { margin-left: 0.25rem; margin-right: 0.25rem; }
.mx-2 { margin-left: 0.5rem; margin-right: 0.5rem; }
.mx-3 { margin-left: 0.75rem; margin-right: 0.75rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }

/* Margin: Vertical (top + bottom) */
.my-0 { margin-top: 0; margin-bottom: 0; }
.my-1 { margin-top: 0.25rem; margin-bottom: 0.25rem; }
.my-2 { margin-top: 0.5rem; margin-bottom: 0.5rem; }
.my-3 { margin-top: 0.75rem; margin-bottom: 0.75rem; }
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }

/* Margin: Auto (for centering) */
.mx-auto { margin-left: auto; margin-right: auto; }


/* ==== TEXT ==== */

/* Text Balance (Modern browsers only) */
.text-balance {
  text-wrap: balance;
}

/* Fallback for older browsers (optional) */
.text-justify {
  text-align: justify;
}

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Font weights */
.font-normal { font-weight: normal; }
.font-bold { font-weight: bold; }
.font-light { font-weight: 300; }

/* Font styles */
.italic { font-style: italic; }
.not-italic { font-style: normal; }

/* Line height */
.leading-none { line-height: 1; }
.leading-tight { line-height: 1.25; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.625; }
.leading-loose { line-height: 2; }

/* Letter spacing */
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wide { letter-spacing: 0.025em; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.1em; }

/* Text transform */
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }
.normal-case { text-transform: none; }

/* Text decoration */
.underline { text-decoration: underline; }
.line-through { text-decoration: line-through; }
.no-underline { text-decoration: none; }

/* Text color (using your Flexoki palette) */
.text-bg { color: var(--bg); }
.text-text { color: var(--text); }
.text-re { color: var(--re); } /* Red */
.text-or { color: var(--or); } /* Orange */
.text-ye { color: var(--ye); } /* Yellow */
.text-gr { color: var(--gr); } /* Green */
.text-cy { color: var(--cy); } /* Cyan */
.text-bl { color: var(--bl); } /* Blue */
.text-pu { color: var(--pu); } /* Purple */
.text-ma { color: var(--ma); } /* Magenta */


/* Configuration for the masonry layout */
.masonry {
  background-color: #1C1B1A;
  padding-top: 1em;
  padding-bottom: 1em;
  --gutter: 1em;
  --flow-space: var(--gutter);
  --switcher-target-container-width: 25rem;
}



/* Ensure images fill their containers */
.masonry img {
  width: 100%;
}

/* Switcher layout (flexbox-based) */
.switcher {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gutter, 1em);
  align-items: var(--switcher-vertical-alignment, flex-start);
}

.switcher > * {
  flex-grow: 1;
  flex-basis: calc(
    (var(--switcher-target-container-width, 40rem) - 100%) * 999
  );
}

/* Flow layout (vertical spacing) */
.flow > * + * {
  margin-block-start: var(--flow-space, 1em);
}

/* Wrapper for centering and padding */
.wrapper {
  max-width: 80rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

S file */

/* ==== WRITINGS: card grid ====
   One <a> per card, wrapping the image, badge, title and date - real
   HTML content inside the anchor, not a positioned overlay, so there
   is one tab stop per post and the accessible name is the post title
   itself, never a repeated button label. */

/* No display:grid any more - this is .row/.col now, the same layout
   every other template on this site uses. Jonny, 2026-09-20: "I
   almost never use grid, flexbox with bootstrap style works
   absolutely fine for cards... now we know what the problem is you
   can fix it." .row/.col (defined near the top of this file) already
   give the flex-wrap, the side gutters and the 768px column
   breakpoint; .writings-grid/.writings-grid-item only add what those
   don't cover - the list reset and vertical spacing between wrapped
   rows. */

/* Plain <div>s now, not <ul>/<li> - see writing-index.php's own
   comment. No list-style properties needed any more, a <div> never
   had a marker to suppress in the first place. */

/* Vertical spacing between wrapped rows is the mb-8 utility class in
   the markup now (Jonny, 2026-09-20, recalling Versoly: "the row
   needs a gap of mb-8") - same 2rem this rule used to hardcode, real
   margin rather than a grid gap either way. A screenshot with a
   visible card border proved the earlier CSS-grid version of this
   had zero pixels between cards on a real phone, gap wasn't taking
   effect for row spacing there ("the border is there... but no
   gap"). .writings-grid-item stays as a hook for anything specific
   to these cards that isn't just spacing. */

.card-link {
  display: block;
  color: var(--text);
  text-decoration: none;
  border-radius: 0.5rem;
  overflow: hidden;
  background: var(--bg-2);
  height: 100%;
  /* --bg and --bg-2 are close enough in tone that a real gap between
     cards can be hard to see, not just a layout question - a visible
     edge makes each card's boundary unambiguous either way. */
  border: 1px solid light-dark(#dbdbda, #43423f);
}

.card-link img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.card-link-body {
  display: block;
  padding: 1rem 1.25rem 1.25rem;
}

.card-link-title {
  display: block;
  font-weight: bold;
  font-size: 1.15rem;
  line-height: 1.3;
  margin-top: 0.5rem;
  margin-bottom: 0.4rem;
}

.card-link time {
  display: block;
  font-size: 0.95rem;
  color: var(--text-2);
}

.card-link:hover .card-link-title {
  text-decoration: underline;
}

.card-link:focus-visible {
  outline: 3px solid var(--bl);
  outline-offset: 2px;
}

.badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--bl);
}

.writing-figure {
  margin: 1.5rem 0;
}

.writing-figure img {
  width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.writing-figure figcaption {
  font-size: 0.95rem;
  color: var(--text-2);
  margin-top: 0.5rem;
}

/* ==== POEMS: r80's own markup, ported ====
   poem-body/poem-line/poem-gap, straight from roughly80poems.co.uk's
   poems.css, re-mapped onto this site's own Flexoki tokens instead of
   r80's variable names. No --indent modifier - r80's is applied by
   hand against each poem's printed source book, and there's no such
   source for Jonny's own unpublished poems. No line numbers or notes
   either - dropped the same day they were added (Jonny, 2026-09-19:
   "we won't need those"). */

.poem-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 768px) {
  .poem-body { font-size: 1.25rem; }
}

.poem-line {
  white-space: pre-wrap;
  text-indent: -1em;
  padding-left: 1em;
  margin: 0 0 0.4em;
  line-height: 1.4;
}

.poem-gap { height: 1em; }

/* ==== FOOTER: the light/dark/system switcher ==== */

.site-footer {
  /* Vertical rhythm now comes from the .section it wraps, same as
     everywhere else - only what's genuinely footer-specific stays
     here. */
  margin-top: 3rem;
  border-top: 1px solid var(--bg-2);
}

.footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}
.footer-nav a {
  font-size: 1.1rem;
}

.theme-switcher {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  background: var(--bg-2);
  border-radius: 0.5rem;
}

.theme-btn {
  font: inherit;
  font-size: 0.85rem;
  background: none;
  border: none;
  border-radius: 0.35rem;
  padding: 0.4rem 0.8rem;
  color: var(--text-2);
  cursor: pointer;
}

.theme-btn:hover { color: var(--text); }
.theme-btn:focus-visible { outline: 2px solid var(--bl); outline-offset: 2px; }
.theme-btn[aria-pressed="true"] {
  background: var(--bg);
  color: var(--text);
  font-weight: bold;
} 
