/* ==========================================================================
   Base Swiss Architectural Styles, Segmented Header & Electric Cobalt Footer
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 18px);
  -webkit-text-size-adjust: 100%;
}

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

html[data-reduced-motion="true"] {
  scroll-behavior: auto;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

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

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button,
a,
summary,
[role="tab"],
[role="button"] {
  cursor: pointer;
}

a {
  color: var(--brand-cobalt-fg);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Skip Link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  background: var(--brand-cobalt);
  color: #ffffff;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

.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;
}

/* Typography (drayhq Swiss editorial lightness + two-tone muted subclauses) */
h1,
h2,
h3,
h4 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: clamp(2.15rem, 4.4vw, 3.25rem);
  font-weight: 500;
}

h2 {
  font-size: clamp(1.5rem, 2.7vw, 2.15rem);
  font-weight: 500;
}

h3 {
  font-size: clamp(1.08rem, 1.4vw, 1.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.heading-muted {
  color: var(--text-muted);
  font-weight: 400;
}

p {
  margin: 0 0 var(--space-4);
  color: var(--text-secondary);
}

.lead {
  font-size: clamp(1.02rem, 1.35vw, 1.15rem);
  line-height: 1.55;
  max-width: 60ch;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

.inline-code {
  font-family: var(--font-mono);
  font-size: 0.87em;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  overflow-wrap: break-word;
}

/* Containers */
.container {
  width: 100%;
  max-width: 1180px;
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-6);
  }
}

.section {
  padding-block: var(--space-8);
}

.section-tight {
  padding-block: var(--space-7);
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.section-kicker {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: var(--space-2);
}

/* ==========================================================================
   Segmented 1px Hairline Navbar (drayhq signature layout)
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: var(--nav-backdrop);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-bar {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  text-decoration: none;
  color: var(--text-primary);
  min-height: var(--nav-height);
}

@media (min-width: 768px) {
  .brand-link {
    padding: 0 28px;
  }
}

.brand-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--text-primary);
  flex-shrink: 0;
}

.brand-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.96rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.brand-version {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 6px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.header-segments {
  display: flex;
  align-items: stretch;
}

.primary-nav {
  display: none;
  align-items: stretch;
}

@media (min-width: 1024px) {
  .primary-nav {
    display: flex;
  }
}

.seg-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--nav-height);
  min-width: 44px;
  padding: 0 13px;
  border: 0;
  border-left: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease;
}

.seg-cell:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.seg-cell[aria-current="page"] {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: inset 0 -2px 0 var(--brand-cobalt);
  font-weight: 700;
}

.seg-cell[aria-pressed="true"] {
  color: var(--brand-cobalt-fg);
}

.seg-dial {
  position: relative;
  overflow: hidden;
  padding: 0 14px;
}

.seg-label-desktop {
  display: none;
}

@media (min-width: 1120px) {
  .seg-label-desktop {
    display: inline;
  }
}

.menu-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  height: var(--nav-height);
  border: 0;
  border-left: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-primary);
}

@media (min-width: 1024px) {
  .menu-toggle-btn {
    display: none;
  }
}

/* Mobile Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  right: 0;
  z-index: 95;
  background: var(--bg-canvas);
  border-bottom: 1px solid var(--border-strong);
  box-shadow: var(--shadow-window);
}

.mobile-nav-list {
  display: flex;
  flex-direction: column;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-nav-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.mobile-nav-list a[aria-current="page"] {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-left: 3px solid var(--brand-cobalt);
}

/* Subpage Banner */
.page-banner {
  padding-block: var(--space-7) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Signature Electric Cobalt Closing Band + Footer (drayhq style)
   ========================================================================== */
.closing-cobalt-band {
  margin-top: var(--space-7);
  background: var(--brand-cobalt);
  color: #ffffff;
  padding-top: var(--space-8);
  padding-bottom: 0;
  position: relative;
  overflow: hidden;
}

.closing-cobalt-band h2,
.closing-cobalt-band h3 {
  color: #ffffff;
}

.closing-cobalt-band p {
  color: rgba(255, 255, 255, 0.85);
}

.closing-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.22);
  margin-top: var(--space-5);
}

@media (min-width: 780px) {
  .closing-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.closing-cell {
  background: rgba(10, 10, 26, 0.28);
  padding: var(--space-5);
  min-width: 0;
}

.closing-pixel-bar {
  margin-top: var(--space-7);
  height: 36px;
  width: 100%;
  background-image:
    linear-gradient(90deg, rgba(10, 10, 24, 0.22) 25%, transparent 25%, transparent 50%, rgba(10, 10, 24, 0.14) 50%, rgba(10, 10, 24, 0.14) 75%, transparent 75%);
  background-size: 48px 36px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.site-footer {
  background: var(--brand-cobalt);
  color: rgba(255, 255, 255, 0.86);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-block: var(--space-5);
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-nav a {
  color: #ffffff;
  text-decoration: none;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.footer-nav a:hover {
  text-decoration: underline;
}

/* Generic Responsive Grids */
.grid-2 > *,
.grid-3 > *,
.learn-workbench > *,
.trace-layout > *,
.playground-grid > *,
.faq-split > * {
  min-width: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

@media (min-width: 820px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.grid-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
