:root {
  --navy-950: #081016;
  --navy-900: #0d1820;
  --navy-850: #12202a;
  --navy-800: #172a35;
  --metal-700: #3a4449;
  --metal-500: #657177;
  --metal-300: #a4adb0;
  --paper: #e3e0d2;
  --paper-dim: #b9b7ac;
  --brass: #b3955f;
  --brass-bright: #c7a86b;
  --amber: #d29a4a;
  --phosphor: #9dbc86;
  --phosphor-bright: #bfd6a6;
  --danger: #d57860;
  --line: rgba(196, 177, 125, 0.24);
  --shadow: rgba(0, 0, 0, 0.42);
  --max: 1180px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  background: var(--navy-950);
}

body {
  margin: 0;
  color: var(--paper);
  background:
    radial-gradient(circle at 15% 8%, rgba(157, 188, 134, 0.08), transparent 22rem),
    linear-gradient(rgba(179, 149, 95, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(179, 149, 95, 0.025) 1px, transparent 1px),
    var(--navy-950);
  background-size: auto, 38px 38px, 38px 38px, auto;
  font-family: "IBM Plex Sans", "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  line-height: 1.7;
  letter-spacing: 0.025em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,0.012) 4px),
    radial-gradient(circle at 72% 28%, rgba(185, 151, 89, 0.055) 0 2px, transparent 3px),
    radial-gradient(circle at 31% 65%, rgba(157, 188, 134, 0.035) 0 1px, transparent 2px);
}

a {
  color: var(--phosphor-bright);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: #e3ebd7;
}

button,
input,
textarea {
  font: inherit;
}

button,
a,
input,
textarea {
  outline-offset: 4px;
}

:focus-visible {
  outline: 2px solid var(--phosphor-bright);
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100;
  transform: translateY(-160%);
  padding: 0.65rem 0.9rem;
  color: var(--navy-950);
  background: var(--phosphor-bright);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  min-height: 74px;
  padding: 0.8rem max(1.2rem, calc((100vw - var(--max)) / 2));
  border-bottom: 1px solid rgba(179, 149, 95, 0.28);
  background: rgba(8, 16, 22, 0.91);
  backdrop-filter: blur(12px);
}

