/* AI Decoded Lab — layout beyond conventional header/footer bands */
:root {
  --void: #070a10;
  --surface: #0f1522;
  --surface-2: #141c2e;
  --ink: #e8edf5;
  --muted: #8b98b3;
  --accent: #e8a838;
  --accent-dim: #c4892a;
  --signal: #2dd4bf;
  --rail-width: 5.5rem;
  --max-read: 42rem;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  min-height: 100vh;
}

.lab-shell {
  display: flex;
  min-height: 100vh;
}

/* Left rail — unconventional primary navigation */
.lab-rail {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--rail-width);
  z-index: 50;
  background: linear-gradient(180deg, var(--surface) 0%, var(--void) 100%);
  border-right: 1px solid rgba(232, 168, 56, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.25rem 0;
  gap: 1.5rem;
}

.lab-rail__mark {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.85;
  white-space: nowrap;
}

.lab-rail__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: center;
  flex: 1;
  justify-content: center;
}

.lab-rail__nav a {
  width: 2.75rem;
  height: 2.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
}

.lab-rail__nav a:hover,
.lab-rail__nav a:focus-visible {
  color: var(--ink);
  background: rgba(45, 212, 191, 0.08);
  border-color: rgba(45, 212, 191, 0.25);
  outline: none;
}

.lab-rail__nav a.is-active {
  color: var(--void);
  background: var(--accent);
  box-shadow: 0 0 24px rgba(232, 168, 56, 0.35);
}

.lab-main {
  flex: 1;
  margin-left: var(--rail-width);
  min-width: 0;
}

/* Diagonal hero slab */
.hero-slab {
  position: relative;
  padding: clamp(2rem, 6vw, 4rem) clamp(1.25rem, 4vw, 3rem);
  overflow: hidden;
}

.hero-slab::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    var(--surface) 0%,
    var(--surface-2) 45%,
    rgba(7, 10, 16, 0.4) 100%
  );
  clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
  z-index: 0;
}

.hero-slab__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
      rgba(232, 168, 56, 0.04) 1px,
      transparent 1px
    ),
    linear-gradient(90deg, rgba(45, 212, 191, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

.hero-slab__inner {
  position: relative;
  z-index: 1;
  max-width: 72rem;
  margin: 0 auto;
}

.hero-kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(2.25rem, 5.5vw, 3.75rem);
  font-weight: 400;
  line-height: 1.1;
  margin: 0 0 1rem;
  max-width: 18ch;
}

.hero-title span {
  color: var(--accent);
}

.hero-lede {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: var(--max-read);
  margin: 0 0 1.5rem;
}

/* Bento article grid */
.bento-wrap {
  padding: 0 clamp(1rem, 3vw, 2rem) 4rem;
  max-width: 72rem;
  margin: 0 auto;
}

.bento-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}

@media (min-width: 768px) {
  .bento-grid {
    gap: 1.25rem;
  }
}

.bento-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 1rem;
  padding: 1.25rem 1.35rem;
  transition: border-color 0.25s, transform 0.25s;
}

.bento-card:hover {
  border-color: rgba(232, 168, 56, 0.35);
  transform: translateY(-2px);
}

.bento-card__tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 0.5rem;
}

.bento-card h2,
.bento-card h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  margin: 0 0 0.65rem;
  font-size: 1.35rem;
  line-height: 1.25;
}

.bento-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
}

.span-12 {
  grid-column: span 12;
}
.span-8 {
  grid-column: span 12;
}
.span-4 {
  grid-column: span 12;
}
.span-6 {
  grid-column: span 12;
}

@media (min-width: 1024px) {
  .span-8 {
    grid-column: span 8;
  }
  .span-4 {
    grid-column: span 4;
  }
  .span-6 {
    grid-column: span 6;
  }
}

/* Prose blocks inside pages */
.prose-lab {
  max-width: 72rem;
  margin: 0 auto;
  padding: 2rem clamp(1rem, 3vw, 2rem) 4rem;
}

