:root {
  /* Dynamic Palette: Terracotta Space (Strictly No Blue) */
  --bg-canvas: #f3e9d8;      /* Sand */
  --bg-surface: #ffffff;     /* White surface for cards */
  --bg-charcoal: #1c1917;    /* Charcoal */
  --text-primary: #1c1917;   /* Charcoal for text */
  --text-muted: #44403c;     /* Dark stone for muted */
  --text-light: #f3e9d8;     /* Sand text on dark backgrounds */
  --accent-primary: #c2410c; /* Terracotta */
  --accent-secondary: #d97706; /* Warm ochre/amber */
  --border-subtle: rgba(28, 25, 23, 0.1);
  
  /* Advanced UI Micro-Interactions & Depth */
  --ease-kinetic: cubic-bezier(0.16, 1, 0.3, 1);
  --shadow-elevation: 0 12px 32px -4px rgba(0, 0, 0, 0.15);
  --glow-accent: 0 0 24px -4px var(--accent-primary);
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

p {
  margin-bottom: 1.5rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: opacity 0.3s var(--ease-kinetic);
}

a:hover {
  opacity: 0.8;
}

/* Header & Nav */
.site-header {
  position: relative; /* Header MUST move up out of view */
  width: 100%;
  padding: 1.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--bg-canvas);
  z-index: 100;
}

.brand {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.desktop-nav {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.desktop-nav a {
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.95rem;
}

.desktop-nav a:hover {
  color: var(--accent-primary);
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background: var(--bg-surface);
  padding: 2rem;
  box-shadow: var(--shadow-elevation);
  z-index: 99;
}

.mobile-menu.active {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mobile-menu a {
  color: var(--text-primary);
  font-size: 1.2rem;
  font-weight: 700;
}

/* Buttons */
.btn-pill {
  display: inline-block;
  background-color: var(--accent-primary);
  color: #ffffff;
  padding: 0.8rem 2rem;
  border-radius: 9999px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.4s var(--ease-kinetic), box-shadow 0.4s var(--ease-kinetic);
}

.btn-pill:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: var(--shadow-elevation), var(--glow-accent);
  color: #ffffff;
  opacity: 1;
}

/* Layout Containers */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Hero Section */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  padding: 4rem 2rem 6rem;
  max-width: 1400px;
  margin: 0 auto;
}

.hero-content {
  padding-right: 2rem;
}

.hero-content h1 {
  font-size: clamp(3rem, 5vw, 4.5rem);
  margin-bottom: 1.5rem;
}

.hero-content p {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
  max-width: 50ch;
}

.hero-image {
  width: 100%;
  height: 600px;
  object-fit: cover;
  border-radius: 0; /* Square corners */
}

/* Diagonal Background Sections */
.section-diagonal {
  position: relative;
  background-color: var(--bg-surface);
  padding: 8rem 2rem;
  clip-path: polygon(0 5%, 100% 0, 100% 95%, 0 100%);
  margin: 4rem 0;
}

.section-diagonal.charcoal {
  background-color: var(--bg-charcoal);
  color: var(--text-light);
}

.section-diagonal.charcoal h2, 
.section-diagonal.charcoal h3,
.section-diagonal.charcoal .brand {
  color: var(--text-light);
}

/* Cards (Square with round badges) */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 3rem;
  padding: 2rem 0;
}

.card {
  background: var(--bg-surface);
  transition: transform 0.4s var(--ease-kinetic), box-shadow 0.4s var(--ease-kinetic);
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px) scale(1.015);
  box-shadow: var(--shadow-elevation);
}

.card-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
}

.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0; /* Square corners */
}

.card-badge {
  position: absolute;
  bottom: -12px;
  right: 20px;
  background: var(--accent-primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.4rem 1rem;
  border-radius: 9999px; /* Round badges */
  z-index: 10;
}

.card-content {
  padding: 2rem 1.5rem 1.5rem;
}

.card-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

/* Editorial Content / Reading Layout */
.editorial-page {
  padding: 4rem 2rem;
}

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

.reading-column h2, .reading-column h3 {
  margin-top: 3rem;
}

.pull-quote {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-primary);
  line-height: 1.4;
  margin: 3rem 0;
  padding-left: 2rem;
  border-left: 4px solid var(--accent-primary);
}

.wide-image {
  width: 100vw;
  max-width: 1200px;
  height: 500px;
  object-fit: cover;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin: 4rem 0;
  border-radius: 0; /* Square corners */
}

/* Material Spec Compiler Tool */
.spec-tool {
  background: var(--bg-surface);
  padding: 3rem;
  margin: 3rem auto;
  max-width: 600px;
  border: 1px solid var(--border-subtle);
}

.form-group {
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.form-group input, .form-group select, .form-group textarea {
  padding: 1rem;
  font-family: inherit;
  border: 1px solid var(--border-subtle);
  background: var(--bg-canvas);
  color: var(--text-primary);
  border-radius: 0;
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

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

/* Footer */
.site-footer {
  background-color: var(--bg-charcoal);
  color: var(--text-light);
  padding: 6rem 2rem 3rem;
  clip-path: polygon(0 5%, 100% 0, 100% 100%, 0 100%);
  margin-top: 4rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 4rem;
}

.footer-brand {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-light);
}

.footer-brand a {
  color: inherit;
}

.footer-info {
  color: #a8a29e;
  font-size: 0.9rem;
  max-width: 40ch;
}

.footer-col h4 {
  color: var(--text-light);
  margin-bottom: 1.5rem;
}

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

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

.footer-col ul a {
  color: #a8a29e;
  font-weight: 600;
}

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

.footer-bottom {
  max-width: 1200px;
  margin: 4rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  color: #a8a29e;
  font-size: 0.85rem;
  text-align: center;
}

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

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

/* Responsive */
@media (max-width: 1024px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 2rem 4rem;
  }
  .hero-image {
    height: 400px;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .desktop-nav { display: none; }
  .mobile-toggle { display: block; }
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .section-diagonal { padding: 6rem 1.5rem; clip-path: polygon(0 2%, 100% 0, 100% 98%, 0 100%); }
  .site-footer { clip-path: polygon(0 2%, 100% 0, 100% 100%, 0 100%); }
  .wide-image { width: 100%; transform: none; left: 0; margin: 2rem 0; height: 300px; }
  .pull-quote { font-size: 1.25rem; margin: 2rem 0; }
  .tool-actions { flex-direction: column; }
}

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