.brand-mini {
  display: grid;
  color: var(--paper);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-mini small {
  margin-top: -0.15rem;
  color: var(--brass);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.18em;
}

.site-header nav {
  display: flex;
  gap: clamp(0.75rem, 2vw, 1.6rem);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.77rem;
  text-transform: uppercase;
}

.site-header nav a {
  color: var(--paper-dim);
  text-decoration: none;
}

.site-header nav a:hover {
  color: var(--phosphor-bright);
}

main {
  overflow: hidden;
}

.panel-section,
.content-section,
.lab-footer {
  width: min(var(--max), calc(100% - 2.4rem));
  margin-inline: auto;
}

.hero {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding: clamp(4rem, 8vw, 8rem) 0;
}

.hero-copy h1,
.section-heading h2,
.why-copy strong {
  text-wrap: balance;
}

.hero-copy h1 {
  margin: 0.35rem 0 0;
  font-size: clamp(2.6rem, 7vw, 6.3rem);
  line-height: 0.98;
  letter-spacing: 0.035em;
  color: #d8d1bb;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}

.english-name {
  margin: 0.7rem 0 0;
  color: var(--brass-bright);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: clamp(1rem, 2vw, 1.55rem);
  font-weight: 750;
  letter-spacing: 0.2em;
}

.thesis {
  margin: 2rem 0 0.6rem;
  color: var(--phosphor);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.hero-copy h2 {
  margin: 0;
  max-width: 11ch;
  font-size: clamp(2rem, 4.6vw, 4.7rem);
  line-height: 1.15;
  letter-spacing: 0.015em;
}

.lead {
  max-width: 48rem;
  margin: 1.7rem 0 0;
  color: var(--paper-dim);
  font-size: clamp(1rem, 1.5vw, 1.15rem);
}

.instrument-label {
  margin: 0;
  color: var(--brass);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.instrument-label::before {
  content: "●";
  margin-right: 0.6rem;
  color: var(--amber);
  font-size: 0.62em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.75rem 1.1rem;
  border: 1px solid var(--brass);
  border-radius: 2px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  color: #10171b;
  background: var(--brass-bright);
  box-shadow: 0 5px 22px rgba(179, 149, 95, 0.12);
}

.button-primary:hover:not(:disabled) {
  color: #0a1014;
  background: #d4b87d;
}

.button-ghost {
  color: var(--paper);
  background: rgba(255,255,255,0.015);
}

.button:disabled {
  opacity: 0.44;
  cursor: not-allowed;
}

.scope-unit {
  position: relative;
  padding: 1.1rem;
  border: 1px solid #4a565b;
  border-radius: 16px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.05), transparent 8rem),
    linear-gradient(145deg, #283239, #111b22 54%, #0c151b);
  box-shadow:
    0 24px 70px var(--shadow),
    inset 0 0 0 3px #091015,
    inset 0 0 0 4px rgba(179, 149, 95, 0.18);
}

.scope-unit::before,
.scope-unit::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid #6a6e68;
  border-radius: 50%;
  background: #1a242a;
  box-shadow: inset 2px 2px 2px #080b0d;
}

.scope-unit::before { top: 10px; left: 10px; }
.scope-unit::after { right: 10px; bottom: 10px; }

.scope-meta,
.scope-readout {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: #a79166;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
}

.scope-meta {
  padding: 0 0.4rem 0.7rem;
}

.scope-readout {
  padding: 0.65rem 0.4rem 0;
  color: #7f8c7b;
}

.scope-screen {
  display: block;
  width: 100%;
  filter: drop-shadow(0 0 12px rgba(157, 188, 134, 0.12));
}

.scope-bg {
  fill: #0b1817;
  stroke: #58665e;
  stroke-width: 5;
}

.scope-grid-minor {
  stroke: rgba(146, 178, 133, 0.08);
  stroke-width: 1;
}

.scope-grid-major {
  stroke: rgba(146, 178, 133, 0.16);
  stroke-width: 1.2;
}

.scope-axis {
  stroke: rgba(176, 202, 159, 0.22);
  stroke-width: 1;
}

.scope-trace {
  fill: none;
  stroke: var(--phosphor-bright);
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 5px rgba(191, 214, 166, 0.52));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: trace-in 1.8s ease-out 0.2s forwards;
}

@keyframes trace-in {
  to { stroke-dashoffset: 0; }
}

.content-section {
  position: relative;
  padding: clamp(5rem, 10vw, 9rem) 0;
  border-top: 1px solid var(--line);
}

.content-section::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 34%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--brass));
}

.section-heading {
  max-width: 820px;
  margin-bottom: 2.4rem;
}

.section-heading h2 {
  margin: 0.7rem 0 0.8rem;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.18;
}

.section-heading > p:last-child {
  color: var(--paper-dim);
}

.problem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.problem-grid article {
  min-height: 150px;
  padding: 1.35rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(255,255,255,0.018), transparent 60%);
}

.problem-grid span {
  color: var(--brass);
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
}

.problem-grid p {
  max-width: 28ch;
  margin: 1.2rem 0 0;
  font-size: clamp(1.08rem, 1.8vw, 1.35rem);
}

.section-emphasis {
  margin-top: 2rem;
  color: var(--phosphor-bright);
  font-size: clamp(1.2rem, 2vw, 1.6rem);
  font-weight: 750;
}

.route-flow {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  margin: 3rem 0 0;
  padding: 1px;
  list-style: none;
  background: var(--line);
}

.route-flow li {
  position: relative;
  min-height: 180px;
  padding: 1rem;
  background: var(--navy-900);
}

.route-flow li:not(:last-child)::after {
  content: "→";
  position: absolute;
  right: -0.75rem;
  top: 50%;
  z-index: 2;
  width: 1.5rem;
  text-align: center;
  color: var(--phosphor);
  background: var(--navy-900);
}

