@font-face {
    font-family: "Michroma";
    src: url("/static/fonts/Michroma-Regular.8ec1f1c2b4c0.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/*
 * SIMORGH — moving-paper home with centred interactive hero
 *
 * Current layout:
 *   #hero  -> fixed interactive hero in the central diamond
 *   #intro -> top-left paper
 *   #swarm -> top-right paper
 *   #log   -> bottom-right paper
 *   #me    -> bottom-left paper
 */

:root {
    --paper-gap: clamp(10px, 1.25vw, 20px);
    --paper-padding: clamp(1.5rem, 4vw, 4.5rem);

    --paper-rest-offset: 52%;
    --paper-rest-angle: 27deg;

    --paper-time: 850ms;
    --paper-ease: cubic-bezier(.16, 1, .3, 1);

    --paper-border: rgb(0 0 0 / .09);
    --paper-shadow-rest: 0 12px 35px rgb(0 0 0 / .18);
    --paper-shadow-open: 0 32px 90px rgb(0 0 0 / .30);

    --paper-intro: #243b80;
    --paper-swarm: #69bbb5;
    --paper-log:   #183c49;
    --paper-me:    #c59448;

    /* Hero/game sizing. Keep this smaller than the central diamond. */
    --hero-width: min(42vw, 38rem);
    --hero-max-height: min(68svh, 36rem);

    /* Game colours consumed by game.js when it reads CSS variables. */
    --swarm-background: #f5f2ea;
    --swarm-foreground: #282824;
    --swarm-robot-color: #b46a45;
    --swarm-obstacle-color: #77756d;
    --swarm-explored-color: rgba(98, 126, 108, .30);
}


/* ================================================================
   PAGE / STAGE
   ================================================================ */

#main {
    position: relative;
    z-index: 1;
}

#main-content {
    position: relative;
    height: 100svh;
    min-height: 38rem;
    overflow: hidden;
    isolation: isolate;
    background: #f4efdf;
    perspective: 1400px;
}


/* ================================================================
   CENTRE HERO
   ================================================================ */

/*
 * The hero is NOT a paper. It stays centred while the four surrounding
 * sheets move around it. Keeping it below the papers means the sheets
 * naturally hide any part of the hero outside the central opening.
 */
#hero.home-section--hero {
    position: absolute;
    inset: 50% auto auto 50%;
    width: var(--hero-width);
    max-width: calc(100vw - 4rem);
    max-height: var(--hero-max-height);

    box-sizing: border-box;
    transform: translate(-50%, -50%);

    z-index: 1;
    overflow: visible;
    border: 0;
    box-shadow: none;
    background: transparent;
    cursor: default;
}

/* Current hero markup deliberately uses the BEM double-underscore name. */
#hero > .home-section__content {
    width: 100%;
    height: auto;
    padding: 0;
    overflow: visible;
}

#hero .block-swarm_playground,
#hero .w-block-swarm_playground {
    width: 100%;
    margin: 0;
}


/* ================================================================
   GAME / SWARM PLAYGROUND
   ================================================================ */

/*
 * Important: none of these elements is allowed to inherit a viewport-
 * filling height. The component sizes itself from the canvas + controls.
 */
#hero .swarm-playground {
    width: 100%;
    height: auto;
    max-height: var(--hero-max-height);
    margin: 0;
    padding: 0;

    display: block;
    box-sizing: border-box;
}

#hero .swarm-playground__stage {
    width: 100%;
    height: auto;
    min-height: 0;

    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: .65rem;

    box-sizing: border-box;
    overflow: visible;
}

/*
 * The canvas, rather than the stage, defines the actual game-screen size.
 * aspect-ratio prevents browser-height changes from stretching it vertically.
 */
#hero .swarm-playground__canvas {
    display: block;
    flex: 0 0 auto;

    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    max-height: calc(var(--hero-max-height) - 4rem);

    box-sizing: border-box;
    border: 1px solid rgb(0 0 0 / .16);
    border-radius: .65rem;
    background: var(--swarm-background);
}

/* Controls stay immediately below the canvas and never stretch vertically. */
#hero .swarm-playground__controls {
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
    width: 100%;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    align-content: center;
    gap: .55rem .85rem;

    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

#hero .swarm-playground__release,
#hero .swarm-playground__controls button {
    flex: 0 0 auto;
    width: auto;
    min-width: 0;
    height: auto;

    margin: 0;
    padding: .55rem .85rem;
    line-height: 1.15;
}

#hero .swarm-playground__status,
#hero .swarm-playground__timer {
    flex: 0 1 auto;
    width: auto;
    min-width: 0;
    height: auto;
    margin: 0;
    line-height: 1.25;
}


/* ================================================================
   THE FOUR MOVING PAPERS
   ================================================================ */

/* Do not apply this geometry to the hero. */
#main-content > .home-section:not(.home-section--hero) {
    position: absolute;
    inset: var(--paper-gap);
    box-sizing: border-box;
    overflow: hidden;

    border: 1px solid var(--paper-border);
    box-shadow: var(--paper-shadow-rest);

    transform:
        translate3d(var(--rest-x), var(--rest-y), 0)
        rotate(var(--rest-r));

    transform-origin: center center;

    transition:
        transform var(--paper-time) var(--paper-ease),
        box-shadow var(--paper-time) var(--paper-ease);

    will-change: transform;
    z-index: 2;
    cursor: default;
}

/* Top-left */
#intro {
    --rest-x: calc(0% - var(--paper-rest-offset));
    --rest-y: calc(0% - var(--paper-rest-offset));
    --rest-r: calc(0deg - var(--paper-rest-angle));
    background: var(--paper-intro);
}

/* Top-right */
#swarm {
    --rest-x: var(--paper-rest-offset);
    --rest-y: calc(0% - var(--paper-rest-offset));
    --rest-r: var(--paper-rest-angle);
    background: var(--paper-swarm);
}

/* Bottom-right */
#log {
    --rest-x: var(--paper-rest-offset);
    --rest-y: var(--paper-rest-offset);
    --rest-r: calc(0deg - var(--paper-rest-angle));
    background: var(--paper-log);
}

/* Bottom-left */
#me {
    --rest-x: calc(0% - var(--paper-rest-offset));
    --rest-y: var(--paper-rest-offset);
    --rest-r: var(--paper-rest-angle);
    background: var(--paper-me);
}


/* ================================================================
   CONTENT INSIDE THE PAPERS
   ================================================================ */

#main-content > .home-section:not(.home-section--hero) .home-section-content {
    position: absolute;
    inset: 0;
    box-sizing: border-box;
    overflow: auto;

    padding:
        clamp(7rem, 15svh, 10rem)
        var(--paper-padding)
        var(--paper-padding);
}

#main-content > .home-section:not(.home-section--hero) .block-heading_block {
    position: absolute;
    z-index: 2;
    margin: 0;
    width: min(38vw, 34rem);

    transition:
        top var(--paper-time) var(--paper-ease),
        right var(--paper-time) var(--paper-ease),
        bottom var(--paper-time) var(--paper-ease),
        left var(--paper-time) var(--paper-ease),
        width var(--paper-time) var(--paper-ease);

    will-change: top, right, bottom, left;
}

#main-content > .home-section:not(.home-section--hero) h2 {
    margin: 0;
    line-height: 1.05;
    font-size: clamp(1rem, 1.6vw, 2rem);
}

#intro .block-heading_block {
    right: 26%;
    bottom: 7%;
    text-align: right;
}

#swarm .block-heading_block {
    left: 26%;
    bottom: 7%;
}

#log .block-heading_block {
    left: 26%;
    top: 7%;
}

#me .block-heading_block {
    right: 26%;
    top: 7%;
    text-align: right;
}

h2 {
    font-family: Michroma;
    color: #182c61;
}

#main-content > .home-section:not(.home-section--hero)
.home-section-content > :not(.block-heading_block) {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(1.25rem);

    transition:
        opacity 180ms ease,
        transform 320ms ease,
        visibility 0s linear 320ms;
}

/* ================================================================
 *   HERO IMAGE GAME BEHAVIOR
 *   ================================================================ */

/* Both alternatives occupy the same space */
.hero-visual {
  display: grid;
  align-items: center;
  min-width: 0;
}

