/* Small Robots: engineering translated into folklore. */

:root {
  --ink: #211a22;
  --ink-soft: #6c5a65;
  --paper: #f5dfb8;
  --paper-pale: #fff1d2;
  --paper-deep: #e0b97b;
  --content-bg: #f5d4de;
  --content-bg-deep: #edc1cf;
  --charcoal: #17131f;
  --wood: #533039;
  --wood-dark: #241624;
  --brass: #c18d45;
  --amber: #f0ad4b;
  --moss: #6ba36e;
  --mint: #82e6bd;
  --pink: #ef8fb6;
  --purple: #7a4d8b;
  --hero-bg-rgb: 46 33 68;
  --hero-bg: rgb(var(--hero-bg-rgb));
  --hero-image-width: min(70vw, 1280px);
  --hero-fade-width: 150px;
  --hero-fade-test: rgb(var(--hero-bg-rgb));
  --hero-read-fade-opacity: 0;
  --rule: rgba(33, 26, 20, 0.32);
  --shadow: 0 1.4rem 3.5rem rgba(31, 22, 15, 0.24);
  --wrap: 1180px;
  --serif: Georgia, "Times New Roman", serif;
  --rounded: "Arial Rounded MT Bold", "Trebuchet MS", "Gill Sans", Arial, sans-serif;
  --sans: "Trebuchet MS", "Gill Sans", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 8%, rgba(239, 143, 182, 0.18), transparent 18rem),
    radial-gradient(circle at 84% 12%, rgba(130, 230, 189, 0.16), transparent 20rem),
    linear-gradient(180deg, #241a33 0, #392542 24rem, var(--content-bg) 24rem, var(--content-bg-deep));
  font-family: var(--serif);
  line-height: 1.58;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(81, 53, 34, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(81, 53, 34, 0.025) 1px, transparent 1px);
  background-size: 24px 24px, 24px 24px;
  pointer-events: none;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.wrap {
  width: min(var(--wrap), calc(100% - 2rem));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid rgba(251, 243, 223, 0.22);
  background: rgba(23, 19, 31, 0.94);
  color: var(--paper-pale);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.8rem 0;
}

.site-logo {
  display: grid;
  gap: 0.1rem;
  min-width: 12rem;
  text-decoration: none;
}

.site-logo__title {
  color: var(--pink);
  font-family: var(--rounded);
  font-size: 1.45rem;
  line-height: 1;
}

.site-logo__tagline {
  color: rgba(251, 243, 223, 0.78);
  font-size: 0.8rem;
  font-style: italic;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: flex-end;
  font-family: var(--rounded);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.main-nav a {
  position: relative;
  color: rgba(251, 243, 223, 0.82);
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  color: var(--mint);
}

.hero {
  position: relative;
  min-height: clamp(360px, 50vh, 520px);
  overflow: hidden;
  color: var(--paper-pale);
  background: var(--hero-bg);
}

.hero-image::after,
.room-hero .room-portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgb(var(--hero-bg-rgb) / var(--hero-read-fade-opacity));
  border: 0;
  pointer-events: none;
}

.hero-image {
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 0;
  width: auto;
  overflow: hidden;
  outline: 0;
}

.hero-image::before,
.room-hero .room-portrait::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  width: var(--hero-fade-width);
  background: linear-gradient(90deg, var(--hero-fade-test) 0, rgb(var(--hero-bg-rgb) / 0) 100%);
  pointer-events: none;
}

.hero-image img {
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  opacity: 1;
  object-fit: contain;
  object-position: right center;
}

.hero-inner {
  position: relative;
  z-index: 2;
  isolation: isolate;
  display: grid;
  min-height: clamp(360px, 50vh, 520px);
  align-content: end;
  padding: clamp(3rem, 7vh, 4.5rem) 0 clamp(2rem, 5vh, 3rem);
}

