/*
  GRRC public-site overhaul
  Industrial registry language: warm paper, charcoal infrastructure, signal orange.
  No client-side JavaScript. Motion is decorative and disabled for reduced-motion users.
*/

:root {
  --paper: #fbfaf7;
  --paper-deep: #f2ede4;
  --ink: #24211e;
  --ink-2: #625d57;
  --rule: #d7cfc4;
  --rule-strong: #a99f94;
  --accent: #7b3300;
  --accent-deep: #542300;
  --accent-graphic: #f05a00;
  --signal: #f05a00;
  --signal-hot: #ff7a00;
  --signal-pale: #fff0e3;
  --gold: #d19b17;
  --box: #f7f2ea;
  --mono-bg: #f3eee6;
  --dark: #23201d;
  --dark-2: #302b26;
  --dark-rule: #4c453e;
  --shadow: 0 22px 60px rgba(43, 32, 22, 0.11);
  --shell: 74rem;
  --reading: 48rem;
}

html {
  scroll-behavior: smooth;
}

body {
  background:
    linear-gradient(90deg, rgba(43, 33, 24, 0.025) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--paper);
  color: var(--ink);
  font-size: 1.0625rem;
}

::selection {
  background: #ffd7b6;
  color: var(--ink);
}

.skip {
  z-index: 100;
  background: var(--dark);
  border-bottom: 3px solid var(--signal);
}

:focus-visible {
  outline: 3px solid #9b3d00;
  outline-offset: 3px;
}

/* Registry header */

.header-bar {
  background: rgba(251, 250, 247, 0.96);
  border-top: 0;
  border-bottom-color: var(--rule);
  box-shadow: 0 8px 30px rgba(36, 33, 30, 0.055);
  backdrop-filter: blur(12px);
}

.header-bar::before {
  content: "";
  display: block;
  height: 4px;
  background: linear-gradient(90deg, var(--signal) 0 23%, var(--signal-hot) 23% 34%, var(--dark) 34% 100%);
}

.site-header {
  max-width: var(--shell);
  min-height: 4.75rem;
  padding: 0.8rem 1.25rem;
  gap: 0.75rem 1.55rem;
}

.wordmark {
  gap: 0.72rem;
  color: var(--ink);
  line-height: 1;
}

.wordmark img {
  width: 29px;
  height: auto;
  filter: drop-shadow(0 4px 7px rgba(91, 43, 5, 0.14));
}

.wordmark-type {
  display: grid;
  gap: 0.25rem;
}

.wordmark-type > span {
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.wordmark-type small {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.site-header nav ul {
  gap: 0.4rem 1.2rem;
}

.site-header nav a {
  position: relative;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.065em;
  text-transform: uppercase;
}

.site-header nav a:hover {
  text-decoration: none;
}

.site-header nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -0.45rem;
  height: 2px;
  background: var(--signal);
  transition: right 180ms ease;
}

.site-header nav a:hover::after,
.site-header nav a[aria-current="page"]::after {
  right: 0;
}

.site-header nav a[aria-current="page"] {
  text-decoration: none;
}

.verify-btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--dark);
  border: 1px solid var(--dark);
  border-radius: 2px;
  padding: 0.64rem 1rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.075em;
  text-transform: uppercase;
  box-shadow: inset 4px 0 0 var(--signal);
}

.verify-btn::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 100% 0 0;
  background: linear-gradient(90deg, #a73d00, var(--signal));
  transition: inset 220ms ease;
}

.verify-btn:hover {
  background: var(--dark);
}

.verify-btn:hover::after {
  inset: 0;
}

/* Shared layout and document surfaces */

main {
  max-width: var(--shell);
  padding: 3.5rem 1.25rem 5rem;
}

.interior-page main {
  max-width: 54rem;
  position: relative;
}

.interior-page main::before {
  content: "";
  position: absolute;
  top: 4rem;
  bottom: 5rem;
  left: -2.25rem;
  width: 1px;
  background: var(--rule);
}

.interior-page main::after {
  content: "GRRC / PUBLIC RECORD";
  position: absolute;
  top: 4rem;
  left: -3rem;
  transform: translateX(-100%) rotate(-90deg);
  transform-origin: top right;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--ink-2);
}

h1,
h2,
h3,
h4 {
  color: var(--ink);
}