.hero-robot,
.hero-game {
  grid-area: 1 / 1;
  width: 100%;
  min-width: 0;

  transition:
  opacity 350ms ease,
  visibility 350ms ease;
}

/* Default: robot visible, game hidden */
.hero-game {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* When the existing JS activates game mode */
#hero.is-game-visible .hero-robot {
opacity: 0;
visibility: hidden;
pointer-events: none;
}

#hero.is-game-visible .hero-game {
opacity: 1;
visibility: visible;
pointer-events: auto;
}

/* Optional: don't keep animating an invisible robot */
#hero.is-game-visible .hero-robot img {
animation-play-state: paused;
}


/* ================================================================
   HOPOOE CANVAS INSIDE THE SWARM PAPER
   ================================================================ */

#home-section-effect-canvas-hoopoe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

#swarm .home-section-content {
    z-index: 1;
}


/* ================================================================
   OPEN / CLOSE CONTROLS
   ================================================================ */

/*
 * Opening a paper is now explicit. The whole sheet is deliberately not
 * clickable; only these controls advertise interaction.
 */
#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content,
#main-content > .home-section:not(.home-section--hero) >
.btn-close-home-section-content {
    position: absolute;
    z-index: 30;
    box-sizing: border-box;

    appearance: none;
    -webkit-appearance: none;
    font: inherit;
    line-height: 1;
    cursor: pointer;

    transition:
        opacity 180ms ease,
        transform 220ms var(--paper-ease),
        background-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease,
        visibility 0s linear 0s;
}

/*
 * A small "paper tab" on the visible inner edge of each resting sheet.
 * It remains printed on the paper, so it naturally shares its rotation.
 */
#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content {
    padding: .62rem .82rem .62rem .95rem;

    border: 1px solid rgb(0 0 0 / .24);
    border-radius: 999px;
    background: #fff5dc;
    color: #182c61;

    box-shadow:
        0 5px 16px rgb(0 0 0 / .10),
        inset 0 1px 0 rgb(255 255 255 / .55);

    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);

    font-size: clamp(.72rem, .82vw, .88rem);
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;

    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content::after {
    content: "↗";
    display: inline-block;
    margin-left: .55rem;
    font-size: 1.05em;
    transition: transform 220ms var(--paper-ease);
}

#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content:hover,
#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content:focus-visible {
    background: #ffffff;
    box-shadow:
        0 9px 24px rgb(0 0 0 / .15),
        inset 0 1px 0 rgb(255 255 255 / .75);
    transform: translateY(-2px);
    outline: none;
}

#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content:hover::after,
#main-content > .home-section:not(.home-section--hero) >
.btn-open-home-section-content:focus-visible::after {
    transform: translate(2px, -2px);
}

/* Put the tab on the same visible inner corner as each resting title. */
#intro > .btn-open-home-section-content {
    right: 6%;
    bottom: 2.4%;
}

#swarm > .btn-open-home-section-content {
    left: 6%;
    bottom: 2.4%;
}

#log > .btn-open-home-section-content {
    left: 6%;
    top: 2.4%;
}

#me > .btn-open-home-section-content {
    right: 6%;
    top: 2.4%;
}

/* Close becomes a high-contrast floating control once the sheet is open. */
#main-content > .home-section:not(.home-section--hero) >
.btn-close-home-section-content {
    top: var(--paper-padding);
    right: var(--paper-padding);

    padding: .68rem .92rem;
    border: 1px solid rgb(255 255 255 / .20);
    border-radius: 999px;
    background: #182c61;
    color: white;
    box-shadow: 0 8px 24px rgb(0 0 0 / .18);

    font-size: .82rem;
    font-weight: 650;
    letter-spacing: .07em;
    text-transform: uppercase;

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-.4rem) scale(.96);
}

#main-content > .home-section:not(.home-section--hero) >
.btn-close-home-section-content::before {
    content: "×";
    display: inline-block;
    margin-right: .45rem;
    font-size: 1.25em;
    line-height: .7;
    vertical-align: -.04em;
}

#main-content > .home-section:not(.home-section--hero) >
.btn-close-home-section-content:hover,
#main-content > .home-section:not(.home-section--hero) >
.btn-close-home-section-content:focus-visible {
    background: #0e1c43;
    transform: translateY(-2px) scale(1);
    outline: none;
}


/* ================================================================
   OPEN STATE: MOVE THE PAPER INTO THE CENTRE
   ================================================================ */

#main-content > .home-section:not(.home-section--hero).is-open {
    transform: translate3d(0, 0, 0) rotate(0deg);
    z-index: 20;
    box-shadow: var(--paper-shadow-open);
}

#main-content > .home-section:not(.home-section--hero).is-open
.block-heading_block {
    top: var(--paper-padding);
    left: var(--paper-padding);
    right: calc(var(--paper-padding) + 7.5rem);
    bottom: auto;
    width: auto;
    text-align: left;
}

#main-content > .home-section:not(.home-section--hero).is-open
.home-section-content > :not(.block-heading_block) {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);

    transition:
        opacity 360ms ease 300ms,
        transform 500ms var(--paper-ease) 250ms,
        visibility 0s linear 0s;
}

/* Swap the controls only after the sheet has entered its open state. */
#main-content > .home-section:not(.home-section--hero).is-open >
.btn-open-home-section-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(.94);
    transition:
        opacity 120ms ease,
        transform 180ms ease,
        visibility 0s linear 120ms;
}

#main-content > .home-section:not(.home-section--hero).is-open >
.btn-close-home-section-content {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
    transition:
        opacity 220ms ease 300ms,
        transform 300ms var(--paper-ease) 280ms,
        background-color 180ms ease,
        color 180ms ease,
        box-shadow 180ms ease,
        visibility 0s linear 0s;
}


/* ================================================================
   WAGTAIL CONTENT SAFETY
   ================================================================ */

#main-content .home-section figure {
    margin-inline: auto;
}

#main-content .home-section img {
    display: block;
    max-width: 100%;
    height: auto;
}


/* ================================================================
   RESPONSIVE TUNING
   ================================================================ */

@media (hover: hover) and (max-aspect-ratio: 4 / 3) {
    :root {
        --paper-rest-offset: 49%;
        --paper-rest-angle: 31deg;
        --hero-width: min(46vw, 34rem);
    }
}

/*
 * Touch/small screens: abandon the diamond because hover is unavailable.
 * Hero comes first, followed by ordinary stacked content sections.
 */
@media (hover: none), (pointer: coarse), (max-width: 720px) {
    #main-content > .home-section:not(.home-section--hero) >
    .btn-open-home-section-content,
    #main-content > .home-section:not(.home-section--hero) >
    .btn-close-home-section-content {
        display: none;
    }

    #main-content {
        height: auto;
        min-height: auto;
        overflow: visible;
        perspective: none;
        background: #f4efdf;
    }

    #hero.home-section--hero {
        position: relative;
        inset: auto;
        transform: none;

        width: min(100%, 42rem);
        max-width: none;
        max-height: none;
        margin: 0 auto;
        padding: clamp(1rem, 4vw, 2rem);
    }

    #hero .swarm-playground,
    #hero .swarm-playground__canvas {
        max-height: none;
    }

    #main-content > .home-section:not(.home-section--hero) {
        position: relative;
        inset: auto;
        transform: none;
        min-height: auto;
        box-shadow: none;
        cursor: auto;
    }

    #main-content > .home-section:not(.home-section--hero) .home-section-content {
        position: relative;
        inset: auto;
        overflow: visible;
        padding:
            clamp(3rem, 10vw, 5rem)
            clamp(1.25rem, 5vw, 2rem);
    }

    #main-content > .home-section:not(.home-section--hero) .block-heading_block {
        position: relative;
        inset: auto;
        width: auto;
        margin-bottom: 2rem;
        text-align: left;
    }

    #main-content > .home-section:not(.home-section--hero)
    .home-section-content > :not(.block-heading_block) {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
    }
}


/* Accessibility: avoid large sweeping animations if requested. */
@media (prefers-reduced-motion: reduce) {
    #main-content > .home-section:not(.home-section--hero),
    #main-content > .home-section:not(.home-section--hero) .block-heading_block,
    #main-content > .home-section:not(.home-section--hero)
    .home-section-content > :not(.block-heading_block),
    #main-content > .home-section:not(.home-section--hero) >
    .btn-open-home-section-content,
    #main-content > .home-section:not(.home-section--hero) >
    .btn-close-home-section-content {
        transition: none;
    }
}

