:root {
  /* Dynamic Palette: Warm paper, deep ink, signal red */
  --bg-canvas: #f7f5f0;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f0eee9;
  --text-primary: #111111;
  --text-muted: #555555;
  --accent-primary: #d62828;
  --accent-secondary: #9e1c1c;
  --border-subtle: rgba(17, 17, 17, 0.1);
  --white: #ffffff;
  
  /* Advanced UI Variables */
  --ease-kinetic: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-elevation: 0 12px 32px -4px rgba(0, 0, 0, 0.15);
  --shadow-hover: 0 20px 48px -8px rgba(0, 0, 0, 0.25);
  --glass-backdrop: blur(16px) saturate(180%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  line-height: 1.7;
  font-size: 1.125rem;
  overflow-wrap: anywhere;
  hyphens: auto;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

a {
  color: inherit;
  text-decoration: none;
}

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

/* Header & Brand (Strict Left Alignment, No Sticky) */
header {
  position: relative;
  width: 100%;
  background-color: var(--bg-canvas);
  border-bottom: 2px solid var(--text-primary);
  z-index: 100;
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.desktop-nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.desktop-nav a {
  font-weight: 700;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: relative;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--text-primary);
  cursor: pointer;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--text-primary);
  padding: 2rem;
  box-shadow: var(--shadow-elevation);
}

.mobile-menu.active {
  display: block;
  animation: slideDown 0.3s var(--ease-kinetic);
}

.mobile-menu ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mobile-menu a {
  font-size: 1.25rem;
  font-weight: 800;
}

/* Layout Core */
main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 2rem;
}

.reading-column {
  max-width: 68ch;
  margin: 0 auto 3rem auto;
}

.breakout-media {
  width: 100%;
  margin: 3rem 0;
}

.breakout-media img {
  width: 100%;
  height: 50vh;
  min-height: 400px;
  object-fit: cover;
  border-radius: 0; /* Square bounding boxes */
}

/* Hero Section */
.hero-section {
  position: relative;
  width: 100%;
  margin-bottom: 6rem;
}

.hero-image {
  width: 100%;
  height: 70vh;
  min-height: 500px;
  object-fit: cover;
}

.hero-floating-card {
  position: absolute;
  bottom: -3rem;
  right: 5%;
  background-color: var(--bg-surface);
  padding: 2.5rem;
  width: 90%;
  max-width: 450px;
  box-shadow: var(--shadow-elevation);
  border-left: 6px solid var(--accent-primary);
}

.hero-floating-card h2 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.hero-floating-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.hero-floating-card li {
  position: relative;
  padding-left: 1.5rem;
  font-weight: 600;
}

.hero-floating-card li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent-primary);
  font-size: 1.5rem;
  line-height: 1;
}

/* Sections & Red Blocks */
.bg-signal-red {
  background-color: var(--accent-primary);
  color: var(--white);
  padding: 5rem 2rem;
  margin: 4rem 0;
}

.bg-signal-red h2, 
.bg-signal-red h3, 
.bg-signal-red p {
  color: var(--white);
}

.bg-signal-red .reading-column {
  margin-bottom: 0;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  background-color: var(--accent-primary);
  color: var(--white);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 2rem;
  border: none;
  cursor: pointer;
  transition: transform 0.3s var(--ease-kinetic), background-color 0.3s;
}

.btn-primary:hover {
  background-color: var(--accent-secondary);
  transform: translateY(-3px);
  color: var(--white);
}

.btn-secondary {
  display: inline-block;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  position: relative;
  padding-bottom: 0.25rem;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
}

.btn-secondary::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  width: 0;
  background-color: var(--accent-primary);
  transition: width 0.3s var(--ease-kinetic);
}

.btn-secondary:hover::after {
  width: 100%;
}

.bg-signal-red .btn-secondary {
  color: var(--white);
}

.bg-signal-red .btn-secondary::after {
  background-color: var(--white);
}

/* Cards & Masonry */
.masonry-grid {
  columns: 3 300px;
  gap: 2rem;
  margin-top: 3rem;
}

.card {
  break-inside: avoid;
  margin-bottom: 2rem;
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-elevation);
  transition: transform 0.4s var(--ease-kinetic), box-shadow 0.4s var(--ease-kinetic);
  border-radius: 0;
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-hover);
  background-color: var(--bg-surface-hover);
}

.card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
}

.card-content {
  padding: 2rem;
}

.card-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--accent-primary);
  color: var(--white);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
}

/* Bento Grid */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 3rem 0;
}

.bento-item {
  background-color: var(--bg-surface);
  padding: 2rem;
  box-shadow: var(--shadow-elevation);
  transition: transform 0.3s var(--ease-kinetic);
}

.bento-item:hover {
  transform: translateY(-4px);
}

.bento-item.span-2 {
  grid-column: span 2;
}

/* Accordions (FAQ) */
.faq-accordion {
  margin-top: 2rem;
}

details {
  background: var(--bg-surface);
  margin-bottom: 1rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: all 0.3s;
}

summary {
  padding: 1.5rem;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

summary::-webkit-details-marker {
  display: none;
}

summary::after {
  content: "+";
  font-size: 1.5rem;
  color: var(--accent-primary);
}

details[open] summary::after {
  content: "-";
}

details[open] {
  box-shadow: var(--shadow-elevation);
}

.details-content {
  padding: 0 1.5rem 1.5rem 1.5rem;
  color: var(--text-muted);
}

/* Pull Quotes */
blockquote {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 3rem 0;
  padding: 2rem;
  border-left: 8px solid var(--accent-primary);
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  background-color: var(--bg-surface);
}

th, td {
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  text-align: left;
}

th {
  background-color: var(--text-primary);
  color: var(--white);
  font-weight: 800;
}

/* Tool / Forms */
.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

input, select, textarea {
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--text-primary);
  background-color: var(--bg-canvas);
  font-family: inherit;
  font-size: 1rem;
  border-radius: 0;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.tool-output {
  margin-top: 2rem;
  padding: 2rem;
  background-color: var(--text-primary);
  color: var(--white);
  display: none;
}

.tool-output pre {
  white-space: pre-wrap;
  font-family: monospace;
  margin-bottom: 1.5rem;
  font-size: 1rem;
}

.tool-actions {
  display: flex;
  gap: 1rem;
}

/* Scroll Reveal */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.7s var(--ease-kinetic);
}

.reveal.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Footer */
footer {
  background-color: var(--text-primary);
  color: var(--white);
  padding: 5rem 2rem;
  margin-top: 6rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
}

.footer-col h4 {
  color: var(--white);
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.75rem;
}

.footer-col a {
  color: #cccccc;
  transition: color 0.3s;
}

.footer-col a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 3rem auto 0 auto;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.9rem;
  color: #999;
}

/* Animations */
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Media Queries */
@media (max-width: 768px) {
  .desktop-nav {
    display: none;
  }
  .mobile-nav-toggle {
    display: block;
  }
  .hero-floating-card {
    position: relative;
    bottom: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    margin-top: -3rem;
  }
  .bento-item.span-2 {
    grid-column: span 1;
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

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