h1 {
  font-size: clamp(2.45rem, 6vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

h2 {
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  letter-spacing: -0.015em;
}

.interior-page h2 {
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule);
}

h3 {
  font-size: 1.22rem;
}

a {
  text-decoration-thickness: 1px;
  text-underline-offset: 0.23em;
}

.eyebrow,
.d-kicker {
  font-family: var(--mono);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.integrity,
.page-note,
.sil-body,
pre,
.iv1 {
  border-radius: 2px;
}

.integrity {
  position: relative;
  border-left: 4px solid var(--signal);
  background:
    linear-gradient(90deg, var(--signal-pale), transparent 28%),
    var(--box);
}

.page-note {
  border-left-color: var(--signal);
  background: var(--box);
}

.iv1 {
  max-width: var(--reading);
  border-top: 3px solid var(--signal);
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 15px 45px rgba(43, 32, 22, 0.055);
}

.table-wrap {
  border-top: 3px solid var(--dark);
  border-bottom: 1px solid var(--rule);
  background: rgba(255, 255, 255, 0.42);
}

th,
td {
  padding: 0.7rem 1rem 0.7rem 0.3rem;
}

thead th {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Home hero */

.home-page main {
  max-width: none;
  padding: 0;
}

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(22rem, 0.72fr);
  align-items: center;
  gap: clamp(2.75rem, 7vw, 7.5rem);
  min-height: min(48rem, calc(100vh - 4.75rem));
  margin: 0;
  padding: clamp(4.5rem, 10vw, 8rem) max(1.25rem, calc((100vw - var(--shell)) / 2));
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(255,255,255,0.72), rgba(251,250,247,0.2) 55%),
    var(--paper-deep);
  border-bottom: 1px solid var(--rule);
}

.hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(44vw, 38rem);
  aspect-ratio: 1;
  right: -10rem;
  top: 7%;
  border: 1px solid rgba(240, 90, 0, 0.23);
  box-shadow:
    0 0 0 4rem rgba(240, 90, 0, 0.035),
    0 0 0 9rem rgba(36, 33, 30, 0.025);
  transform: rotate(45deg);
}

.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 49.95%, rgba(74, 63, 53, 0.06) 50%, transparent 50.05%),
    linear-gradient(0deg, transparent 0 49.95%, rgba(74, 63, 53, 0.045) 50%, transparent 50.05%);
  background-size: 96px 96px;
  mask-image: linear-gradient(90deg, transparent 5%, black 70%);
}

.hero-copy {
  max-width: 46rem;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.25rem;
  color: var(--accent);
}

.hero .eyebrow::before {
  content: "";
  width: 2.4rem;
  height: 4px;
  background: linear-gradient(90deg, var(--signal), var(--signal-hot));
}

.hero h1 {
  max-width: 11ch;
  margin: 0 0 1.5rem;
  font-size: clamp(3.25rem, 6.5vw, 6.25rem);
  line-height: 0.91;
  letter-spacing: -0.055em;
}

.hero .lead {
  max-width: 43rem;
  margin: 0 0 1.2rem;
  padding-left: 1.25rem;
  border-left: 3px solid var(--signal);
  font-size: clamp(1.1rem, 1.7vw, 1.3rem);
  line-height: 1.6;
}

.hero .audience {
  max-width: 42rem;
  color: var(--ink);
}

.hero .disclosure {
  max-width: 41rem;
  margin-top: 1.7rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.65;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

/* CSS-only protocol console */

.protocol-panel {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.035), transparent 42%),
    var(--dark);
  color: #fffaf2;
  border: 1px solid #0e0d0c;
  border-radius: 3px;
  box-shadow: var(--shadow);
}

.protocol-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.protocol-panel::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18%;
  background: linear-gradient(90deg, transparent, rgba(255, 107, 0, 0.08), transparent);
  transform: skewX(-12deg);
  animation: console-scan 7s ease-in-out infinite;
  pointer-events: none;
}

.protocol-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border-top: 5px solid var(--signal);
  border-bottom: 1px solid var(--dark-rule);
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #cfc7bd;
}

.protocol-head span:last-child {
  color: #ff9b57;
}

.protocol-steps {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 1.2rem 1.2rem 0.7rem;
}

.protocol-steps::before {
  content: "";
  position: absolute;
  top: 2.15rem;
  bottom: 1.7rem;
  left: 2.18rem;
  width: 2px;
  background: linear-gradient(var(--signal), #6b3c22);
}

.protocol-steps li {
  position: relative;
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.9rem;
  align-items: start;
  padding: 0.45rem 0 1.25rem;
}

.protocol-index {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  background: var(--dark);
  border: 2px solid var(--signal);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 750;
  color: #ffae75;
}

.protocol-steps strong,
.protocol-steps small,
.protocol-floor strong,
.protocol-floor small {
  display: block;
}

.protocol-steps strong {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: #fffaf2;
}

.protocol-steps small {
  margin-top: 0.15rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: #aaa198;
}

.protocol-floor {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 0.8rem 1fr;
  gap: 0.85rem;
  align-items: center;
  padding: 1rem 1.2rem;
  background: rgba(240, 90, 0, 0.11);
  border-top: 1px solid rgba(240, 90, 0, 0.46);
}

.protocol-pulse {
  width: 0.65rem;
  height: 0.65rem;
  background: var(--signal-hot);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.55);
  animation: protocol-pulse 2.4s ease-out infinite;
}