.route-flow span,
.project-status,
.counter-unit,
.motto {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.route-flow span {
  display: block;
  color: var(--brass);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.route-flow strong {
  display: block;
  margin-top: 3rem;
  font-size: 1rem;
}

.motto {
  margin: 2rem 0 0;
  color: var(--phosphor);
  letter-spacing: 0.18em;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.project-card {
  min-height: 360px;
  padding: 1.25rem;
  border: 1px solid #404d53;
  background:
    linear-gradient(115deg, rgba(179, 149, 95, 0.045), transparent 40%),
    #0e1920;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.22);
}

.project-status {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed rgba(179, 149, 95, 0.3);
  color: var(--brass);
  font-size: 0.65rem;
}

.project-card h3 {
  margin: 2rem 0 1rem;
  font-size: 1.7rem;
}

.project-card p {
  color: var(--paper-dim);
}

.project-card a {
  display: inline-block;
  margin-top: 1.25rem;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
}

.why-section {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: clamp(2rem, 7vw, 7rem);
}

.why-copy {
  max-width: 720px;
  padding: clamp(1.5rem, 4vw, 3rem);
  border-left: 2px solid var(--brass);
  background: rgba(227, 224, 210, 0.035);
}

.why-copy p {
  margin: 0 0 1.5rem;
  font-size: clamp(1rem, 1.8vw, 1.2rem);
}

.consultation-section form {
  display: grid;
  gap: 1rem;
  max-width: 900px;
  padding: clamp(1rem, 4vw, 2.4rem);
  border: 1px solid #48535a;
  background:
    linear-gradient(rgba(179,149,95,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(179,149,95,0.025) 1px, transparent 1px),
    #0d171e;
  background-size: 32px 32px;
}

.field-row.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.45rem;
}

label > span {
  color: var(--paper-dim);
  font-size: 0.88rem;
}

label b {
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 700;
}

label small {
  color: var(--metal-300);
}

input,
textarea {
  width: 100%;
  border: 1px solid #536068;
  border-radius: 0;
  padding: 0.8rem 0.85rem;
  color: var(--paper);
  background: #081116;
  caret-color: var(--phosphor-bright);
}

textarea {
  resize: vertical;
}

input:hover,
textarea:hover {
  border-color: #758086;
}

input:focus,
textarea:focus {
  border-color: var(--phosphor);
  box-shadow: 0 0 0 1px rgba(157, 188, 134, 0.25);
}

.turnstile-slot {
  min-height: 70px;
  display: flex;
  align-items: center;
  padding: 0.9rem;
  border: 1px dashed rgba(179, 149, 95, 0.38);
  color: var(--paper-dim);
  background: rgba(0,0,0,0.14);
}

.turnstile-slot p {
  margin: 0;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.turnstile-slot strong {
  color: var(--amber);
}

.consultation-boundary {
  max-width: 70ch;
  margin: 0.8rem 0 0;
  padding-left: 1rem;
  border-left: 2px solid var(--amber);
  color: var(--paper-dim);
  font-size: 0.92rem;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

#form-status {
  margin: 0;
  color: var(--paper-dim);
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
}

.lab-footer {
  margin-top: 4rem;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--line);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.footer-grid p {
  margin: 0.2rem 0;
  color: #869091;
  font-size: 0.78rem;
}

.footer-grid strong {
  color: var(--phosphor);
}

.counter-unit {
  display: grid;
  justify-items: end;
  gap: 0.3rem;
}

.counter-unit > span,
.counter-unit small {
  color: #7f898b;
  font-size: 0.65rem;
}

.counter-unit strong {
  color: var(--phosphor-bright);
  font-size: clamp(1.2rem, 3vw, 2.4rem);
  letter-spacing: 0.08em;
  text-shadow: 0 0 8px rgba(191, 214, 166, 0.23);
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed rgba(179, 149, 95, 0.25);
  color: #697477;
  font-size: 0.72rem;
}

.footer-links span {
  margin-left: auto;
}

@media (max-width: 900px) {
  .hero,
  .why-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
  }

  .scope-unit {
    max-width: 680px;
  }

  .route-flow {
    grid-template-columns: 1fr;
  }

  .route-flow li {
    min-height: auto;
    padding: 1.1rem;
  }

  .route-flow li:not(:last-child)::after {
    content: "↓";
    right: auto;
    left: 50%;
    top: auto;
    bottom: -0.75rem;
  }

  .route-flow strong {
    margin-top: 0.9rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .site-header {
    align-items: flex-start;
  }

  .site-header nav {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 0.25rem 0.8rem;
  }

  .problem-grid,
  .field-row.two-column,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .counter-unit {
    justify-items: start;
  }

  .footer-links span {
    width: 100%;
    margin-left: 0;
  }

  .scope-readout {
    display: grid;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .scope-trace {
    stroke-dashoffset: 0;
  }
}