/* ==================================================================
   BLOG ENTRY — scoped to the existing Wagtail template body class.
   All home rules above are preserved. Mobile refinements live separately.
   ================================================================== */
body.template-blogpage {
  --blog-ink: #182c61;
  --blog-text: #253a43;
  --blog-muted: #55676a;
  --blog-line: #c7c9b9;
  box-sizing: border-box;
  margin: 0;
  min-height: 100vh;
  color-scheme: light;
  color: var(--blog-text);
  background: linear-gradient(145deg, #f4efdf 0%, #faf6eb 60%, #e3ede7 100%);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
}
body.template-blogpage > :is(header, aside, main, footer),
body.template-blogpage > :is(header, aside, main, footer) * {
  box-sizing: border-box;
}
body.template-blogpage > header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: min(100% - 4rem, 72rem);
  margin: 0 auto;
  padding: 2.25rem 0 1.25rem;
}
body.template-blogpage > header > div { flex: 0 0 auto; }
body.template-blogpage > header img {
  display: block;
  width: 4rem;
  height: 4rem;
  object-fit: contain;
  border-radius: 50%;
}
body.template-blogpage > header h1 {
  margin: 0;
  color: var(--blog-ink);
  font-family: "Michroma", sans-serif;
  font-size: clamp(1rem, 1.7vw, 1.4rem);
  font-weight: 400;
  line-height: 1.6;
}
body.template-blogpage .skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body.template-blogpage .skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;
  width: auto;
  height: auto;
  max-width: calc(100% - 2rem);
  padding: .7rem 1rem;
  clip-path: none;
  white-space: normal;
  background: white;
}
body.template-blogpage > aside {
  width: min(100% - 4rem, 72rem);
  margin: 0 auto 2.75rem;
  border-bottom: 1px solid var(--blog-line);
}
body.template-blogpage > aside nav p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem 1.25rem;
  margin: 0;
  padding: 0 0 1rem;
}
body.template-blogpage > aside a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .4rem 1rem;
  border: 1px solid var(--blog-line);
  border-radius: 999px;
  background: #ffffff80;
  font-size: .875rem;
  font-weight: 600;
  text-decoration: none;
}
body.template-blogpage > aside a:first-child {
  background: var(--paper-swarm, #69bbb5);
}
body.template-blogpage > #main {
  position: relative;
  isolation: isolate;
  width: min(100% - 4rem, 58rem);
  margin: 0 auto 3rem;
  padding: clamp(2rem, 5vw, 4.5rem);
  border: 1px solid #c7c9b9;
  border-radius: .3rem;
  background: #fffaf0;
  box-shadow: 0 18px 50px #182c6110, 0 3px 9px #182c6107;
}
/* A folded corner and blue top edge echo the home page's paper geometry. */
body.template-blogpage > #main::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: .4rem;
  background: var(--paper-log, #183c49);
  border-radius: .3rem .3rem 0 0;
  pointer-events: none;
}
body.template-blogpage > #main::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(45deg, #183c49 49.5%, #f4efdf 50%);
  pointer-events: none;
}
body.template-blogpage #main > h1 {
  margin: .25rem 0 1rem;
  color: var(--blog-ink);
  font-family: "Michroma", sans-serif;
  font-size: clamp(1.75rem, 3.3vw, 2.8rem);
  font-weight: 400;
  line-height: 1.4;
  text-wrap: balance;
}
body.template-blogpage #main .meta {
  margin: 0 0 2rem;
  color: var(--blog-muted);
  font-size: .85rem;
  letter-spacing: .045em;
  font-variant-numeric: tabular-nums;
}
body.template-blogpage #main .intro {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid #268981;
  background: #e0eeea;
  color: var(--blog-ink);
  font-size: 1.2rem;
  line-height: 1.7;
}
body.template-blogpage #main .intro > :first-child { margin-top: 0; }
body.template-blogpage #main .intro > :last-child { margin-bottom: 0; }
body.template-blogpage #main :is(h2, h3, h4, h5, h6) {
  margin: 2.25em 0 .85em;
  color: var(--blog-ink);
  line-height: 1.5;
  text-wrap: balance;
}
body.template-blogpage #main h2 {
  font-family: "Michroma", sans-serif;
  font-size: 1.35rem;
  font-weight: 400;
}
body.template-blogpage #main h3 { font-size: 1.2rem; }
body.template-blogpage #main p { margin: 0 0 1.4rem; }
body.template-blogpage #main :is(ul, ol) { padding-left: 1.5em; }
body.template-blogpage #main li + li { margin-top: .5em; }
body.template-blogpage > :is(header, aside, main, footer) a {
  color: var(--blog-ink);
  text-underline-offset: .22em;
  text-decoration-thickness: 1px;
}
body.template-blogpage > :is(header, aside, main, footer) a:hover {
  color: #76521f;
  text-decoration: underline;
}
body.template-blogpage > :is(header, aside, main, footer) :focus-visible {
  outline: 3px solid #267d78;
  outline-offset: 4px;
}
body.template-blogpage #main :is(img, video, iframe, svg) { max-width: 100%; }
body.template-blogpage #main :is(img, video) { height: auto; }
body.template-blogpage #main img { border-radius: .25rem; }
body.template-blogpage #main figure { margin: 2rem 0; }
body.template-blogpage #main figure img { display: block; margin: 0 auto; }
body.template-blogpage #main figcaption {
  margin-top: .65rem;
  color: var(--blog-muted);
  font-size: .85rem;
  text-align: center;
}
body.template-blogpage #main img.left {
  float: left; max-width: 45%; margin: .4rem 1.5rem 1rem 0;
}
body.template-blogpage #main img.right {
  float: right; max-width: 45%; margin: .4rem 0 1rem 1.5rem;
}
body.template-blogpage #main blockquote {
  margin: 2rem 0;
  padding: 1.25rem 1.5rem;
  border-left: 3px solid #268981;
  background: var(--paper-swarm, #69bbb5);
}
body.template-blogpage #main blockquote > :last-child { margin-bottom: 0; }
body.template-blogpage #main pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1.25rem;
  border: 1px solid var(--blog-line);
  border-radius: .3rem;
  background: #e9eee8;
  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
}
body.template-blogpage #main code {
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  font-size: .9em;
  background: #e9eee8;
}
body.template-blogpage #main table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: .95rem;
}
body.template-blogpage #main :is(th, td) {
  padding: .75rem 1rem;
  border: 1px solid var(--blog-line);
  text-align: left;
  vertical-align: top;
}
body.template-blogpage #main th { background: var(--paper-log, #183c49); }
body.template-blogpage #main hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--blog-line);
}
/* Existing final paragraph contains the return-to-blog link. */
body.template-blogpage #main > p:last-child {
  clear: both;
  margin: 2.75rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--blog-line);
}
body.template-blogpage #main > p:last-child > a:only-child {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: .5rem 1.1rem;
  border: 1px solid #977032;
  border-radius: 999px;
  background: var(--paper-me, #c59448);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}
body.template-blogpage > footer {
  width: min(100% - 4rem, 72rem);
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
  border-top: 1px solid var(--blog-line);
  color: var(--blog-muted);
  font-size: .85rem;
}
body.template-blogpage > footer p { margin: .5rem 0; }
body.template-blogpage > footer a {
  display: inline-block;
  padding: .5rem .25rem;
  margin-right: .5rem;
}


/* Persian tile palette: lapis, turquoise, deep teal, ochre and ivory.
   Colour overrides only: home geometry and open/close state are unchanged. */
body.template-homepage {
  color-scheme: light;
  color: #182c61;
  background-color: #f4efdf;
}
#main-content > :is(#intro, #log) { color: #fff5dc; }
#main-content > :is(#swarm, #me) { color: #152548; }
#main-content > :is(#intro, #swarm, #log, #me) :is(h1, h2, h3, h4, h5, h6, a) {
  color: inherit;
}
#main-content > :is(#intro, #swarm, #log, #me) a {
  text-decoration: underline;
  text-underline-offset: .2em;
}
#main-content > :is(#intro, #swarm, #log, #me) a:hover {
  text-decoration-thickness: 2px;
}
#main-content > :is(#intro, #swarm, #log, #me) :focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 4px;
}
/* Opaque controls remain readable against all four panel colours. */
#main-content > .home-section:not(.home-section--hero) > .btn-open-home-section-content {
  color: #182c61;
  background-color: #fff5dc;
  border-color: #c59448;
}
#main-content > .home-section:not(.home-section--hero) > .btn-close-home-section-content {
  color: #fff5dc;
  background-color: #182c61;
  border-color: #c59448;
}
body.template-homepage > :is(header, aside, footer) a { color: #182c61; }
/* Blog reading surface stays ivory; deep teal table headers need light ink. */
body.template-blogpage #main th { color: #fff5dc; }
body.template-blogpage #main th a { color: inherit; }


/* TURQUOISE TILEWORK — visual treatment only; all geometry/state rules above remain. */
:root {
  --tile-turquoise: #54c7c0;
  --tile-lapis: #183c83;
  --tile-ink: #10294f;
  --tile-ivory: #fff4d6;
  --tile-gold: #d8a34b;
  --tile-pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Crect%20width%3D%22160%22%20height%3D%22160%22%20fill%3D%22%2354c7c0%22%2F%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23183c83%22%20stroke-width%3D%227%22%20stroke-linejoin%3D%22miter%22%3E%3Cpath%20d%3D%22M80%2018%2096%2042%20124%2036%20118%2064%20142%2080%20118%2096%20124%20124%2096%20118%2080%20142%2064%20118%2036%20124%2042%2096%2018%2080%2042%2064%2036%2036%2064%2042Z%22%2F%3E%3Cpath%20d%3D%22M0%200%2024%200%2024%2024%200%2024M160%200%20136%200%20136%2024%20160%2024M0%20160%2024%20160%2024%20136%200%20136M160%20160%20136%20160%20136%20136%20160%20136M80%200V18M80%20142V160M0%2080H18M142%2080H160%22%2F%3E%3C%2Fg%3E%3Cpath%20d%3D%22M80%2051%2088%2068%20106%2062%2099%2080%20106%2098%2088%2092%2080%20109%2072%2092%2054%2098%2061%2080%2054%2062%2072%2068Z%22%20fill%3D%22%23183c83%22%2F%3E%3Cpath%20d%3D%22M80%2068%2084%2076%2092%2080%2084%2084%2080%2092%2076%2084%2068%2080%2076%2076Z%22%20fill%3D%22%23d8a34b%22%2F%3E%3Cg%20fill%3D%22%23fff4d6%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%223%22%2F%3E%3Ccircle%20cx%3D%22148%22%20cy%3D%2212%22%20r%3D%223%22%2F%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%22148%22%20r%3D%223%22%2F%3E%3Ccircle%20cx%3D%22148%22%20cy%3D%22148%22%20r%3D%223%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  --paper-intro: #54c7c0;
  --paper-swarm: #70d3c7;
  --paper-log: #40b9bc;
  --paper-me: #63c6b1;
}
body:is(.template-homepage, .template-blogpage) {
  background-color: var(--tile-turquoise);
  background-image: var(--tile-pattern);
  background-size: 160px 160px;
  color: var(--tile-ink);
}
/* Home: quiet ceramic surfaces, distinct motifs, unboxed headings. */
body.template-homepage,
#main-content {
  background-color: #b4ddd5;
  background-image: none;
}
#main-content > #intro {
  --section-surface: #80cdc5;
  --section-pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23183c83%22%20stroke-opacity%3D%22.14%22%20stroke-width%3D%222.5%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M80%2018%2096%2042%20124%2036%20118%2064%20142%2080%20118%2096%20124%20124%2096%20118%2080%20142%2064%20118%2036%20124%2042%2096%2018%2080%2042%2064%2036%2036%2064%2042Z%20M80%200V18%20M80%20142V160%20M0%2080H18%20M142%2080H160%22%2F%3E%3Cpath%20d%3D%22M80%2055%20105%2080%2080%20105%2055%2080Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  --section-pattern-size: 176px;
}
#main-content > #swarm {
  --section-surface: #9bd8c6;
  --section-pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23183c83%22%20stroke-opacity%3D%22.14%22%20stroke-width%3D%222.5%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M-40%200%2040%2080%20-40%20160%20M40%200%20120%2080%2040%20160%20M120%200%20200%2080%20120%20160%20M40%200%20-40%2080%2040%20160%20M120%200%2040%2080%20120%20160%20M200%200%20120%2080%20200%20160%22%2F%3E%3Cpath%20d%3D%22M80%2020%20100%2040%2080%2060%2060%2040Z%20M0%20100%2020%20120%200%20140%20-20%20120Z%20M160%20100%20180%20120%20160%20140%20140%20120Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  --section-pattern-size: 160px;
}
#main-content > #log {
  --section-surface: #8fcbd4;
  --section-pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23183c83%22%20stroke-opacity%3D%22.14%22%20stroke-width%3D%222.5%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M0%2040H40V0%20M120%200V40H160%20M160%20120H120V160%20M40%20160V120H0%20M40%2040H120V120H40Z%20M80%2024%20136%2080%2080%20136%2024%2080Z%22%2F%3E%3Cpath%20d%3D%22M64%2064H96V96H64Z%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  --section-pattern-size: 184px;
}
#main-content > #me {
  --section-surface: #c6d8b7;
  --section-pattern: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22160%22%20height%3D%22160%22%20viewBox%3D%220%200%20160%20160%22%3E%3Cg%20fill%3D%22none%22%20stroke%3D%22%23183c83%22%20stroke-opacity%3D%22.14%22%20stroke-width%3D%222.5%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22M80%2080C20%200%20140%200%2080%2080C160%2020%20160%20140%2080%2080C140%20160%2020%20160%2080%2080C0%20140%200%2020%2080%2080Z%22%2F%3E%3Cpath%20d%3D%22M0%200Q80%2030%20160%200%20M160%200Q130%2080%20160%20160%20M160%20160Q80%20130%200%20160%20M0%20160Q30%2080%200%200%22%2F%3E%3Ccircle%20cx%3D%2280%22%20cy%3D%2280%22%20r%3D%2212%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  --section-pattern-size: 192px;
}
#main-content > :is(#intro, #swarm, #log, #me) {
  color: var(--tile-ink);
  background-color: var(--section-surface);
  background-image: var(--section-pattern);
  background-size: var(--section-pattern-size) var(--section-pattern-size);
  background-position: 0 0;
  border-color: var(--tile-gold);
  box-shadow: inset 0 0 0 7px var(--tile-lapis), inset 0 0 0 10px var(--tile-gold), 0 12px 35px #10294f55;
}
#main-content > :is(#intro, #swarm, #log, #me) .block-heading_block {
  color: var(--tile-ink);
  background: transparent;
  box-shadow: none;
}
#main-content > :is(#intro, #swarm, #log, #me).is-open {
  box-shadow: inset 0 0 0 7px var(--tile-lapis), inset 0 0 0 10px var(--tile-gold), 0 32px 90px #10294f66;
}
#main-content > :is(#intro, #swarm, #log, #me).is-open .home-section-content {
  background-color: var(--section-surface);
  background-image: var(--section-pattern);
  background-size: var(--section-pattern-size) var(--section-pattern-size);
  box-shadow: inset 0 0 0 7px var(--tile-lapis), inset 0 0 0 10px var(--tile-gold);
}
#hero.home-section--hero {
  color: var(--tile-ink);
  background-color: #b4ddd5;
  box-shadow: 0 0 0 .65rem #b4ddd5, 0 0 0 .8rem var(--tile-gold), 0 0 0 1rem var(--tile-lapis);
}
#hero .swarm-playground__canvas { border-color: var(--tile-lapis); }
#main-content > .home-section:not(.home-section--hero) > :is(.btn-open-home-section-content, .btn-close-home-section-content) {
  color: var(--tile-ivory);
  background: var(--tile-lapis);
  border-color: var(--tile-gold);
  border-radius: .15rem;
  box-shadow: 0 0 0 2px var(--tile-lapis), 0 0 0 3px var(--tile-gold);
}
#main-content > .home-section:not(.home-section--hero) > :is(.btn-open-home-section-content, .btn-close-home-section-content):is(:hover, :focus-visible) {
  color: var(--tile-ink);
  background: var(--tile-ivory);
  border-color: var(--tile-lapis);
}
body:is(.template-homepage, .template-blogpage) > :is(header, aside, footer) {
  background-color: var(--tile-turquoise);
  box-shadow: 0 0 0 .5rem var(--tile-turquoise);
  color: var(--tile-ink);
}
body.template-blogpage > header h1 { color: var(--tile-ink); }
body.template-blogpage > aside { border-color: var(--tile-lapis); }
body.template-blogpage > aside a,
body.template-blogpage > aside a:first-child,
body.template-blogpage #main > p:last-child > a:only-child {
  color: var(--tile-ivory);
  background: var(--tile-lapis);
  border-color: var(--tile-gold);
  border-radius: .15rem;
}
body.template-blogpage > #main {
  border-color: var(--tile-lapis);
  border-radius: 0;
  background: #fffaf0;
  box-shadow: 0 0 0 5px var(--tile-turquoise), 0 0 0 8px var(--tile-lapis), 0 0 0 10px var(--tile-gold), 0 20px 50px #10294f44;
}
body.template-blogpage > #main::before {
  height: .65rem;
  border-radius: 0;
  background: repeating-linear-gradient(90deg, #183c83 0 24px, #d8a34b 24px 30px, #54c7c0 30px 54px, #183c83 54px 60px);
}
body.template-blogpage > #main::after {
  background: linear-gradient(45deg, #d8a34b 0 47%, #183c83 47% 53%, #54c7c0 53%);
}
body.template-blogpage #main .intro {
  color: var(--tile-ink);
  background: var(--tile-turquoise);
  border-color: var(--tile-lapis);
  box-shadow: inset 0 -3px 0 var(--tile-gold);
}
body.template-blogpage #main blockquote {
  background: #d4f0e6;
  border-color: var(--tile-lapis);
}
body.template-blogpage #main th { background: var(--tile-lapis); color: var(--tile-ivory); }

