/* Reset and base styles */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--s-4));
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4, p, ul, ol, figure, blockquote { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
h1, h2, h3, h4 { font-weight: 600; line-height: 1.1; letter-spacing: -.02em; text-wrap: balance; }
p { text-wrap: pretty; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }

::selection { background: var(--accent); color: var(--on-accent); }

/* Focus */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Layout */
.container {
  width: 100%;
  max-width: calc(var(--max) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}

.section { padding-block: var(--section); }
.section + .section { padding-top: 0; }

/* Utilities */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: var(--s-4);
  top: -100px;
  z-index: 200;
  padding: var(--s-3) var(--s-4);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  border-radius: var(--r-btn);
}
.skip-link:focus-visible { top: calc(env(safe-area-inset-top) + var(--s-4)); left: max(var(--s-4), env(safe-area-inset-left)); }

.mono {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: var(--tracking-mono);
}

.pixel { font-family: var(--font-pixel); font-weight: 400; letter-spacing: 0; }
.accent { color: var(--accent); }

/* Signature textures */
.dot-grid {
  background-image: radial-gradient(rgba(124, 255, 79, .14) 1px, transparent 1.4px);
  background-size: 17px 17px;
  background-position: center;
}

.scanlines {
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, .28) 3px,
    rgba(0, 0, 0, 0) 4px
  );
}

/* Blinking block cursor after headings */
.cursor::after {
  content: "_";
  display: inline-block;
  margin-left: .08em;
  color: var(--accent);
  animation: blink 1.06s steps(1) infinite;
}

.blink { animation: blink 1.06s steps(1) infinite; }

@keyframes blink { 50% { opacity: 0; } }

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