:root {
  --navy: #0b1c33;
  --ink: #e8eef4;
  --muted: #9fb4c6;
  --cyan: #7eb6d9;
  --gold: #e4c36a;
  --green: #3dcaa0;
  --coral: #e07a72;
  --line: rgba(126, 182, 217, 0.38);
  --plate: rgba(8, 20, 36, 0.78);
  --serif: "Liberation Serif", "Times New Roman", Times, serif;
  --sans: "Liberation Sans", "Segoe UI", sans-serif;
}

.site {
  background-color: var(--navy);
  background-image:
    linear-gradient(rgba(126, 182, 217, 0.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(126, 182, 217, 0.11) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
}

.bgfield {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.bg {
  position: absolute;
  width: 9rem;
  height: auto;
  opacity: 0.55;
}

.ptab { top: 22%; left: 1.4rem; width: 10rem; }
.sand { top: 36%; right: 1.2rem; width: 10rem; }
.waves { top: 50%; left: 1.3rem; width: 11rem; }
.benz { top: 46%; right: 1.6rem; width: 7.5rem; }
.beet { top: 62%; left: 1.5rem; width: 8rem; opacity: 0.4; }
.clock { top: 68%; right: 1.4rem; width: 8rem; }
.room { top: 86%; left: 2rem; width: 5rem; opacity: 0.8; }
.legend { top: 91%; right: 2rem; width: 7rem; opacity: 0.85; }

.eggs { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: clip; }

.egg {
  position: absolute;
  pointer-events: auto;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: rgba(11, 28, 51, 0.4);
  cursor: pointer;
}

.egg .note {
  display: none;
  position: absolute;
  left: 1.4rem;
  top: -0.3rem;
  width: 14rem;
  padding: 0.55rem 0.7rem;
  background: #071422;
  border: 1px solid var(--gold);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.75rem;
  line-height: 1.35;
  text-align: left;
  letter-spacing: 0.01em;
}

.egg:hover .note,
.egg:focus .note { display: block; }

.e-gap { top: 22%; left: 4.6rem; }
.e-sand { top: 37%; right: 3.2rem; }
.egg.inline { position: relative; display: inline-block; vertical-align: middle; margin-left: 0.4rem; }
.e-cheese { top: 26%; left: 1.4rem; }
.e-met { top: 78%; left: 1.2rem; }
.e-sand .note { left: auto; right: 1.4rem; }
.fig-anchor { position: relative; }
.egg.e-packet { left: 84.7%; top: 70.8%; transform: translate(-50%, -50%); }
/* the shim packet now sits in the right panel (cover r6 order); on narrow screens its note opens to the left */
@media (max-width: 900px) { .e-packet .note { left: auto; right: 1.4rem; } }

@media (max-width: 900px) {
  .bg { opacity: 0.16; width: 4.6rem; }
  .room, .legend { opacity: 0.45; }
  .egg .note { width: 11rem; }
}

.site * { box-sizing: border-box; }

.backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.85;
}

.banner {
  position: relative;
  z-index: 2;
  background: #071422;
  color: var(--gold);
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--gold);
}

.frame {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(8.5rem, 14.5rem) minmax(0, 40rem) minmax(8.5rem, 14.5rem);
  justify-content: center;
  align-items: start;
  gap: 0.35rem 0.8rem;
  margin: 0.45rem;
  border: 1px solid var(--cyan);
  box-shadow: inset 0 0 0 5px var(--navy), inset 0 0 0 6px var(--gold);
  padding: 0.7rem 0.55rem 1.4rem;
}

.frame > .rail {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.frame > .rail:nth-of-type(1) { grid-column: 1; }
.frame > .rail:nth-of-type(2) { grid-column: 3; }

.sidefill {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  gap: 1.1rem;
  margin-top: 0.8rem;
  padding-bottom: 0.4rem;
}

.sidefill svg {
  width: 78%;
  height: auto;
  margin: 0 auto;
  display: block;
}

.cover {
  grid-column: 1 / -1;
  position: relative;
  padding: 1.15rem 0 0.2rem;
}

.cover .diagram {
  max-width: min(56rem, calc(100% - 1rem));
  margin: 0.1rem auto 0;
}

.cover .rule { margin: 1rem auto 0.65rem; }

.cover .subtitle {
  max-width: 28rem;
  margin: 0.75rem auto 0.25rem;
  font-size: 0.95rem;
}

.cover .margins { display: none; }

@media (min-width: 1100px) {
  .cover .margins {
    display: block;
    position: absolute;
    top: 1.4rem;
    width: 7.2rem;
    margin: 0;
    pointer-events: none;
  }
  .cover .margins-l { left: 0.55rem; }
  .cover .margins-r { right: 0.55rem; }
  .cover .margins svg {
    width: 100%;
    height: auto;
    display: block;
    margin: 0 0 1.1rem;
  }
}

.wrap {
  grid-column: 2;
  width: auto;
  max-width: none;
  margin: 0;
}

.hero { text-align: center; }

h1 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.14em;
  line-height: 0.92;
  margin: 0;
  font-size: clamp(1.7rem, 6.4vw, 3.1rem);
  text-transform: uppercase;
}

h1 span {
  display: block;
  color: var(--gold);
  font-size: 1.18em;
  letter-spacing: 0.16em;
  margin-top: 0.15em;
}

.subtitle {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.92rem;
  line-height: 1.4;
  max-width: 34rem;
  margin: 0.45rem auto 0.2rem;
}

.byline {
  font-family: var(--sans);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.95rem;
  margin: 0.35rem 0 0;
}

.rule {
  border: 0;
  border-top: 1px solid var(--gold);
  width: min(16rem, 70%);
  margin: 0.55rem auto;
  opacity: 0.8;
}

h2 {
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 0.9rem;
}

.spaced { margin-top: 1.4rem; }

.plate {
  background: var(--plate);
  border: 1px solid var(--line);
  padding: 1.15rem 1.15rem 1.25rem;
  margin: 0.7rem 0 0;
}

.passage, .card p, .quote { margin: 0; }

.passage + .passage { margin-top: 1.1rem; }

.cite, .tag, .licence, .foot, .card h3, .labels {
  font-family: var(--sans);
}

.cite {
  display: block;
  color: var(--cyan);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.hold {
  border: 1px solid var(--gold);
  background: rgba(228, 195, 106, 0.08);
  color: var(--ink);
  padding: 0.85rem 1rem;
  margin: 1rem auto 0;
  max-width: 36rem;
  text-align: left;
}

.tag {
  display: inline-block;
  background: var(--gold);
  color: #1a1408;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.18rem 0.45rem;
  margin-bottom: 0.4rem;
}

.chapters {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapters li {
  border-top: 1px solid var(--line);
  padding: 0.65rem 0;
  font-size: 0.98rem;
}

.chapters li:last-child { border-bottom: 1px solid var(--line); }

.cards {
  display: grid;
  gap: 0.85rem;
}

.card {
  border: 1px solid var(--line);
  padding: 0.8rem 0.85rem 0.95rem;
  background: rgba(11, 28, 51, 0.45);
}

.card h3 {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.45rem;
  color: var(--green);
}

.labels {
  list-style: none;
  margin: 0;
  padding: 0;
}

.labels li {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0;
  letter-spacing: 0.04em;
}

figure { margin: 1rem 0 0; }

.diagram, .compare {
  width: 100%;
  height: auto;
  display: block;
}

.diagram {
  margin: 0;
  max-width: none;
}

.rack {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: rack 5s ease-in-out infinite;
}

@keyframes rack {
  0%, 100% { transform: skewX(0deg); }
  50% { transform: skewX(-16deg); }
}

@media (prefers-reduced-motion: reduce) {
  .rack {
    animation: none;
    transform: skewX(-14deg);
  }
}

.licence, .foot {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.55rem;
}

.foot {
  text-align: center;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-top: 2rem;
}

@media (min-width: 720px) {
  .cards { grid-template-columns: 1fr 1fr; }
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.tile {
  border: 1px solid var(--line);
  background: rgba(8, 20, 36, 0.62);
  padding: 0.35rem 0.4rem 0.55rem;
}

.tile svg {
  width: 100%;
  height: auto;
  display: block;
}

.tile p {
  font-family: var(--sans);
  font-size: 0.68rem;
  line-height: 1.35;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-align: center;
  margin: 0.2rem 0 0;
}

@media (max-width: 760px) {
  .frame {
    grid-template-columns: 4.4rem minmax(0, 1fr) 4.4rem;
    gap: 0.25rem;
    padding: 0.45rem 0.3rem 1rem;
  }
  .tile p, .licence { font-size: 0.55rem; }
  .subtitle { font-size: 0.78rem; }
}

/* r5: phone layout (Grok3 0958) */
.egg::before { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); border-radius: 50%; }
@media (max-width: 600px) {
  .frame { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; padding: 0.45rem 1.35rem 1rem; }
  .e-gap, .e-cheese, .e-met { left: 2px; }
  .e-sand { right: 2px; }
  .egg.inline .note { position: fixed; left: 1rem; right: 1rem; top: auto; bottom: 1rem; width: auto; z-index: 5; }
  .frame > .wrap { grid-column: 1; order: 1; }
  .frame > .rail:nth-of-type(1) { grid-column: 1; order: 2; }
  .frame > .rail:nth-of-type(2) { grid-column: 1; order: 3; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .sidefill { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .sidefill svg { width: 4.5rem; margin: 0; }
  .tile p { font-size: 0.68rem; }
  .licence { font-size: 0.75rem; }
}


/* r7: page nav, inner pages, figure plates */
.topnav { position: relative; z-index: 4; background: #071422; border-bottom: 1px solid var(--line); }
.topnav ul { list-style: none; margin: 0; padding: 0.35rem 0.6rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.2rem 1.4rem; }
.topnav a { display: inline-block; padding: 0.55rem 0.2rem; min-height: 44px; line-height: 1.9; color: var(--cyan); font-family: var(--sans); font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; }
.topnav a[aria-current="page"] { color: var(--gold); border-bottom: 1px solid var(--gold); }
.topnav a:focus-visible, .topnav a:hover { color: var(--ink); }
.page { position: relative; z-index: 1; max-width: 50rem; margin: 0.45rem auto; border: 1px solid var(--cyan); box-shadow: inset 0 0 0 5px var(--navy), inset 0 0 0 6px var(--gold); padding: 1.4rem 1.3rem 1.6rem; }
.page h1 { font-size: clamp(1.4rem, 4.6vw, 2.2rem); text-align: center; line-height: 1.1; }
.page .lede { text-align: center; color: var(--muted); font-family: var(--sans); font-size: 0.9rem; margin: 0.6rem auto 0; max-width: 34rem; }
.figgrid { display: grid; grid-template-columns: 1fr; gap: 1.1rem; margin-top: 0.4rem; }
@media (min-width: 900px) { .figgrid { grid-template-columns: 1fr 1fr; } }
.figplate { margin: 0; background: var(--plate); border: 1px solid var(--line); padding: 0.7rem; }
.figplate .paper { background: #fff; padding: 0.5rem; }
.figplate img { display: block; width: 100%; height: auto; }
.figplate figcaption { font-family: var(--sans); font-size: 0.8rem; line-height: 1.4; margin-top: 0.6rem; color: var(--ink); }
.figplate figcaption .num { color: var(--gold); letter-spacing: 0.06em; }
.figplate figcaption .rights { display: block; color: var(--muted); font-size: 0.72rem; margin-top: 0.3rem; }
.page .passage { font-size: 1.04rem; }
.namecard { text-align: center; margin: 0.4rem 0 1rem; }
.namecard .byline { font-size: 1.05rem; }

/* r9: accessibility and phone polish */
.skip { position: absolute; left: 0.5rem; top: -3rem; z-index: 10; padding: 0.5rem 0.8rem; background: #071422; color: var(--gold); border: 1px solid var(--gold); font-family: var(--sans); font-size: 0.85rem; }
.skip:focus { top: 0.5rem; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.egg:focus-visible { outline-offset: 2px; }
main:focus { outline: none; }
@media (max-width: 760px) {
  /* r10: 12px floor holds at all widths up to 760 (Grok3 1220 flag) */
  .tile p, .figplate figcaption .rights, .cite, .tag, .card h3, .licence { font-size: 0.75rem; }
}
@media (max-width: 600px) {
  .page { padding-left: 1rem; padding-right: 1rem; }
  .passage { line-height: 1.55; }
  .hold { word-break: break-word; }
}

/* r12: 12 px floor at every width, desktop included */
.tile p, .figplate figcaption .rights, .cite, .tag, .card h3, .licence { font-size: 0.75rem; }
.comparekey { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0 0 0.3rem; font-family: var(--sans); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; line-height: 1.3; }
.comparekey .k4 { color: #e07a72; }
.comparekey .k3 { color: #3dcaa0; }
/* renamed from .legend: that class already places a cover drawing */
.platekey { list-style: none; margin: 0.35rem auto 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.3rem 1rem; font-family: var(--sans); font-size: 0.75rem; letter-spacing: 0.04em; color: #c5d4e0; }
.platekey li { display: inline-flex; align-items: center; gap: 0.35rem; }
.platekey .sw { display: inline-block; width: 0.9rem; height: 0.25rem; }
.numerals { margin: 0; font-family: "Liberation Serif", "Times New Roman", serif; color: #e4c36a; text-align: center; letter-spacing: 0.06em; white-space: nowrap; }
.tilenum { font-size: 1rem; padding: 1.1rem 0; }
.sidenum { font-size: 0.8rem; }
/* r12: 601-760 px used 4.4rem side rails, which shrank the rail diagrams to about 70 px wide
   (their labels drew at about 2 px). Use the phone's single column up to 760 instead. */
@media (min-width: 601px) and (max-width: 760px) {
  .frame { grid-template-columns: minmax(0, 1fr); gap: 0.6rem; padding: 0.45rem 1.35rem 1rem; }
  .e-gap, .e-cheese, .e-met { left: 2px; }
  .e-sand { right: 2px; }
  .egg.inline .note { position: fixed; left: 1rem; right: 1rem; top: auto; bottom: 1rem; width: auto; z-index: 5; }
  .frame > .wrap { grid-column: 1; order: 1; }
  .frame > .rail:nth-of-type(1) { grid-column: 1; order: 2; }
  .frame > .rail:nth-of-type(2) { grid-column: 1; order: 3; }
  .gallery { grid-template-columns: 1fr 1fr; }
  .sidefill { flex-direction: row; justify-content: center; flex-wrap: wrap; }
  .sidefill svg { width: 4.5rem; margin: 0; }
}

/* r20 launch additions */
.thesis { text-align: center; font-size: 1.15rem; font-style: italic; margin: 1.4rem auto; max-width: 34rem; }
.bookbox { display: flex; gap: 1.2rem; align-items: flex-start; flex-wrap: wrap; }
.bookcover { width: 160px; height: auto; border: 1px solid var(--muted, #888); }
.booktitle { margin-top: 0; }
.buy a { font-weight: bold; }
.buy a, .contact a { color: #e4c36a; }
.buy a:hover, .contact a:hover { color: #ffd56a; }
.contact { margin-top: 1rem; }
.foot a { color: inherit; text-transform: none; letter-spacing: normal; }