body.template-homepage > :is(header, aside, footer) {
  background-color: #b4ddd5;
  box-shadow: 0 0 0 .5rem #b4ddd5;
}

/* =====================================================================
   CSS-ONLY USABILITY CORRECTION · 20 September 2026
   Original moving papers, rotations, section IDs and JS are retained.
   This file is the original production stylesheet plus this final section.
   ===================================================================== */
body.template-homepage {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  color: #173451;
  --paper-time: 500ms;
}
body.template-homepage #main-content {
  --hero-width: min(30vw, 27rem);
  --hero-max-height: none;
}
body.template-homepage #hero.home-section--hero {
  text-align: center;
  background: transparent;
  box-shadow: none;
}
body.template-homepage #hero h2 {
  max-width: 20ch;
  margin: 0 auto .65rem;
  font-size: clamp(1rem, 1.45vw, 1.35rem);
  line-height: 1.5;
}
body.template-homepage #hero p { margin: 0 0 .85rem; font-size: .9375rem; line-height: 1.6; }
body.template-homepage #hero .swarm-playground__canvas { border: 1px solid #607d8b; border-radius: .3rem; max-height: none; }
body.template-homepage #hero .swarm-playground__controls { gap: .5rem .75rem; }
body.template-homepage #hero .swarm-playground__controls button {
  min-height: 44px;
  padding: .6rem .85rem;
  font: 600 .875rem/1.3 system-ui, sans-serif;
  border: 1px solid #183c83;
  border-radius: .25rem;
  background: #183c83;
  color: #fff;
  cursor: pointer;
}
body.template-homepage #hero :is(.swarm-playground__status,.swarm-playground__timer) { font: .8125rem/1.5 system-ui, sans-serif; font-variant-numeric: tabular-nums; }
body.template-homepage #hero .swarm-playground__timer { margin-top: .3rem; }
body.template-homepage #main-content > :is(#intro,#swarm,#log,#me) {
  /* Keep the existing Persian patterns and palette, soften their contrast. */
  background-image: linear-gradient(#ffffffa8, #ffffffa8), var(--section-pattern);
  box-shadow: inset 0 0 0 2px #183c83, inset 0 0 0 3px #d8a34b, 0 7px 20px #10294f24;
}
body.template-homepage #main-content > :is(#intro,#swarm,#log,#me).is-open {
  box-shadow: inset 0 0 0 2px #183c83, inset 0 0 0 3px #d8a34b, 0 14px 35px #10294f24;
}
body.template-homepage #main-content > :is(#intro,#swarm,#log,#me).is-open .home-section-content {
  background: #f8f7ee;
  box-shadow: none;
}
body.template-homepage #home-section-effect-canvas-hoopoe { opacity: .07; mix-blend-mode: multiply; }
body.template-homepage #main-content .home-section-content { overflow-wrap: anywhere; }
body.template-homepage #main-content .home-section-content p { margin: 0 0 1.2em; }
body.template-homepage #main-content .home-section-content p:empty { display: none; }
body.template-homepage #main-content .home-section-content :is(ul,ol) { padding-left: 1.4em; }
body.template-homepage #main-content .home-section-content li + li { margin-top: .55em; }
body.template-homepage #main-content .home-section-content figure { margin: 1.75rem auto; }
body.template-homepage #main-content .home-section-content a { text-underline-offset: .2em; }
body.template-homepage #main-content :focus-visible { outline: 3px solid #183c83; outline-offset: 4px; }