.hero-inner::before,
.room-hero-grid > div::before {
  content: "";
  position: absolute;
  top: -2rem;
  right: -18rem;
  bottom: -2rem;
  left: -50vw;
  z-index: 0;
  background: rgb(var(--hero-bg-rgb) / var(--hero-read-fade-opacity));
  pointer-events: none;
}

.hero-inner > *,
.room-hero-grid > div > * {
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--brass);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--mint);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  font-family: var(--rounded);
  letter-spacing: 0;
}

.hero h1,
.room-hero h1,
.redirect-main h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(3.2rem, 8.5vw, 6.4rem);
  font-weight: 400;
  line-height: 0.86;
}

.hero-line,
.page-line {
  max-width: 38rem;
  margin: 1.2rem 0 0;
  color: var(--paper-pale);
  font-size: clamp(1.25rem, 2.3vw, 2.1rem);
  font-style: italic;
  line-height: 1.08;
}

.hero-copy {
  max-width: 38rem;
  margin: 1.25rem 0 0;
  color: rgba(251, 243, 223, 0.88);
  font-size: clamp(1.05rem, 1.5vw, 1.25rem);
}

.hero-quote {
  max-width: 34rem;
  margin: 1.8rem 0 0;
  padding: 1rem 0 0;
  border-top: 1px solid rgba(229, 166, 69, 0.55);
  color: var(--mint);
  font-size: clamp(1.35rem, 2.5vw, 2.2rem);
  font-style: italic;
  line-height: 1.12;
}

.door-link {
  display: inline-flex;
  width: fit-content;
  margin-top: 1.6rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(229, 166, 69, 0.72);
  color: var(--paper-pale);
  background: rgba(33, 26, 20, 0.72);
  box-shadow: 0 0 0 4px rgba(229, 166, 69, 0.12);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.door-link:hover {
  background: var(--amber);
  color: var(--charcoal);
}

.intro-band,
.room-index,
.image-led,
.content-band,
.book-section,
.illustrated-spread,
.quiet-list {
  border-bottom: 1px solid var(--rule);
  padding: clamp(3rem, 7vw, 6rem) 0;
}

.intro-grid,
.image-led-grid,
.text-columns,
.room-hero-grid,
.spread-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.48fr) minmax(0, 0.52fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.spread-grid {
  grid-template-columns: minmax(0, 0.52fr) minmax(0, 0.48fr);
}

.spread-reverse .spread-grid {
  grid-template-columns: minmax(0, 0.5fr) minmax(0, 0.5fr);
}

.intro-band h2,
.room-index h2,
.image-led h2,
.prose h2,
.room-ledger h2,
.label-board h2,
.signal-list h2,
.workbench h2,
.bone-panel h2,
.narrow-copy h2,
.spread-copy h2,
.quiet-list h2 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 4.8rem);
  font-weight: 400;
  line-height: 0.95;
}

.intro-copy p,
.room-text p,
.prose p,
.narrow-copy p,
.spread-copy p {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
  font-size: clamp(1.05rem, 1.45vw, 1.3rem);
}

.book-section--opening {
  padding-top: clamp(4rem, 9vw, 8rem);
}

.narrow-copy {
  max-width: 760px;
}

