/* ==========================================================================
   Command Garden — Design System
   A website that grows itself one feature a day.
   ========================================================================== */

/* ---------- Custom Properties ---------- */
:root {
  /* Colors */
  --color-deep-green: #1a4d2e;
  --color-sage: #5c8a6e;
  --color-sage-light: #7da98e;
  --color-cream: #f5f0e8;
  --color-warm-white: #fafaf7;
  --color-earth: #8b7355;
  --color-earth-light: #a89070;
  --color-accent-gold: #c4a35a;
  --color-accent-gold-light: #d4b96e;
  --color-text-dark: #1a1a1a;
  --color-text-muted: #6b6b6b;
  --color-text-light: #999;
  --color-border: #e2ddd5;
  --color-border-light: #eee9e1;
  --color-success: #2d7a4f;
  --color-error: #b44040;
  --color-warning: #c49a3a;
  --color-info: #3a7ab4;

  /* Surfaces */
  --surface-primary: var(--color-warm-white);
  --surface-secondary: var(--color-cream);
  --surface-card: #ffffff;
  --surface-elevated: #ffffff;
  --surface-dark: var(--color-deep-green);

  /* Typography */
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Fira Mono", "Roboto Mono",
    "Cascadia Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --leading-tight: 1.2;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --border-width: 1px;
  --border-default: var(--border-width) solid var(--color-border);

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(26, 26, 26, 0.04);
  --shadow-sm: 0 1px 3px rgba(26, 26, 26, 0.06),
    0 1px 2px rgba(26, 26, 26, 0.04);
  --shadow-md: 0 4px 6px rgba(26, 26, 26, 0.06),
    0 2px 4px rgba(26, 26, 26, 0.04);
  --shadow-lg: 0 10px 15px rgba(26, 26, 26, 0.06),
    0 4px 6px rgba(26, 26, 26, 0.03);
  --shadow-xl: 0 20px 25px rgba(26, 26, 26, 0.08),
    0 8px 10px rgba(26, 26, 26, 0.03);

  /* Transitions */
  --ease-default: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1200px;
  --container-padding: var(--space-6);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-dark);
  background-color: var(--surface-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--color-sage);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-default);
}

a:hover {
  color: var(--color-deep-green);
}

ul,
ol {
  list-style: none;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: var(--leading-tight);
  font-weight: var(--weight-bold);
  color: var(--color-text-dark);
}

h1 {
  font-size: var(--text-4xl);
  letter-spacing: -0.02em;
}
h2 {
  font-size: var(--text-3xl);
  letter-spacing: -0.015em;
}
h3 {
  font-size: var(--text-2xl);
  letter-spacing: -0.01em;
}
h4 {
  font-size: var(--text-xl);
}
h5 {
  font-size: var(--text-lg);
}
h6 {
  font-size: var(--text-base);
}

p {
  margin-bottom: var(--space-4);
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: var(--weight-semibold);
}

small {
  font-size: var(--text-sm);
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-cream);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
  color: var(--color-deep-green);
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  background: var(--color-text-dark);
  color: var(--color-cream);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: var(--leading-relaxed);
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

blockquote {
  border-left: 3px solid var(--color-sage);
  padding-left: var(--space-4);
  color: var(--color-text-muted);
  font-style: italic;
}

hr {
  border: none;
  border-top: var(--border-default);
  margin: var(--space-8) 0;
}

/* ---------- Container ---------- */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

.container--narrow {
  max-width: var(--container-md);
}

.container--wide {
  max-width: var(--container-xl);
}

/* ---------- Utility Classes ---------- */

/* Display */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }
.d-inline { display: inline; }
.d-inline-flex { display: inline-flex; }

/* Flex */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* Spacing */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mt-12 { margin-top: var(--space-12); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mb-12 { margin-bottom: var(--space-12); }

.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }
.py-16 { padding-top: var(--space-16); padding-bottom: var(--space-16); }

/* Text */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--color-text-muted); }
.text-light { color: var(--color-text-light); }
.text-green { color: var(--color-deep-green); }
.text-sage { color: var(--color-sage); }
.text-earth { color: var(--color-earth); }
.text-gold { color: var(--color-accent-gold); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }
.font-mono { font-family: var(--font-mono); }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.leading-tight { line-height: var(--leading-tight); }
.leading-relaxed { line-height: var(--leading-relaxed); }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Borders & Radius */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }
.border { border: var(--border-default); }
.border-b { border-bottom: var(--border-default); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

/* Width */
.w-full { width: 100%; }
.max-w-prose { max-width: 65ch; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.sticky { position: sticky; }

/* Visibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 639px) {
  :root {
    --container-padding: var(--space-4);
  }
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
}

@media (min-width: 640px) {
  .sm\:d-flex { display: flex; }
  .sm\:d-none { display: none; }
  .sm\:d-block { display: block; }
  .sm\:flex-row { flex-direction: row; }
  .sm\:text-left { text-align: left; }
  .sm\:gap-6 { gap: var(--space-6); }
}

@media (min-width: 768px) {
  .md\:d-flex { display: flex; }
  .md\:d-none { display: none; }
  .md\:d-block { display: block; }
  .md\:d-grid { display: grid; }
  .md\:flex-row { flex-direction: row; }
  .md\:gap-8 { gap: var(--space-8); }
}

@media (min-width: 1024px) {
  .lg\:d-flex { display: flex; }
  .lg\:d-none { display: none; }
  .lg\:d-block { display: block; }
  .lg\:d-grid { display: grid; }
  .lg\:flex-row { flex-direction: row; }
  .lg\:gap-12 { gap: var(--space-12); }
}
