:root {
  color-scheme: dark;
  --black: #000;
  --white: #f2f2f0;
  --soft: #a6a6a0;
  --line: #3a3a38;
  --panel: #080808;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--white);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px),
    var(--black);
  background-size: 36px 36px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 16px;
  line-height: 1.5;
}

button, input { font: inherit; }

a { color: inherit; }

.noise {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: .08;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255,255,255,.13) 4px);
  mix-blend-mode: screen;
}

.terminal {
  width: min(1180px, calc(100% - 40px));
  margin: 20px auto;
  border: 1px solid var(--white);
  background: rgba(0,0,0,.94);
}

.topbar,
.console__head,
footer {
  display: grid;
  align-items: center;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.topbar {
  grid-template-columns: 1fr auto 1fr;
  min-height: 48px;
  border-bottom: 1px solid var(--white);
  font-size: .8rem;
}

.topbar > * { padding: 0 16px; }

.topbar__brand { font-weight: 800; }
.topbar__status { color: var(--soft); border-inline: 1px solid var(--line); }
.topbar__clock { text-align: right; }

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--white);
  box-shadow: 0 0 14px rgba(255,255,255,.8);
}

.hero {
  position: relative;
  min-height: clamp(390px, 63vw, 650px);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--white);
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.hero::before {
  inset: 28px;
  border: 1px solid var(--line);
  clip-path: polygon(0 0, 12% 0, 12% 1px, 88% 1px, 88% 0, 100% 0, 100% 100%, 88% 100%, 88% calc(100% - 1px), 12% calc(100% - 1px), 12% 100%, 0 100%);
}

.hero::after {
  left: 0;
  right: 0;
  height: 1px;
  top: 50%;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
}

.hero__index {
  position: absolute;
  top: 42px;
  left: 42px;
  color: var(--soft);
  font-size: .78rem;
  letter-spacing: .12em;
}

.hero__logo {
  position: relative;
  z-index: 1;
  display: block;
  width: min(92%, 970px);
  height: auto;
  margin: -8% 0;
  filter: contrast(1.22) brightness(1.08);
  user-select: none;
}

.hero__readout {
  position: absolute;
  z-index: 2;
  right: 42px;
  bottom: 42px;
  display: flex;
  gap: 22px;
  color: var(--soft);
  font-size: .72rem;
  letter-spacing: .08em;
}

.console {
  min-height: 260px;
  border-bottom: 1px solid var(--white);
  background: var(--panel);
}

.console__head {
  grid-template-columns: 1fr auto;
  min-height: 42px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  color: var(--soft);
  font-size: .75rem;
}

.console__output {
  height: 150px;
  overflow-y: auto;
  padding: 16px 18px 8px;
  scrollbar-color: var(--white) var(--black);
}

.console__output p { margin: 0 0 5px; }
.dim { color: var(--soft); }

.prompt {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border-top: 1px solid var(--line);
}

.prompt label { white-space: nowrap; }

.prompt input {
  min-width: 0;
  flex: 1;
  padding: 10px;
  border: 0;
  outline: 0;
  color: var(--white);
  background: transparent;
  text-transform: uppercase;
  caret-color: transparent;
}

.cursor {
  width: 9px;
  height: 18px;
  background: var(--white);
  animation: blink .9s steps(1) infinite;
}

.links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--white);
}

.terminal-link {
  min-height: 106px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  text-decoration: none;
  transition: color 140ms ease, background 140ms ease;
}

.terminal-link + .terminal-link { border-left: 1px solid var(--white); }
.terminal-link span, .terminal-link em { color: var(--soft); font-size: .78rem; font-style: normal; }
.terminal-link:hover, .terminal-link:focus-visible { color: var(--black); background: var(--white); outline: 0; }
.terminal-link:hover span, .terminal-link:hover em, .terminal-link:focus-visible span, .terminal-link:focus-visible em { color: var(--black); }
.terminal-link[aria-disabled="true"] { color: #555; cursor: not-allowed; }
.terminal-link[aria-disabled="true"]:hover { color: #555; background: transparent; }

.contract {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 96px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--white);
  gap: 20px;
}

.contract__label { display: block; margin-bottom: 6px; color: var(--soft); font-size: .72rem; letter-spacing: .1em; }
.contract code { overflow-wrap: anywhere; color: var(--white); }

.contract button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--white);
  border-radius: 0;
  color: var(--white);
  background: var(--black);
  cursor: pointer;
}

.contract button:hover:not(:disabled), .contract button:focus-visible:not(:disabled) { color: var(--black); background: var(--white); outline: 0; }
.contract button:disabled { color: #555; border-color: #555; cursor: not-allowed; }

footer {
  grid-template-columns: repeat(3, 1fr);
  min-height: 52px;
  padding: 0 18px;
  color: var(--soft);
  font-size: .72rem;
}

footer span:nth-child(2) { text-align: center; }
footer span:last-child { text-align: right; }

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  gap: 12px;
  background: #000;
  transition: opacity 250ms ease, visibility 250ms ease;
}

.boot.is-done { opacity: 0; visibility: hidden; }
.boot__line { font-size: .8rem; letter-spacing: .12em; }
.boot__bar { width: min(330px, 72vw); height: 8px; border: 1px solid var(--white); padding: 1px; }
.boot__bar span { display: block; width: 0; height: 100%; background: var(--white); animation: load .75s steps(8) forwards; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes load { to { width: 100%; } }

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

@media (max-width: 720px) {
  .terminal { width: calc(100% - 20px); margin: 10px auto; }
  .topbar { grid-template-columns: 1fr auto; }
  .topbar__status { border-right: 0; }
  .topbar__clock { display: none; }
  .hero { min-height: 400px; }
  .hero::before { inset: 16px; }
  .hero__index { top: 26px; left: 26px; }
  .hero__logo { width: 100%; max-width: none; margin: -5% 0; }
  .hero__readout { left: 26px; right: 26px; bottom: 26px; display: grid; gap: 3px; }
  .links { grid-template-columns: 1fr; }
  .terminal-link { min-height: 70px; }
  .terminal-link + .terminal-link { border-left: 0; border-top: 1px solid var(--white); }
  .contract { grid-template-columns: 1fr; }
  .contract button { width: 100%; }
  footer { grid-template-columns: 1fr 1fr; gap: 8px; padding-block: 14px; }
  footer span:nth-child(2) { display: none; }
}

@media (max-width: 430px) {
  body { font-size: 14px; }
  .topbar > * { padding-inline: 10px; }
  .topbar__status { font-size: .68rem; }
  .hero { min-height: 330px; }
  .hero__logo { width: 100%; margin-inline: 0; }
  .console__output { height: 170px; }
  .prompt { align-items: flex-start; flex-wrap: wrap; padding-block: 12px; }
  .prompt label { width: 100%; }
  .prompt input { padding-left: 0; }
}