/* Set all four insets: a desktop bottom/left must not stretch a mobile tab. */
body.template-homepage #main-content > .home-section:not(.home-section--hero) > :is(.btn-open-home-section-content,.btn-close-home-section-content) {
  inset: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: calc(100% - 2rem);
  min-height: 44px;
  height: auto;
  padding: .65rem .9rem;
  border: 1px solid #183c83;
  border-radius: .25rem;
  background: #fff9e9;
  color: #173451;
  box-shadow: 0 2px 6px #10294f18;
  backdrop-filter: none;
  font: 650 .8125rem/1.3 system-ui, sans-serif;
  letter-spacing: .04em;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 150ms ease;
}
body.template-homepage #main-content > .home-section:not(.home-section--hero) > :is(.btn-open-home-section-content,.btn-close-home-section-content):hover { background: #fff; }
body.template-homepage #main-content > .home-section:not(.home-section--hero) > :is(.btn-open-home-section-content,.btn-close-home-section-content):focus-visible { outline: 3px solid #183c83; outline-offset: 4px; }
body.template-homepage #main-content > .home-section:not(.home-section--hero):not(.is-open) > .btn-close-home-section-content,
body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open > .btn-open-home-section-content {
  display: none;
  visibility: hidden;
  pointer-events: none;
}
body.template-homepage #main-content > .home-section:not(.home-section--hero):not(.is-open) > .btn-open-home-section-content,
body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open > .btn-close-home-section-content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
body.template-homepage #main-content > .home-section:not(.home-section--hero):not(.is-open) .home-section-content > :not(:first-child) {
  visibility: hidden;
  pointer-events: none;
}
body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open .home-section-content > * {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

@media (min-width: 721px) and (hover: hover) and (pointer: fine) {
  /* Keep translate3d(...) rotate(...) on the original four full-size sheets. */
  body.template-homepage #main-content > .home-section:not(.home-section--hero):not(.is-open) .home-section-content { padding: 0; overflow: hidden; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero):not(.is-open) .block-heading_block:first-child {
    inset: auto;
    left: var(--label-x);
    bottom: 14%;
    width: min(24vw, 22rem);
    margin: 0;
    text-align: center;
    transform: translateX(-50%);
    transition: none;
  }
  body.template-homepage #main-content > .home-section:not(.home-section--hero):not(.is-open) h2 { font-size: clamp(.95rem, 1.35vw, 1.35rem); line-height: 1.55; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero) { --label-x: 58%; }
  body.template-homepage #main-content > :is(#swarm,#log) { --label-x: 42%; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero):is(#log,#me):not(.is-open) .block-heading_block:first-child { bottom: auto; top: 14%; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero) > .btn-open-home-section-content {
    left: var(--label-x);
    bottom: 5%;
    transform: translateX(-50%);
  }
  body.template-homepage #main-content > .home-section:not(.home-section--hero):is(#log,#me) > .btn-open-home-section-content { bottom: auto; top: 5%; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open > .btn-close-home-section-content {
    top: 1.25rem;
    right: 1.25rem;
    transform: none;
    background: #183c83;
    color: #fff;
  }
  body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open .home-section-content {
    overflow: auto;
    padding: 6rem max(2rem, calc((100% - 68ch) / 2)) 3rem;
    line-height: 1.75;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    border: 3px solid transparent;
    background-clip: padding-box;
  }
  body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open .block-heading_block {
    position: static;
    inset: auto;
    width: auto;
    margin: 0 0 1.5rem;
    transform: none;
    transition: none;
    text-align: left;
  }
  body.template-homepage #main-content > .home-section:not(.home-section--hero).is-open h2 { font-size: clamp(1.2rem, 1.8vw, 1.75rem); line-height: 1.5; }
  /* While reading a paper, covered controls must not accept clicks or Tab. */
  body.template-homepage #main-content:has(> .is-open) > .home-section:not(.is-open) > .btn-open-home-section-content,
  body.template-homepage #main-content:has(> .is-open) > #hero { visibility: hidden; pointer-events: none; }
}
body.template-homepage > footer { padding: 1.25rem; font: .875rem/1.6 system-ui, sans-serif; box-shadow: none; }
body.template-homepage > footer p { margin: .5rem 0; }
/* The old portrait rule reduced the opening until it covered the game.
   Spread the SAME rotated papers just enough for narrower desktop windows. */