.chapter-mark {
  margin: 0 0 0.75rem;
  color: var(--brass);
  font-family: var(--sans);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.narrow-copy .lead,
.prose .lead {
  color: var(--ink);
  font-size: clamp(1.35rem, 2.35vw, 2rem);
  line-height: 1.34;
}

.illustrated-spread {
  background: linear-gradient(180deg, rgba(255, 241, 210, 0.2), rgba(239, 143, 182, 0.18));
}

.spread-copy {
  max-width: 42rem;
}

.plate {
  position: relative;
  margin: 0;
  border: 1px solid rgba(33, 26, 20, 0.36);
  background: var(--wood-dark);
  box-shadow: var(--shadow);
}

.plate img {
  width: 100%;
  height: clamp(22rem, 42vw, 36rem);
  object-fit: cover;
  object-position: 70% 50%;
}

.plate--object img {
  height: clamp(18rem, 34vw, 30rem);
}

.plate figcaption,
.room-portrait figcaption {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border-top: 1px solid rgba(251, 243, 223, 0.18);
  color: rgba(251, 243, 223, 0.82);
  background: rgba(33, 26, 20, 0.92);
  font-family: var(--sans);
  font-size: 0.78rem;
  line-height: 1.45;
}

.paper-note {
  max-width: 34rem;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  border: 1px solid rgba(33, 26, 20, 0.26);
  background:
    linear-gradient(135deg, rgba(251, 243, 223, 0.94), rgba(224, 199, 146, 0.72));
  box-shadow: 0.8rem 0.8rem 0 rgba(33, 26, 20, 0.08);
  color: var(--ink);
  font-size: clamp(1.35rem, 2.7vw, 2.5rem);
  font-style: italic;
  line-height: 1.18;
}

.paper-note p {
  margin: 0 0 0.8rem;
}

.paper-note p:last-child {
  margin-bottom: 0;
}

.paper-note--dark {
  border-color: rgba(229, 166, 69, 0.42);
  background:
    linear-gradient(135deg, rgba(42, 33, 28, 0.96), rgba(81, 53, 34, 0.92));
  color: var(--paper-pale);
}

.quiet-list {
  background: rgba(255, 241, 246, 0.36);
}

.quiet-list h2 {
  max-width: 930px;
  color: var(--room-accent, var(--brass));
}

.path-list {
  display: grid;
  gap: 0.85rem;
  margin-top: 2rem;
}

.path-row {
  position: relative;
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 1.2rem;
  overflow: hidden;
  padding: 1.1rem 1.2rem;
  border: 1px solid rgba(33, 26, 34, 0.22);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(255, 241, 210, 0.92), rgba(245, 223, 184, 0.74));
  box-shadow: 0.35rem 0.35rem 0 rgba(33, 26, 34, 0.08);
  text-decoration: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.path-row::after {
  content: "";
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  background: var(--mint);
  box-shadow: 0 0 1.1rem rgba(130, 230, 189, 0.7);
  opacity: 0.8;
}

.path-row:hover {
  border-color: rgba(130, 230, 189, 0.48);
  box-shadow: 0.45rem 0.45rem 0 rgba(239, 143, 182, 0.14);
  transform: translateY(-2px);
}

.path-row:hover strong {
  color: var(--purple);
}

.path-number {
  color: var(--brass);
  font-family: var(--sans);
  font-size: 0.75rem;
  letter-spacing: 0.18em;
}

.path-row strong {
  display: block;
  font-family: var(--rounded);
  font-size: clamp(1.5rem, 3vw, 2.7rem);
  font-weight: 400;
  line-height: 1;
}

.path-row em {
  display: block;
  max-width: 48rem;
  margin-top: 0.35rem;
  color: var(--ink-soft);
  font-style: italic;
}

.image-led--paper {
  background: linear-gradient(180deg, rgba(81, 53, 34, 0.06), rgba(157, 113, 48, 0.1));
}

.archive-image,
.room-portrait {
  position: relative;
  margin: 0;
  border: 1px solid rgba(33, 26, 20, 0.36);
  background: var(--wood-dark);
  box-shadow: var(--shadow);
}

.archive-image::after,
.room-portrait::after {
  content: "";
  position: absolute;
  inset: 0.7rem;
  border: 1px solid rgba(251, 243, 223, 0.24);
  pointer-events: none;
}

.archive-image img,
.room-portrait img {
  width: 100%;
  height: clamp(18rem, 34vw, 30rem);
  object-fit: cover;
  object-position: 70% 50%;
}

.room-portrait--wide img {
  height: clamp(18rem, 34vw, 30rem);
}

.label-list {
  display: grid;
  gap: 0.65rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
  font-family: var(--sans);
  font-size: 0.92rem;
}

.label-list li,
.workbench li {
  width: fit-content;
  padding: 0.32rem 0.55rem;
  border: 1px solid rgba(33, 26, 20, 0.22);
  background: rgba(251, 243, 223, 0.78);
  color: var(--ink-soft);
}

.room-hero {
  position: relative;
  min-height: clamp(340px, 46vh, 500px);
  overflow: hidden;
  border-bottom: 1px solid rgba(255, 241, 210, 0.2);
  padding: 0;
  background: var(--hero-bg);
  color: var(--paper-pale);
}

.room-hero-grid {
  position: relative;
  display: block;
  min-height: clamp(340px, 46vh, 500px);
  padding: clamp(3rem, 7vh, 4.5rem) 0 clamp(2rem, 5vh, 3rem);
}

.room-hero-grid > div {
  position: relative;
  z-index: 2;
  isolation: isolate;
  max-width: 44rem;
}

.room-hero .room-portrait {
  display: block;
  position: absolute;
  top: 0;
  right: calc(50% - 50vw);
  bottom: 0;
  width: auto;
  z-index: 0;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  opacity: 0.94;
  overflow: hidden;
  outline: 0;
}

.room-hero .room-portrait img,
.room-hero .room-portrait--wide img {
  width: auto;
  height: 100%;
  max-width: none;
  opacity: 1;
  aspect-ratio: auto;
  object-fit: contain;
  object-position: right center;
}

.room-hero .room-portrait figcaption {
  position: absolute;
  right: max(1rem, calc((100vw - var(--wrap)) / 2));
  bottom: 1rem;
  z-index: 3;
  max-width: min(24rem, calc(100vw - 2rem));
  border: 1px solid rgba(255, 241, 210, 0.2);
  background: rgba(23, 19, 31, 0.78);
  box-shadow: 0 0 1.8rem rgba(130, 230, 189, 0.12);
}

main section:not(.hero):not(.room-hero) .plate img,
main section:not(.hero):not(.room-hero) .archive-image img,
main section:not(.hero):not(.room-hero) .room-portrait img {
  object-fit: cover;
  object-position: 70% 50% !important;
}

.room-page .site-header {
  position: static;
}

.room-house {
  --room-accent: var(--brass);
  --room-line: var(--amber);
}

.room-folk {
  --room-accent: var(--moss);
  --room-line: var(--mint);
  background:
    radial-gradient(circle at 80% 15%, rgba(72, 101, 77, 0.2), transparent 24rem),
    linear-gradient(180deg, var(--content-bg), var(--content-bg-deep));
}

.room-glow {
  --room-accent: var(--amber);
  --room-line: var(--amber);
  background:
    radial-gradient(circle at 75% 24%, rgba(229, 166, 69, 0.28), transparent 20rem),
    linear-gradient(180deg, #241a33 0, #392542 18rem, var(--content-bg) 18rem);
}

.room-glow .room-hero {
  color: var(--paper-pale);
}

.room-glow .page-line {
  color: var(--room-line);
}

.room-workshop {
  --room-accent: #7c5a2b;
  --room-line: var(--pink);
  background:
    radial-gradient(circle at 12% 18%, rgba(157, 113, 48, 0.2), transparent 22rem),
    linear-gradient(180deg, var(--content-bg), var(--content-bg-deep));
}

.room-wall {
  --room-accent: var(--moss);
  --room-line: var(--mint);
  background:
    radial-gradient(circle at 80% 16%, rgba(72, 101, 77, 0.28), transparent 24rem),
    linear-gradient(180deg, var(--content-bg), var(--content-bg-deep));
}

.room-hero .eyebrow,
.prose h2,
.room-ledger h2,
.label-board h2,
.signal-list h2,
.workbench h2,
.bone-panel h2 {
  color: var(--room-accent, var(--brass));
}

.room-hero .eyebrow {
  color: var(--mint);
}

.page-line {
  color: var(--room-line, var(--mint));
}

.lead {
  color: var(--ink);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.35;
}

.prose {
  max-width: 48rem;
}

.page-note {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--room-accent, var(--brass));
  font-style: italic;
}

.room-ledger,
.label-board,
.signal-list,
.workbench,
.bone-panel {
  padding: clamp(1rem, 3vw, 1.5rem);
  border: 1px solid var(--rule);
  background:
    linear-gradient(180deg, rgba(251, 243, 223, 0.9), rgba(243, 230, 200, 0.82));
  box-shadow: 0.65rem 0.65rem 0 rgba(33, 26, 20, 0.08);
}

.room-ledger h2,
.label-board h2,
.signal-list h2,
.workbench h2,
.bone-panel h2 {
  font-size: clamp(1.6rem, 3vw, 2.6rem);
}

.room-ledger ul,
.workbench ul {
  display: grid;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.room-ledger li {
  display: grid;
  gap: 0.1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(33, 26, 20, 0.16);
}

.room-ledger strong,
.label-board strong {
  color: var(--ink);
  font-weight: 700;
}

.room-ledger span,
.label-board p,
.signal-list dd,
.bone-panel p {
  color: var(--ink-soft);
}

.label-board p {
  margin: 0 0 0.9rem;
}

.signal-list dl {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.signal-list dt {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.signal-list dd {
  margin: 0 0 0.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid rgba(33, 26, 20, 0.16);
}

.bone-panel img {
  width: 100%;
  margin-bottom: 1rem;
  border: 1px solid rgba(33, 26, 20, 0.24);
}

.next-room {
  padding: 1.4rem 0;
}

.next-room a {
  color: var(--room-accent, var(--brass));
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-transform: uppercase;
}

.next-room a:hover {
  color: var(--ink);
}

.site-footer {
  background: var(--charcoal);
  color: var(--paper-pale);
  padding: 2.5rem 0 1.25rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 2rem;
  align-items: center;
}

.footer-kicker {
  margin: 0 0 0.25rem;
  color: var(--amber);
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-grid a,
.footer-bottom a {
  color: rgba(251, 243, 223, 0.86);
  text-decoration: none;
}

.footer-grid a:hover,
.footer-bottom a:hover {
  color: var(--amber);
}

.footer-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border: 1px solid rgba(229, 166, 69, 0.56);
  color: var(--amber);
  font-size: 1.45rem;
}

.footer-right {
  text-align: right;
}

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 1.2rem;
  justify-content: center;
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(251, 243, 223, 0.18);
  color: rgba(251, 243, 223, 0.62);
  font-family: var(--sans);
  font-size: 0.78rem;
}

.redirect-main {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background: var(--charcoal);
  color: var(--paper-pale);
}

@media (max-width: 980px) {
  .site-header {
    position: static;
  }

  .header-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .intro-grid,
  .image-led-grid,
  .text-columns,
  .room-hero-grid,
  .spread-grid,
  .spread-reverse .spread-grid {
    grid-template-columns: 1fr;
  }

  .room-portrait {
    max-width: 40rem;
  }

  .room-hero .room-portrait {
    max-width: none;
  }

  .room-glow {
    background:
      radial-gradient(circle at 75% 18%, rgba(229, 166, 69, 0.3), transparent 18rem),
      linear-gradient(180deg, #2a211c 0, #4a3727 14rem, var(--content-bg) 14rem);
  }
}

@media (max-width: 680px) {
  .wrap {
    width: min(var(--wrap), calc(100% - 1.2rem));
  }

  .hero,
  .hero-inner {
    min-height: 430px;
  }

  .room-hero,
  .room-hero-grid {
    min-height: 410px;
  }

  .room-hero .room-portrait figcaption {
    display: none;
  }

  .path-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .footer-right {
    text-align: left;
  }

  .footer-mark {
    order: -1;
  }
}