.prose-lab h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 4vw, 2.75rem);
  margin: 0 0 1rem;
}

.prose-lab h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.5rem;
  margin: 2rem 0 0.75rem;
  color: var(--accent);
}

.prose-lab p,
.prose-lab li {
  color: var(--muted);
  line-height: 1.7;
  font-size: 1rem;
}

.prose-lab ul {
  padding-left: 1.25rem;
}

.prose-lab a {
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Contact form */
.form-field {
  margin-bottom: 1.25rem;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0.4rem;
}

.form-field input,
.form-field textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.5rem;
  color: var(--ink);
  font-family: inherit;
  font-size: 1rem;
}

.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 168, 56, 0.15);
}

.form-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 1rem;
}

/* Mobile bottom bar — replaces rail */
@media (max-width: 767px) {
  .lab-shell {
    flex-direction: column;
  }

  .lab-rail {
    position: fixed;
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    border-right: none;
    border-top: 1px solid rgba(232, 168, 56, 0.15);
    background: rgba(15, 21, 34, 0.95);
    backdrop-filter: blur(10px);
  }

  .lab-rail__mark {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: 0.6rem;
    letter-spacing: 0.2em;
  }

  .lab-rail__nav {
    flex-direction: row;
    flex: none;
    gap: 0.25rem;
  }

  .lab-rail__nav a {
    width: auto;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.4rem;
    font-size: 0.65rem;
  }

  .lab-main {
    margin-left: 0;
    padding-bottom: 4.5rem;
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: var(--void);
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

/* Homepage: principle strip + reading path */
.principle-strip {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .principle-strip {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
  }
}

.principle-pill {
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 21, 34, 0.6);
  padding: 1rem 1.15rem;
}

.principle-pill strong {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.principle-pill p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.reading-path {
  border-left: 2px solid rgba(45, 212, 191, 0.35);
  padding-left: 1rem;
  margin: 0 0 1rem;
}

.reading-path:last-child {
  margin-bottom: 0;
}

.reading-path h3 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
  color: var(--ink);
}

.reading-path p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--muted);
}

/* About: definition list */
.about-dl dt {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--signal);
  margin-top: 1.25rem;
  margin-bottom: 0.35rem;
}

.about-dl dt:first-child {
  margin-top: 0;
}

.about-dl dd {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.98rem;
}

/* Clickable homepage cards */
.card-hit {
  position: relative;
}

.card-hit__cover {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: 1rem;
}

.card-hit__cover:focus {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.card-hit__inner {
  position: relative;
  z-index: 1;
}

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

/* Article detail pages */
.article-detail {
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) clamp(1rem, 3vw, 2rem) 3rem;
}

.article-detail__meta {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 0.5rem;
}

.article-detail__title {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--ink);
}

.article-detail__dek {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.article-detail__body h2 {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.45rem;
  color: var(--accent);
  margin: 2rem 0 0.75rem;
}

.article-detail__body h3 {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 1.5rem 0 0.5rem;
}

.article-detail__body p,
.article-detail__body li {
  color: var(--muted);
  line-height: 1.75;
  font-size: 1.02rem;
}

.article-detail__body ul {
  padding-left: 1.25rem;
  margin: 0.5rem 0 1rem;
}

.article-detail__body a {
  color: var(--signal);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-detail__body a:hover {
  color: var(--accent);
}

.related-block {
  margin-top: 2.75rem;
  padding: 1.35rem 1.5rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(232, 168, 56, 0.25);
  background: rgba(15, 21, 34, 0.65);
}

.related-block h2 {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.related-block ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.related-block li {
  margin-bottom: 0.5rem;
}

.related-block a {
  color: var(--signal);
  text-decoration: none;
  font-size: 0.95rem;
}

.related-block a:hover {
  text-decoration: underline;
  color: var(--accent);
}

.article-detail__back {
  display: inline-block;
  margin-top: 2rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--signal);
  text-decoration: none;
}

.article-detail__back:hover {
  color: var(--accent);
  text-decoration: underline;
}