@media (min-width: 721px) and (hover: hover) and (pointer: fine) and (max-aspect-ratio: 4 / 3) {
  body.template-homepage { --paper-rest-offset: 54%; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero) { --label-x: 61%; }
  body.template-homepage #main-content > :is(#swarm,#log) { --label-x: 39%; }
}
@media (min-width: 721px) and (hover: hover) and (pointer: fine) and (max-aspect-ratio: 1 / 1) {
  body.template-homepage { --paper-rest-offset: 60%; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero) { --label-x: 66%; }
  body.template-homepage #main-content > :is(#swarm,#log) { --label-x: 34%; }
}
@media (min-width: 721px) and (hover: hover) and (pointer: fine) and (max-aspect-ratio: 4 / 5) {
  body.template-homepage { --paper-rest-offset: 62%; }
  body.template-homepage #main-content > .home-section:not(.home-section--hero) { --label-x: 68%; }
  body.template-homepage #main-content > :is(#swarm,#log) { --label-x: 32%; }
}
@media (prefers-reduced-motion: reduce) {
  body.template-homepage #main-content .home-section,
  body.template-homepage #main-content .home-section-content > *,
  body.template-homepage #main-content button { transition: none; }
  body.template-homepage #home-section-effect-canvas-hoopoe { visibility: hidden; }
}

/* =====================================================================
   BLOG INDEX · integrated SIMORGH treatment
   Added 27 September 2026.

   IMPORTANT: every rule in this section is scoped to
   body.template-blogindexpage. The existing homepage, moving papers,
   hero, open/close controls and blog-entry styles above are untouched.
   ===================================================================== */

body.template-blogindexpage {
  --blog-index-bg: #b4ddd5;
  --blog-index-paper: #f8f7ee;
  --blog-index-ink: #173451;
  --blog-index-muted: #52656c;
  --blog-index-line: #c4d1cc;
  --blog-index-lapis: var(--tile-lapis, #183c83);
  --blog-index-gold: var(--tile-gold, #d8a34b);
  --blog-index-turquoise: #80cdc5;

  box-sizing: border-box;
  margin: 0;
  min-height: 100vh;
  color-scheme: light;
  color: var(--blog-index-ink);
  background: var(--blog-index-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

body.template-blogindexpage *,
body.template-blogindexpage *::before,
body.template-blogindexpage *::after {
  box-sizing: border-box;
}


/* Header ------------------------------------------------------------- */

body.template-blogindexpage > header {
  display: flex;
  align-items: center;
  gap: 1.1rem;

  width: min(100% - 4rem, 72rem);
  margin: 0 auto;
  padding: 2rem 0 1.1rem;
}

body.template-blogindexpage > header > div {
  flex: 0 0 auto;
}

body.template-blogindexpage > header img {
  display: block;
  width: 3.75rem;
  height: 3.75rem;
  object-fit: contain;

  border: 1px solid rgb(24 60 131 / .20);
  border-radius: 50%;
  background: #f8f7ee;
}

body.template-blogindexpage > header h1 {
  margin: 0;
  color: var(--blog-index-lapis);
  font-family: "Michroma", sans-serif;
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  font-weight: 400;
  line-height: 1.55;
}


/* Keep the existing skip link accessible without changing page layout. */

body.template-blogindexpage .skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.template-blogindexpage .skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;

  width: auto;
  height: auto;
  max-width: calc(100% - 2rem);
  padding: .7rem 1rem;

  clip-path: none;
  white-space: normal;

  border: 2px solid var(--blog-index-lapis);
  background: var(--blog-index-paper);
  color: var(--blog-index-ink);
}


/* Navigation --------------------------------------------------------- */

body.template-blogindexpage > aside {
  width: min(100% - 4rem, 72rem);
  margin: 0 auto 2rem;
  border-bottom: 1px solid rgb(24 60 131 / .28);
}

body.template-blogindexpage > aside nav p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;

  margin: 0;
  padding: 0 0 1rem;
}

body.template-blogindexpage > aside a {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;
  padding: .6rem .9rem;

  border: 1px solid var(--blog-index-lapis);
  border-radius: .25rem;

  background: #fff9e9;
  color: var(--blog-index-ink);

  font-size: .875rem;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;

  box-shadow: 0 2px 6px #10294f18;
  transition: background-color 150ms ease;
}

body.template-blogindexpage > aside a:hover {
  background: #fff;
}


/* Main paper --------------------------------------------------------- */

body.template-blogindexpage > #main {
  position: relative;
  isolation: isolate;

  width: min(100% - 4rem, 64rem);
  margin: 0 auto 3rem;
  padding: clamp(2rem, 5vw, 4rem);

  border: 1px solid rgb(24 60 131 / .32);
  border-top: 4px solid var(--blog-index-lapis);
  background: var(--blog-index-paper);

  box-shadow: 0 14px 35px #10294f18;
}

/* Small Persian geometric mark: decorative only, matching the site's visual
   vocabulary without turning the reading surface into a tiled wallpaper. */
body.template-blogindexpage > #main::before {
  content: "";
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;

  width: 2.35rem;
  aspect-ratio: 1;

  background: var(--blog-index-gold);
  opacity: .34;
  pointer-events: none;

  clip-path: polygon(
    50% 0,
    62% 25%,
    85% 15%,
    75% 38%,
    100% 50%,
    75% 62%,
    85% 85%,
    62% 75%,
    50% 100%,
    38% 75%,
    15% 85%,
    25% 62%,
    0 50%,
    25% 38%,
    15% 15%,
    38% 25%
  );
}

body.template-blogindexpage #main > h1 {
  max-width: calc(100% - 4rem);
  margin: 0 0 1.25rem;

  color: var(--blog-index-lapis);
  font-family: "Michroma", sans-serif;
  font-size: clamp(1.65rem, 3vw, 2.5rem);
  font-weight: 400;
  line-height: 1.4;
  text-wrap: balance;
}

body.template-blogindexpage #main > .intro {
  margin: 0 0 2rem;
  padding: 1rem 1.2rem;

  border-left: 3px solid var(--blog-index-lapis);
  background: #e0eeea;
  color: var(--blog-index-ink);

  box-shadow: inset 0 -2px 0 rgb(216 163 75 / .55);
}

body.template-blogindexpage #main > .intro > :first-child {
  margin-top: 0;
}

body.template-blogindexpage #main > .intro > :last-child {
  margin-bottom: 0;
}


/* Blog cards --------------------------------------------------------- */

body.template-blogindexpage #main > .blogcard {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  grid-template-areas:
    "image title"
    "image summary";
  column-gap: 1.35rem;
  row-gap: .55rem;
  align-items: start;

  margin: 0 0 1rem;
  padding: 1.25rem;

  border: 1px solid var(--blog-index-line);
  border-left: 3px solid var(--blog-index-lapis);
  background:
    linear-gradient(rgb(255 255 255 / .90), rgb(255 255 255 / .90)),
    var(--tile-pattern, none);

  background-size: auto, 160px 160px;
  box-shadow: 0 4px 12px #10294f0d;
}