.protocol-floor small {
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #ff9b57;
}

.protocol-floor strong {
  margin-top: 0.14rem;
  font-size: 0.82rem;
  color: #fffaf2;
}

/* Numbered registry sections */

.home-section {
  position: relative;
  width: min(calc(100% - 2.5rem), var(--shell));
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) 0;
  border-bottom: 1px solid var(--rule);
}

.home-section::before {
  content: attr(data-section);
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.32rem 0.55rem 0.28rem;
  background: var(--dark);
  color: #fffaf2;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  box-shadow: inset 4px 0 var(--signal);
}

.home-section h2 {
  max-width: 16ch;
  margin: 0 0 0.75rem;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.home-section > p:not(.more) {
  max-width: var(--reading);
  font-size: 1.08rem;
}

.home-section .more a {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-claim .iv1 {
  margin-top: 2.25rem;
}

.section-status {
  width: 100%;
  max-width: none;
  padding-right: max(1.25rem, calc((100vw - var(--shell)) / 2));
  padding-left: max(1.25rem, calc((100vw - var(--shell)) / 2));
  background:
    linear-gradient(90deg, rgba(240,90,0,0.12), transparent 30%),
    var(--dark);
  border-bottom: 5px solid var(--signal);
  color: #ded7ce;
}

.section-status::before {
  background: #fffaf2;
  color: var(--dark);
}

.section-status h2 {
  color: #fffaf2;
}

.section-status > p:not(.more) {
  color: #d5cdc4;
}

.section-status a {
  color: #ffac72;
}

.benefit-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 2.25rem;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.benefit-cards li {
  position: relative;
  min-height: 13rem;
  padding: 1.35rem 1.3rem 1.5rem;
  background: var(--paper);
  border: 0;
  border-radius: 0;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.benefit-cards li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3.5rem;
  height: 4px;
  background: var(--signal);
}

.benefit-cards li:hover {
  z-index: 1;
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(43, 32, 22, 0.12);
}

.benefit-cards h3 {
  margin-top: 0.3rem;
  font-size: 1.2rem;
}

.benefit-cards p {
  font-size: 0.9rem;
  line-height: 1.58;
}

.record-compact {
  max-width: none;
  margin-top: 2rem;
  border-top: 3px solid var(--dark);
}

.record-compact li {
  display: grid;
  grid-template-columns: minmax(14rem, 0.72fr) minmax(0, 1.28fr);
  gap: 1.5rem;
  align-items: start;
  padding: 1rem 0.4rem;
}

.record-compact li:hover {
  background: linear-gradient(90deg, var(--signal-pale), transparent 48%);
}

.record-compact .rec-name {
  font-family: var(--serif);
  font-size: 1.08rem;
}

/* Protocol plates */

.diagram-shell {
  width: 100%;
  margin: 2.4rem 0 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: var(--signal) var(--paper-deep);
  border: 1px solid var(--rule);
  border-top: 4px solid var(--dark);
  border-radius: 3px;
  background: var(--paper-deep);
  box-shadow: var(--shadow);
}

.diagram-shell:focus-visible {
  outline-offset: 5px;
}

.diagram {
  width: 100%;
  min-width: 760px;
  margin: 0;
}

.diagram * {
  vector-effect: non-scaling-stroke;
}

.diagram .d-plate-bg { fill: #f8f4ed; }
.diagram .d-grid-line { stroke: #ded7cd; }
.diagram .d-signal-fill { fill: var(--signal); }
.diagram .d-dark-fill { fill: var(--dark); }
.diagram .d-stage-head { fill: #ebe4da; }
.diagram .d-final-bg { fill: #fff9f2; }
.diagram .d-final-head { fill: var(--dark); }
.diagram .d-muted-fill { fill: #9c9288; }
.diagram .d-muted-panel { fill: #f0ebe4; }
.diagram .d-on-dark { fill: #fffaf2; }
.diagram .d-stroke-signal { stroke: var(--signal); }
.diagram .d-flow-line {
  stroke: var(--signal);
  stroke-dasharray: 10 8;
  animation: signal-flow 4.5s linear infinite;
}
.diagram .d-d2-bus {
  display: none;
}

.diagram[data-diagram="D2"] .d-flow-line {
  stroke-linecap: round;
  animation-duration: 3.2s;
  filter: drop-shadow(0 0 2px rgba(240, 90, 0, 0.24));
}

.diagram[data-diagram="D3"] .d-flow-line {
  stroke-linecap: round;
  animation-duration: 2.7s;
  filter: drop-shadow(0 0 2px rgba(240, 90, 0, 0.28));
}

.diagram .d-self-loop {
  stroke: #a34812;
  stroke-linecap: round;
  stroke-dasharray: 13 9;
  animation: signal-flow 5.2s linear infinite;
  filter: drop-shadow(0 0 2px rgba(163, 72, 18, 0.18));
}

.diagram .d-loop-chevron {
  fill: none;
  stroke: #a34812;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diagram .d-flow-packet {
  filter: drop-shadow(0 0 3px rgba(240, 90, 0, 0.55));
}

.diagram .d-loop-packet {
  fill: #c65314;
}

.diagram[data-diagram="D3"] > text[y="516"] {
  display: none;
}
.diagram .d-boundary { stroke: #8b8178; }

.section-claim .diagram-shell {
  margin-top: 2.8rem;
}

/* Footer */

.site-footer {
  max-width: none;
  margin: 0;
  padding: 2rem max(1.25rem, calc((100vw - var(--shell)) / 2)) 3rem;
  background: #191715;
  border-top: 0;
  color: #aaa198;
}

.site-footer::before {
  content: "GRRC / GLOBAL ROBOT REGISTRATION & CERTIFICATION";
  display: block;
  margin-bottom: 1.1rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #ff9b57;
}

.site-footer a {
  color: #d8d0c7;
}

/* Motion */

@keyframes console-scan {
  0%, 14% { left: -30%; opacity: 0; }
  28% { opacity: 1; }
  58%, 100% { left: 112%; opacity: 0; }
}

@keyframes protocol-pulse {
  0% { box-shadow: 0 0 0 0 rgba(255, 122, 0, 0.5); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(255, 122, 0, 0); }
}

@keyframes signal-flow {
  to { stroke-dashoffset: -72; }
}

/* Responsive states */

@media (max-width: 68rem) {
  .benefit-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .interior-page main::before,
  .interior-page main::after {
    display: none;
  }
}

@media (max-width: 56rem) {
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
    gap: 3rem;
  }

  .hero-copy {
    max-width: 50rem;
  }

  .protocol-panel {
    width: min(100%, 38rem);
  }
}

@media (max-width: 45.99em) {
  html {
    scroll-behavior: auto;
  }

  .site-header {
    min-height: 4.1rem;
    padding: 0.62rem 0.75rem;
    gap: 0.55rem;
  }

  .wordmark {
    gap: 0.5rem;
  }

  .wordmark img {
    width: 25px;
  }

  .wordmark-type > span {
    font-size: 1.08rem;
  }

  .wordmark-type small {
    display: none;
  }

  .nav-toggle {
    margin-left: auto;
  }

  .nav-toggle > summary {
    border-radius: 2px;
    padding: 0.42rem 0.55rem;
    background: var(--paper);
    font-size: 0.68rem;
  }

  .verify-btn {
    order: 0;
    margin-left: 0;
    padding: 0.52rem 0.65rem;
    font-size: 0.64rem;
  }

  .site-nav {
    order: 2;
    padding-top: 0.5rem;
    border-top: 1px solid var(--rule);
  }

  .site-header nav ul {
    gap: 0;
    padding: 0;
  }

  .site-nav a {
    display: block;
    padding: 0.65rem 0.25rem;
  }

  .hero {
    padding-top: 4.25rem;
    padding-bottom: 4.5rem;
  }

  .hero h1 {
    font-size: clamp(3.05rem, 15vw, 4.5rem);
  }

  .home-section {
    width: min(calc(100% - 2rem), var(--shell));
    padding: 4rem 0;
  }

  .section-status {
    width: 100%;
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .benefit-cards {
    grid-template-columns: 1fr;
  }

  .benefit-cards li {
    min-height: 0;
  }

  .record-compact li {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  .interior-page main {
    padding-top: 2.5rem;
  }

  .diagram {
    min-width: 720px;
  }
}

@media (max-width: 23.5rem) {
  .site-header {
    gap: 0.35rem;
    padding-inline: 0.55rem;
  }

  .wordmark img {
    width: 23px;
  }

  .wordmark-type > span {
    font-size: 0.98rem;
  }

  .nav-toggle > summary,
  .verify-btn {
    font-size: 0.6rem;
  }

  .hero .lead {
    padding-left: 0.9rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .protocol-panel::after {
    display: none;
  }

  .diagram .d-flow-packet {
    display: none;
  }

  .diagram .d-self-loop {
    stroke-dasharray: none;
  }
}

@media print {
  .header-bar::before {
    display: none;
  }

  .hero,
  .section-status {
    background: #fff;
    color: #000;
  }

  .section-status h2,
  .section-status p {
    color: #000;
  }

  .protocol-panel {
    display: none;
  }

  .diagram {
    min-width: 0;
  }
}
