﻿:root {
  --paper: #f6efdc;
  --ink: #15120f;
  --ink-soft: #3d352c;
  --line: #1a1714;
  --blue-light: #d7e7ef;
  --blue: #a4c4d5;
  --blue-dark: #3c6e83;
  --panel: #f8f1de;
  --shadow: rgba(12, 9, 7, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Mono", monospace;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.75), transparent 55%),
    radial-gradient(circle at 88% 86%, rgba(0, 0, 0, 0.08), transparent 55%),
    var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.paper {
  width: min(1420px, 100%);
}

.spread {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
  padding: 26px 30px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 18px 42px var(--shadow);
  overflow: hidden;
}

.spread::before {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 50%;
  width: 12px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.08), transparent);
  pointer-events: none;
}

.spread::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.025) 0, rgba(0, 0, 0, 0.025) 1px, transparent 1px, transparent 5px),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0, rgba(255, 255, 255, 0.05) 1px, transparent 1px, transparent 7px);
  opacity: 0.32;
  pointer-events: none;
}

.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(4rem, 12vw, 9rem);
  letter-spacing: 0.16em;
  color: var(--ink);
  opacity: 0.45;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  user-select: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 0.85;
}

.watermark span {
  display: block;
  text-align: center;
}

.watermark span:last-child {
  letter-spacing: 0.2em;
}

.margin-note {
  position: absolute;
  bottom: 100px;
  left: 32px;
  font-family: "Caveat", cursive;
  font-size: 2.8rem;
  font-weight: 500;
  color: #1a1a1a;
  transform: rotate(-15deg);
  pointer-events: none;
  z-index: 10;
  line-height: 1.2;
  user-select: none;
  text-align: center;
  text-shadow: 
    0.5px 0.5px 0 #1a1a1a,
    -0.2px 0.2px 0 rgba(0, 0, 0, 0.3);
  filter: url(#pen-texture);
}

.margin-note::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(to bottom, transparent, #1a1a1a 20%, #1a1a1a 80%, transparent);
  opacity: 0.3;
}

.margin-note-red {
  bottom: auto;
  top: 5%;
  left: auto;
  right: 400px;
  color: #b91c1c;
  transform: rotate(6deg);
  text-shadow: 
    0.5px 0.5px 0 #b91c1c,
    -0.2px 0.2px 0 rgba(185, 28, 28, 0.3);
}

.margin-note-red::before {
  background: linear-gradient(to bottom, transparent, #b91c1c 20%, #b91c1c 80%, transparent);
}

.page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: page-fade 0.9s ease both;
}

.page-right {
  animation-delay: 0.12s;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.page-number {
  font-weight: 700;
}

.page-rule {
  width: 100%;
  height: 2px;
  background: var(--line);
}

.page-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

h1 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-size: clamp(3.8rem, 6.4vw, 5.6rem);
  letter-spacing: 0.08em;
  line-height: 0.94;
}

.subtitle {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.lede {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
  max-width: 92%;
  letter-spacing: 0.02em;
}

.diagram {
  position: relative;
  margin: 8px 0 0;
  padding: 0;
  background: var(--paper);
  box-shadow: 3px 3px 0 rgba(26, 23, 20, 0.18);
  animation: diagram-rise 1s ease both;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 360px;
}

.diagram::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 4px solid var(--line);
  pointer-events: none;
  z-index: 2;
}

.diagram img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.diagram-right {
  animation-delay: 0.2s;
}

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

.diagram figcaption {
  display: none;
}

.frame {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.8;
}

.device {
  fill: var(--blue-light);
  stroke: var(--line);
  stroke-width: 1.3;
}

.device-light {
  fill: #e8f1f5;
  stroke: var(--line);
  stroke-width: 1.1;
}

.chip {
  fill: var(--blue);
  stroke: var(--line);
  stroke-width: 1.3;
}

.chip-core {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.2;
}

.trace {
  fill: none;
  stroke: var(--blue-dark);
  stroke-width: 1.6;
}

.label {
  font-family: "Space Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  fill: var(--ink);
}

.cloud {
  fill: #e8f2f8;
  stroke: var(--line);
  stroke-width: 1.3;
}

.plate {
  fill: var(--blue-light);
  stroke: var(--line);
  stroke-width: 1.2;
}

.plate-shadow {
  fill: #c7d9e1;
  stroke: var(--line);
  stroke-width: 1;
}

.tower {
  fill: var(--blue);
  stroke: var(--line);
  stroke-width: 1.2;
}

.callout {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.2;
}

.module-panel {
  border: 2px solid var(--line);
  background: var(--panel);
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 10px;
  align-items: start;
  box-shadow: 3px 3px 0 rgba(26, 23, 20, 0.18);
  animation: diagram-rise 1s ease both;
  animation-delay: 0.3s;
}

.panel-title {
  margin: 0 0 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.panel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.78rem;
  display: grid;
  gap: 6px;
}

.module-right {
  display: grid;
  gap: 6px;
}

.access-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
}

.access-row label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

.access-row input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--line);
  background: var(--paper);
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.access-button {
  justify-self: end;
  padding: 8px 16px;
  border: 2px solid var(--line);
  background: #c9dde6;
  font-family: "Space Mono", monospace;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(26, 23, 20, 0.2);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
  color: var(--ink);
  display: inline-block;
  text-align: center;
}

.access-button:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(26, 23, 20, 0.2);
}

.access-button:active {
  transform: translate(0, 0);
  box-shadow: 1px 1px 0 rgba(26, 23, 20, 0.2);
}

.form-status {
  min-height: 1.2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 0;
}

.page-footer {
  margin: 4px 0 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.x-link {
  color: var(--ink-soft);
  opacity: 0.5;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
}

.x-link:hover {
  opacity: 1;
}

@keyframes page-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes diagram-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .spread {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .spread::before {
    top: 50%;
    bottom: auto;
    left: 16px;
    right: 16px;
    height: 12px;
    width: auto;
    transform: translateY(-50%);
  }

  .page-header {
    justify-content: flex-start;
  }

  .page-number {
    margin-left: auto;
  }
}

@media (max-width: 720px) {
  body {
    padding: 18px;
  }

  .spread {
    padding: 18px;
  }

  .lede {
    max-width: 100%;
  }

  .module-panel {
    grid-template-columns: 1fr;
  }

  .access-row {
    grid-template-columns: 1fr;
  }

  .access-button {
    justify-self: stretch;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page,
  .diagram,
  .module-panel {
    animation: none;
  }

  .access-button {
    transition: none;
  }
}