body.template-blogindexpage #main > .blogcard:last-child {
  margin-bottom: 0;
}

body.template-blogindexpage #main > .blogcard > h2 {
  grid-area: title;

  margin: 0;
  color: var(--blog-index-lapis);

  font-family: "Michroma", sans-serif;
  font-size: clamp(.95rem, 1.4vw, 1.15rem);
  font-weight: 400;
  line-height: 1.55;
  text-wrap: balance;
}

body.template-blogindexpage #main > .blogcard > h2 a {
  color: inherit;
  text-decoration: none;
  text-underline-offset: .2em;
}

body.template-blogindexpage #main > .blogcard > h2 a:hover {
  text-decoration: underline;
}

body.template-blogindexpage #main > .blogcard > img {
  grid-area: image;
  align-self: start;

  display: block;
  width: 7.5rem;
  height: 6.25rem;
  max-width: 100%;

  padding: .3rem;
  object-fit: contain;

  border: 1px solid var(--blog-index-line);
  background: #edf3ef;
}

body.template-blogindexpage #main > .blogcard > p {
  grid-area: summary;

  margin: 0;
  color: var(--blog-index-ink);
  line-height: 1.65;
}

/* Future-proof cards without thumbnails. */
body.template-blogindexpage #main > .blogcard:not(:has(> img)) {
  grid-template-columns: 1fr;
  grid-template-areas:
    "title"
    "summary";
}


/* Shared link/focus behaviour --------------------------------------- */

body.template-blogindexpage > :is(header, aside, main, footer) a {
  text-underline-offset: .22em;
  text-decoration-thickness: 1px;
}

body.template-blogindexpage > :is(header, aside, main, footer) :focus-visible {
  outline: 3px solid var(--blog-index-lapis);
  outline-offset: 4px;
}


/* Footer ------------------------------------------------------------- */

body.template-blogindexpage > footer {
  width: min(100% - 4rem, 72rem);
  margin: 0 auto;
  padding: 1.25rem 0 2.25rem;

  border-top: 1px solid rgb(24 60 131 / .28);
  color: var(--blog-index-muted);

  font-size: .875rem;
  line-height: 1.6;
}

body.template-blogindexpage > footer p {
  margin: .45rem 0;
}

body.template-blogindexpage > footer a {
  color: var(--blog-index-lapis);
}


/* Responsive blog index --------------------------------------------- */

@media (max-width: 720px) {
  body.template-blogindexpage {
    font-size: 1rem;
  }

  body.template-blogindexpage > header {
    width: calc(100% - 2rem);
    gap: .8rem;
    padding: 1.4rem 0 .8rem;
  }

  body.template-blogindexpage > header img {
    width: 2.8rem;
    height: 2.8rem;
  }

  body.template-blogindexpage > header h1 {
    min-width: 0;
    font-size: clamp(.9rem, 3.5vw, 1.1rem);
  }

  body.template-blogindexpage > aside {
    width: calc(100% - 2rem);
    margin-bottom: 1.25rem;
  }

  body.template-blogindexpage > #main {
    width: calc(100% - 1.5rem);
    margin-bottom: 2rem;
    padding: 2rem clamp(1rem, 5vw, 1.6rem);

    box-shadow: 0 8px 24px #10294f12;
  }

  body.template-blogindexpage > #main::before {
    top: .9rem;
    right: .9rem;
    width: 1.75rem;
  }

  body.template-blogindexpage #main > h1 {
    max-width: calc(100% - 2.5rem);
    font-size: clamp(1.4rem, 7vw, 2rem);
  }

  body.template-blogindexpage #main > .intro {
    margin-bottom: 1.5rem;
    padding: .9rem 1rem;
  }

  body.template-blogindexpage #main > .blogcard {
    grid-template-columns: 5.25rem minmax(0, 1fr);
    column-gap: 1rem;

    padding: 1rem;
  }

  body.template-blogindexpage #main > .blogcard > img {
    width: 5.25rem;
    height: 5.25rem;
  }

  body.template-blogindexpage #main > .blogcard > h2 {
    font-size: .95rem;
  }

  body.template-blogindexpage > footer {
    width: calc(100% - 2rem);
    padding-bottom: 2rem;
  }
}

@media (max-width: 460px) {
  body.template-blogindexpage #main > .blogcard {
    grid-template-columns: 1fr;
    grid-template-areas:
      "title"
      "image"
      "summary";
  }

  body.template-blogindexpage #main > .blogcard > img {
    width: 100%;
    height: auto;
    max-height: 11rem;
    object-fit: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.template-blogindexpage * {
    transition: none !important;
  }
}



/* =====================================================================
   BLOG ENTRY · integrated with the blog index treatment
   Added 27 September 2026.

   This section intentionally comes last. It only overrides
   body.template-blogpage, leaving the homepage and blog index untouched.
   ===================================================================== */

body.template-blogpage {
  --blog-entry-bg: #b4ddd5;
  --blog-entry-paper: #f8f7ee;
  --blog-entry-ink: #173451;
  --blog-entry-muted: #52656c;
  --blog-entry-line: #c4d1cc;
  --blog-entry-lapis: var(--tile-lapis, #183c83);
  --blog-entry-gold: var(--tile-gold, #d8a34b);
  --blog-entry-turquoise: #80cdc5;

  margin: 0;
  min-height: 100vh;
  color-scheme: light;
  color: var(--blog-entry-ink);
  background: var(--blog-entry-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

body.template-blogpage *,
body.template-blogpage *::before,
body.template-blogpage *::after {
  box-sizing: border-box;
}


/* Header ------------------------------------------------------------- */

body.template-blogpage > header {
  display: flex;
  align-items: center;
  gap: 1.1rem;

  width: min(100% - 4rem, 72rem);
  margin: 0 auto;
  padding: 2rem 0 1.1rem;

  background: transparent;
  box-shadow: none;
}

body.template-blogpage > header > div {
  flex: 0 0 auto;
}

body.template-blogpage > header img {
  display: block;
  width: 3.75rem;
  height: 3.75rem;
  object-fit: contain;

  border: 1px solid rgb(24 60 131 / .20);
  border-radius: 50%;
  background: var(--blog-entry-paper);
}

body.template-blogpage > header h1 {
  margin: 0;
  color: var(--blog-entry-lapis);
  font-family: "Michroma", sans-serif;
  font-size: clamp(1rem, 1.7vw, 1.35rem);
  font-weight: 400;
  line-height: 1.55;
}

body.template-blogpage .skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

body.template-blogpage .skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1000;

  width: auto;
  height: auto;
  max-width: calc(100% - 2rem);
  padding: .7rem 1rem;

  clip-path: none;
  white-space: normal;

  border: 2px solid var(--blog-entry-lapis);
  background: var(--blog-entry-paper);
  color: var(--blog-entry-ink);
}


/* Navigation --------------------------------------------------------- */

body.template-blogpage > aside {
  width: min(100% - 4rem, 72rem);
  margin: 0 auto 2rem;
  border-bottom: 1px solid rgb(24 60 131 / .28);
  background: transparent;
  box-shadow: none;
}

body.template-blogpage > aside nav p {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;

  margin: 0;
  padding: 0 0 1rem;
}

body.template-blogpage > aside a,
body.template-blogpage > aside a:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;
  padding: .6rem .9rem;

  border: 1px solid var(--blog-entry-lapis);
  border-radius: .25rem;

  background: #fff9e9;
  color: var(--blog-entry-ink);

  font-size: .875rem;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;

  box-shadow: 0 2px 6px #10294f18;
  transition: background-color 150ms ease;
}

body.template-blogpage > aside a:hover,
body.template-blogpage > aside a:first-child:hover {
  background: #fff;
  color: var(--blog-entry-ink);
}


/* Main reading paper ------------------------------------------------- */

body.template-blogpage > #main {
  position: relative;
  isolation: isolate;

  width: min(100% - 4rem, 58rem);
  margin: 0 auto 3rem;
  padding: clamp(2rem, 5vw, 4rem);

  border: 1px solid rgb(24 60 131 / .32);
  border-top: 4px solid var(--blog-entry-lapis);
  border-radius: 0;
  background: var(--blog-entry-paper);

  box-shadow: 0 14px 35px #10294f18;
}

/* Replace the old stripe/fold decoration with the same restrained mark
   used by the blog index. */
body.template-blogpage > #main::before {
  content: "";
  position: absolute;
  inset: auto;
  top: 1.25rem;
  right: 1.25rem;

  width: 2.35rem;
  height: auto;
  aspect-ratio: 1;

  border-radius: 0;
  background: var(--blog-entry-gold);
  opacity: .34;
  pointer-events: none;

  clip-path: polygon(
    50% 0,
    62% 25%,
    85% 15%,
    75% 38%,
    100% 50%,
    75% 62%,
    85% 85%,
    62% 75%,
    50% 100%,
    38% 75%,
    15% 85%,
    25% 62%,
    0 50%,
    25% 38%,
    15% 15%,
    38% 25%
  );
}

