:root {
  color-scheme: light;
  --red: #f1efe8;
  --blue: #3157ff;
  --ink: #101114;
  --paper: #f1efe8;
  --font-mono: "Chivo Mono", monospace;
  --chamfer: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { min-width: 320px; min-height: 100%; scrollbar-gutter: stable; }
body {
  min-height: 100%;
  color: var(--paper);
  background: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
body > svg { display: none; }
::selection { color: var(--ink); background: rgba(16, 17, 20, 0.12); }

.scanlines,
.noise,
.rgb-fringe { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; }
.scanlines {
  z-index: 10002;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.08) 2px, rgba(0, 0, 0, 0.08) 4px);
}
.noise { z-index: 10001; opacity: 0.08; filter: url("#grainy"); }
.rgb-fringe {
  z-index: 10003;
  background: linear-gradient(90deg, #e5332a05, #2b4fff04, #e5332a05);
  background-size: 3px 100%;
}

.hero {
  position: relative;
  z-index: 1;
  display: flex;
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  flex-direction: column;
  color: var(--ink);
  background: var(--red);
  overflow: hidden;
}

.site-header { display: flex; position: relative; z-index: 20; }
.site-nav {
  display: flex;
  width: 100%;
  max-width: calc(1200px + 6rem);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 1.5rem 3rem;
}
.site-logo { display: inline-flex; }
.site-logo img { display: block; width: 101px; height: 22px; }

.clono-social-links { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.clono-social-link {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  background: rgba(241, 239, 232, 0.72);
  border: 1px solid rgba(16, 17, 20, 0.22);
  border-radius: 50%;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.clono-social-link:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.clono-social-link:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.clono-social-link svg { width: 1.125rem; height: 1.125rem; fill: currentColor; }

.hero-content {
  position: relative;
  z-index: 10;
  display: flex;
  width: 100%;
  max-width: calc(1200px + 6rem);
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  margin: 0 auto;
  padding: 0 3rem;
}
.hero h1 {
  position: relative;
  margin: 2rem 0 2rem;
  color: var(--ink);
  font-family: Chalet, Inter, sans-serif;
  font-size: clamp(3.5rem, 8vw, 7rem);
  line-height: 0.88;
  letter-spacing: -0.04em;
}
.hero-sub {
  max-width: 540px;
  margin-bottom: 2.5rem;
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.6;
  opacity: 0.85;
}
.powered-by-hermes { white-space: nowrap; }
.hermes-highlight {
  display: inline-block;
  margin-left: 0.12em;
  padding: 0.06em 0.32em 0.1em;
  color: var(--ink);
  background: rgba(16, 17, 20, 0.12);
  border-radius: 0.15em;
}
.hero-actions { display: flex; gap: 1rem; margin-bottom: 3rem; }

.btn-chamfer {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  color: var(--paper);
  background: var(--ink);
  border: none;
  clip-path: polygon(var(--chamfer) 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%, 0 var(--chamfer));
  font-family: "Chivo Mono", monospace;
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: filter 160ms ease, background-color 160ms ease, color 160ms ease;
}
.btn-chamfer:hover { filter: contrast(0.82); }
.btn-chamfer:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.secondary-cta { color: var(--ink); background: transparent; border: 2px solid rgba(10, 10, 10, 0.3); }

.hero-watermark {
  position: absolute;
  top: 50%;
  right: -5%;
  width: 55%;
  opacity: 0.08;
  transform: translateY(-50%);
  pointer-events: none;
  animation: watermark-glitch 4s infinite linear;
}

.hero-ticker { position: relative; z-index: 10; padding: 0.75rem 0; border-top: 1px solid rgba(10, 10, 10, 0.15); overflow: hidden; }
.hero-ticker-inner {
  display: flex;
  width: max-content;
  gap: 0;
  color: var(--ink);
  font-family: "Geist Pixel Square", monospace;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.7;
  -webkit-text-stroke: 0.5px var(--ink);
  animation: ticker 18s linear infinite;
}
.clono-ticker-group { display: flex; flex: none; gap: 4rem; padding-right: 4rem; }

.agent-dialog {
  width: min(38rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid rgba(16, 17, 20, 0.3);
  border-radius: 0.25rem;
  box-shadow: 0 1.5rem 5rem rgba(16, 17, 20, 0.28);
  overflow: auto;
}
.agent-dialog[open] { animation: dialog-in 220ms cubic-bezier(0.2, 0.75, 0.25, 1) both; }
.agent-dialog::backdrop {
  background: rgba(16, 17, 20, 0.42);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  animation: backdrop-in 220ms ease both;
}
.agent-dialog.is-closing { animation: dialog-out 160ms ease both; }
.agent-dialog.is-closing::backdrop { animation: backdrop-out 160ms ease both; }
.agent-dialog-panel { padding: clamp(1.5rem, 5vw, 2.5rem); }
.agent-dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.agent-dialog h2 {
  margin: 0;
  font-family: Chalet, Inter, sans-serif;
  font-size: clamp(2rem, 6vw, 3.25rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}
.agent-dialog-close {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(16, 17, 20, 0.25);
  border-radius: 50%;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}
.agent-dialog-close:hover { color: var(--paper); background: var(--ink); border-color: var(--ink); }
.agent-dialog-close:focus-visible,
.agent-form-submit:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.agent-dialog-close svg { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.75; }

.agent-form { margin-top: 2rem; }
.agent-step[hidden] { display: none; }
.agent-step:not([hidden]) { animation: step-in 220ms cubic-bezier(0.2, 0.75, 0.25, 1) both; }
.agent-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.agent-field { display: grid; gap: 0.5rem; }
.agent-field-wide { grid-column: 1 / -1; }
.agent-field span { font: 700 0.76rem/1 var(--font-mono); letter-spacing: 0.06em; text-transform: uppercase; }
.agent-field input {
  width: 100%;
  min-height: 3.25rem;
  padding: 0.8rem 0.9rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.38);
  border: 1px solid rgba(16, 17, 20, 0.28);
  border-radius: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
.agent-field input:hover { border-color: rgba(16, 17, 20, 0.55); }
.agent-field input:focus { outline: none; background: #fff; border-color: var(--ink); box-shadow: none; }
.agent-field input:user-invalid { border-color: #8f2828; }
.agent-field input:-webkit-autofill,
.agent-field input:-webkit-autofill:hover,
.agent-field input:-webkit-autofill:focus { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 1000px var(--paper) inset; }
.agent-form-note { margin: 1.25rem 0; color: rgba(16, 17, 20, 0.6); font-size: 0.8rem; line-height: 1.45; }
.agent-step-copy { max-width: 30rem; margin: 0 0 1.5rem; color: rgba(16, 17, 20, 0.7); line-height: 1.55; }
.agent-code-field input { font: 600 1.6rem/1 var(--font-mono); letter-spacing: 0.32em; text-align: center; }
.agent-form-status { margin: -0.25rem 0 1.25rem; padding: 0.9rem 1rem; background: rgba(16, 17, 20, 0.06); border-left: 2px solid var(--ink); font-size: 0.8rem; line-height: 1.45; }
.agent-form-status[data-kind="error"] { border-left-color: #8f2828; }
.agent-form-submit {
  display: flex;
  width: 100%;
  min-height: 3.6rem;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.1rem;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  font: 700 0.82rem/1 var(--font-mono);
  letter-spacing: 0.025em;
  text-align: center;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease;
}
.agent-form-submit:hover { color: var(--ink); background: transparent; }
.agent-form-submit:disabled { cursor: wait; opacity: 0.65; }
.agent-success { padding: 1rem 0 0.35rem; text-align: center; }
.agent-success-check { width: 5rem; height: 5rem; fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; stroke-width: 3; }
.agent-success-check circle { stroke-dasharray: 176; animation: draw-check 500ms ease-out both; }
.agent-success-check path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw-mark 260ms 380ms ease-out forwards; }
.agent-success h3 { margin: 1.25rem 0 0.55rem; font: 700 clamp(1.7rem, 5vw, 2.4rem)/1 Chalet, Inter, sans-serif; letter-spacing: -0.04em; }
.agent-success p { margin: 0 auto; max-width: 24rem; color: rgba(16, 17, 20, 0.68); line-height: 1.55; }

@keyframes ticker { to { transform: translateX(-50%); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(1rem) scale(0.985); } }
@keyframes dialog-out { to { opacity: 0; transform: translateY(0.6rem) scale(0.99); } }
@keyframes step-in { from { opacity: 0; transform: translateY(0.4rem); } }
@keyframes draw-check { from { stroke-dashoffset: 176; } to { stroke-dashoffset: 0; } }
@keyframes draw-mark { to { stroke-dashoffset: 0; } }
@keyframes backdrop-in { from { opacity: 0; } }
@keyframes backdrop-out { to { opacity: 0; } }
@keyframes watermark-glitch {
  0%, 5%, 15%, 18%, 40%, 41.5%, 65%, 66.5%, 100% { transform: translateY(-50%) translate(0); filter: none; opacity: 0.08; }
  2% { transform: translateY(-50%) translate(8px, -3px); filter: hue-rotate(90deg) saturate(3); opacity: 0.12; }
  4% { transform: translateY(-50%) translate(-6px, 2px); filter: hue-rotate(-60deg); opacity: 0.06; }
  15.5% { transform: translateY(-50%) translate(-10px) skew(-3deg); filter: hue-rotate(180deg) saturate(4); opacity: 0.15; }
  16% { transform: translateY(-50%) translate(5px, -2px) skew(2deg); filter: hue-rotate(-90deg) brightness(1.5); opacity: 0.1; }
  17% { transform: translateY(-50%) translate(-3px, 1px); filter: saturate(2); opacity: 0.12; }
  40.3% { transform: translateY(-50%) translate(12px) scaleX(1.02); filter: hue-rotate(120deg) saturate(5); opacity: 0.18; }
  40.6% { transform: translateY(-50%) translate(-8px, 3px) scaleX(0.98); filter: hue-rotate(-45deg); opacity: 0.05; }
  41% { transform: translateY(-50%) translate(4px, -1px); filter: brightness(1.3); opacity: 0.1; }
  65.2% { transform: translateY(-50%) translate(-5px, -4px) skew(-5deg); filter: hue-rotate(200deg) saturate(3) brightness(1.4); opacity: 0.2; }
  65.5% { transform: translateY(-50%) translate(7px, 2px) skew(2deg); filter: hue-rotate(-120deg); opacity: 0.04; }
  66% { transform: translateY(-50%) translate(-2px); filter: saturate(2); opacity: 0.1; }
}

@media (max-width: 1280px) {
  .site-nav,
  .hero-content { max-width: 90%; padding-right: 0; padding-left: 0; }
}
@media (max-width: 1024px) { .hero-content { padding: 0 2rem; } }
@media (max-width: 768px) {
  .site-nav { max-width: none; padding: 1rem 1.25rem; }
  .hero-content { padding: 0 1.25rem; }
  .hero h1 { font-size: clamp(3.5rem, 12vw, 7rem); }
  .hero-sub { font-size: 1rem; }
  .hero-actions { width: 100%; flex-wrap: wrap; }
  .hero-actions .btn-chamfer { flex: 1 1 100%; justify-content: center; padding: 1.25rem 2rem; font-size: 1rem; }
  .hero-watermark { top: 50%; right: auto; left: 50%; width: 160vw; max-width: none; margin-left: -80vw; }
  .clono-ticker-group { gap: 2rem; padding-right: 2rem; }
}
@media (max-width: 480px) {
  .clono-social-links { gap: 0.375rem; }
  .agent-dialog { width: calc(100vw - 1rem); max-height: calc(100dvh - 1rem); }
  .agent-dialog-panel { padding: 1.35rem; }
  .agent-form-grid { grid-template-columns: 1fr; }
  .agent-field-wide { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-watermark,
  .hero-ticker-inner,
  .agent-dialog[open],
  .agent-dialog::backdrop,
  .agent-dialog.is-closing,
  .agent-dialog.is-closing::backdrop,
  .agent-step:not([hidden]),
  .agent-success-check circle,
  .agent-success-check path { animation-duration: 1ms; animation-delay: 0ms; animation-iteration-count: 1; }
}