body.template-blogpage > #main::after {
  content: none;
  display: none;
}

body.template-blogpage #main > h1 {
  max-width: calc(100% - 4rem);
  margin: 0 0 1rem;

  color: var(--blog-entry-lapis);
  font-family: "Michroma", sans-serif;
  font-size: clamp(1.65rem, 3vw, 2.5rem);
  font-weight: 400;
  line-height: 1.4;
  text-wrap: balance;
}

body.template-blogpage #main .meta {
  margin: 0 0 2rem;
  color: var(--blog-entry-muted);
  font-size: .85rem;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

body.template-blogpage #main .intro {
  margin: 0 0 2.25rem;
  padding: 1rem 1.2rem;

  border-left: 3px solid var(--blog-entry-lapis);
  background: #e0eeea;
  color: var(--blog-entry-ink);

  box-shadow: inset 0 -2px 0 rgb(216 163 75 / .55);
  font-size: 1.1rem;
  line-height: 1.7;
}

body.template-blogpage #main .intro > :first-child {
  margin-top: 0;
}

body.template-blogpage #main .intro > :last-child {
  margin-bottom: 0;
}


/* Article typography ------------------------------------------------- */

body.template-blogpage #main :is(h2, h3, h4, h5, h6) {
  color: var(--blog-entry-lapis);
  text-wrap: balance;
}

body.template-blogpage #main h2 {
  margin: 2.25em 0 .85em;
  font-family: "Michroma", sans-serif;
  font-size: 1.3rem;
  font-weight: 400;
  line-height: 1.5;
}

body.template-blogpage #main h3 {
  margin: 2em 0 .75em;
  font-size: 1.15rem;
  line-height: 1.5;
}

body.template-blogpage #main :is(h4, h5, h6) {
  margin: 1.8em 0 .7em;
  line-height: 1.5;
}

body.template-blogpage #main p {
  margin: 0 0 1.35rem;
}

body.template-blogpage #main :is(ul, ol) {
  padding-left: 1.5em;
}

body.template-blogpage #main li + li {
  margin-top: .5em;
}

body.template-blogpage > :is(header, aside, main, footer) a {
  color: var(--blog-entry-lapis);
  text-underline-offset: .22em;
  text-decoration-thickness: 1px;
}

body.template-blogpage > :is(header, aside, main, footer) a:hover {
  color: #76521f;
}

body.template-blogpage > :is(header, aside, main, footer) :focus-visible {
  outline: 3px solid var(--blog-entry-lapis);
  outline-offset: 4px;
}


/* Media and article elements ---------------------------------------- */

body.template-blogpage #main :is(img, video, iframe, svg) {
  max-width: 100%;
}

body.template-blogpage #main :is(img, video) {
  height: auto;
}

body.template-blogpage #main img {
  border: 1px solid var(--blog-entry-line);
  border-radius: 0;
  background: #edf3ef;
}

body.template-blogpage #main figure {
  margin: 2rem 0;
}

body.template-blogpage #main figure img {
  display: block;
  margin: 0 auto;
}

body.template-blogpage #main figcaption {
  margin-top: .65rem;
  color: var(--blog-entry-muted);
  font-size: .85rem;
  line-height: 1.5;
  text-align: center;
}

body.template-blogpage #main blockquote {
  margin: 2rem 0;
  padding: 1.15rem 1.3rem;

  border-left: 3px solid var(--blog-entry-lapis);
  background: #e0eeea;
  color: var(--blog-entry-ink);

  box-shadow: inset 0 -2px 0 rgb(216 163 75 / .45);
}

body.template-blogpage #main blockquote > :last-child {
  margin-bottom: 0;
}

body.template-blogpage #main pre {
  max-width: 100%;
  overflow-x: auto;
  padding: 1.1rem;

  border: 1px solid var(--blog-entry-line);
  border-radius: 0;
  background: #edf3ef;

  line-height: 1.6;
  white-space: pre;
  overflow-wrap: normal;
}

body.template-blogpage #main code {
  font-family: ui-monospace, "DejaVu Sans Mono", monospace;
  font-size: .9em;
  background: #edf3ef;
}

body.template-blogpage #main table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 2rem 0;
  font-size: .95rem;
}

body.template-blogpage #main :is(th, td) {
  padding: .75rem 1rem;
  border: 1px solid var(--blog-entry-line);
  text-align: left;
  vertical-align: top;
}

body.template-blogpage #main th {
  background: var(--blog-entry-lapis);
  color: #fff5dc;
}

body.template-blogpage #main hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--blog-entry-line);
}


/* Return-to-blog action --------------------------------------------- */

body.template-blogpage #main > p:last-child {
  clear: both;
  margin: 2.75rem 0 0;
  padding-top: 1.5rem;
  border-top: 1px solid var(--blog-entry-line);
}

body.template-blogpage #main > p:last-child > a:only-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;

  min-height: 44px;
  padding: .6rem .9rem;

  border: 1px solid var(--blog-entry-lapis);
  border-radius: .25rem;
  background: #fff9e9;
  color: var(--blog-entry-ink);

  font-size: .875rem;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;

  box-shadow: 0 2px 6px #10294f18;
  transition: background-color 150ms ease;
}

body.template-blogpage #main > p:last-child > a:only-child:hover {
  background: #fff;
  color: var(--blog-entry-ink);
}


/* Footer ------------------------------------------------------------- */

body.template-blogpage > footer {
  width: min(100% - 4rem, 72rem);
  margin: 0 auto;
  padding: 1.25rem 0 2.25rem;

  border-top: 1px solid rgb(24 60 131 / .28);
  background: transparent;
  box-shadow: none;
  color: var(--blog-entry-muted);

  font-size: .875rem;
  line-height: 1.6;
}

body.template-blogpage > footer p {
  margin: .45rem 0;
}

body.template-blogpage > footer a {
  color: var(--blog-entry-lapis);
}


/* Responsive blog entry --------------------------------------------- */

@media (max-width: 720px) {
  body.template-blogpage {
    font-size: 1rem;
  }

  body.template-blogpage > header {
    width: calc(100% - 2rem);
    gap: .8rem;
    padding: 1.4rem 0 .8rem;
  }

  body.template-blogpage > header img {
    width: 2.8rem;
    height: 2.8rem;
  }

  body.template-blogpage > header h1 {
    min-width: 0;
    font-size: clamp(.9rem, 3.5vw, 1.1rem);
  }

  body.template-blogpage > aside {
    width: calc(100% - 2rem);
    margin-bottom: 1.25rem;
  }

  body.template-blogpage > #main {
    width: calc(100% - 1.5rem);
    margin-bottom: 2rem;
    padding: 2rem clamp(1rem, 5vw, 1.6rem);

    box-shadow: 0 8px 24px #10294f12;
  }

  body.template-blogpage > #main::before {
    top: .9rem;
    right: .9rem;
    width: 1.75rem;
  }

  body.template-blogpage #main > h1 {
    max-width: calc(100% - 2.5rem);
    font-size: clamp(1.4rem, 7vw, 2rem);
  }

  body.template-blogpage #main .intro {
    padding: .9rem 1rem;
    font-size: 1.05rem;
  }

  body.template-blogpage #main img.left,
  body.template-blogpage #main img.right {
    float: none;
    display: block;
    max-width: 100%;
    margin: 1.25rem auto;
  }

  body.template-blogpage > footer {
    width: calc(100% - 2rem);
    padding-bottom: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.template-blogpage * {
    transition: none !important;
  }
}
