/*
 * The Digital Press: Typography System
 * Rowe Innovations, LLC
 *
 * Inspired by letterpress printing, craftsman precision, and the rhythm of creation.
 */

/* ============================================
   Font Face Declarations (Self-Hosted)
   ============================================

   All fonts licensed under SIL Open Font License 1.1
   See /fonts/FONTS.md for full attribution
   ============================================ */

/* Crimson Pro - Copyright 2018 The Crimson Pro Project Authors */
@font-face {
  font-family: 'Crimson Pro';
  src: url('/fonts/CrimsonPro-Variable.ttf') format('truetype-variations');
  font-weight: 200 900;
  font-display: swap;
  font-style: normal;
}

/* Fraunces - Copyright 2018 The Fraunces Project Authors */
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/Fraunces-Variable.ttf') format('truetype-variations');
  font-weight: 100 900;
  font-display: swap;
  font-style: normal;
}

/* JetBrains Mono - Copyright 2020 The JetBrains Mono Project Authors */
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/JetBrainsMono-Variable.ttf') format('truetype-variations');
  font-weight: 100 800;
  font-display: swap;
  font-style: normal;
}

/* ============================================
   CSS Variables: The Digital Press System
   ============================================ */

:root {
  /* Typography Families */
  --font-body: 'Crimson Pro', 'Iowan Old Style', Palatino, 'Book Antiqua', Georgia, serif;
  --font-display: 'Fraunces', Optima, Didot, 'Hoefler Text', Georgia, serif;
  --font-mono: 'JetBrains Mono', Menlo, Monaco, 'Andale Mono', monospace;

  /* Base Typography */
  --font-size-base: 18px;
  --line-height-base: 1.75;
  --measure: 65ch; /* Optimal reading line length */

  /* Type Scale (Minor Third ~1.2) */
  --font-size-sm: 0.875rem;      /* 15.75px */
  --font-size-md: 1rem;          /* 18px */
  --font-size-lg: 1.2rem;        /* 21.6px */
  --font-size-xl: 1.44rem;       /* 25.92px */
  --font-size-2xl: 1.728rem;     /* 31.1px */
  --font-size-3xl: 2.074rem;     /* 37.3px */
  --font-size-4xl: 2.488rem;     /* 44.8px */
  --font-size-5xl: 2.986rem;     /* 53.7px */

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  --line-height-loose: 2;

  /* Letter Spacing */
  --letter-spacing-tight: -0.02em;
  --letter-spacing-normal: 0em;
  --letter-spacing-wide: 0.02em;

  /* Spacing Rhythm (based on 0.5rem = 9px) */
  --space-unit: 0.5rem;
  --space-xs: calc(var(--space-unit) * 1);   /* 9px */
  --space-sm: calc(var(--space-unit) * 2);   /* 18px */
  --space-md: calc(var(--space-unit) * 4);   /* 36px */
  --space-lg: calc(var(--space-unit) * 8);   /* 72px */
  --space-xl: calc(var(--space-unit) * 16);  /* 144px */

  /* Colors - Ink & Paper */
  --color-ink: #1a1a1a;
  --color-ink-light: #404040;
  --color-paper: #fafaf9;
  --color-paper-dark: #f5f5f4;
  --color-paper-blue: #f7f9fc; /* Soft blue tint for backgrounds */
  --color-gray-light: #e7e5e4;
  --color-gray-mid: #78716c;
  --color-gray-dark: #44403c;

  /* Colors - Rowe Innovations (Blue Primary) */
  --color-primary: #1e40af;
  --color-primary-light: #3b82f6;
  --color-primary-dark: #1e3a8a;

  /* Colors - Wiglaf Software (Red Accent) */
  --color-accent: #991b1b;
  --color-accent-light: #dc2626;
  --color-accent-dark: #7f1d1d;

  /* Transitions - Press Rhythm */
  --transition-smooth: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --transition-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-duration-fast: 0.2s;
  --transition-duration-normal: 0.3s;
  --transition-duration-slow: 0.6s;
}

/* ============================================
   Base Typography
   ============================================ */

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  font-weight: var(--font-weight-normal);
  color: var(--color-ink);
  background: var(--color-paper-blue);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   Headings - Display Font
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-primary-dark);
  margin-top: var(--space-lg);
  margin-bottom: var(--space-md);
  max-width: var(--measure);
}

h1 {
  font-size: var(--font-size-4xl) !important;
  letter-spacing: var(--letter-spacing-tight);
  font-weight: var(--font-weight-bold) !important;
  margin-top: 0;
}

h2 {
  font-size: var(--font-size-3xl) !important;
  letter-spacing: var(--letter-spacing-tight);
}

h3 {
  font-size: var(--font-size-2xl) !important;
}

h4 {
  font-size: var(--font-size-xl) !important;
  font-weight: var(--font-weight-medium);
}

h5 {
  font-size: var(--font-size-lg) !important;
  font-weight: var(--font-weight-medium);
}

h6 {
  font-size: var(--font-size-md) !important;
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--letter-spacing-wide);
}

/* ============================================
   Body Text
   ============================================ */

p, li {
  margin-bottom: var(--space-sm);
  max-width: var(--measure);
}

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

.lead {
  font-size: var(--font-size-xl);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-light);
  color: var(--color-ink-light);
}

/* ============================================
   Links - Ink with Press Underline
   ============================================ */

a {
  color: var(--color-primary);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  letter-spacing: var(--letter-spacing-normal);
  transition:
    border-color var(--transition-duration-fast) var(--transition-smooth),
    letter-spacing var(--transition-duration-fast) var(--transition-smooth),
    color var(--transition-duration-fast) var(--transition-smooth);
}

a:hover {
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-accent);
  letter-spacing: var(--letter-spacing-wide);
}

a:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   Lists
   ============================================ */

ul, ol {
  padding-left: var(--space-md);
  margin-bottom: var(--space-sm);
}

ul li, ol li {
  margin-bottom: var(--space-xs);
}

ul li::marker {
  color: var(--color-accent);
}

ol li::marker {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

/* ============================================
   Blockquotes - The Arena Quote
   ============================================ */

blockquote {
  font-family: var(--font-display);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-relaxed);
  font-weight: var(--font-weight-light);
  font-style: italic;
  color: var(--color-ink-light);
  border-left: 4px solid var(--color-primary);
  padding-left: var(--space-md);
  margin: var(--space-lg) 0;
  max-width: calc(var(--measure) - var(--space-md));
}

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

/* ============================================
   Code - Monospace Precision
   ============================================ */

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

code {
  background: var(--color-paper-dark);
  padding: 0.125em 0.25em;
  border-radius: 3px;
  color: var(--color-accent-dark);
}

pre {
  background: var(--color-ink);
  color: var(--color-paper);
  padding: var(--space-md);
  border-radius: 4px;
  overflow-x: auto;
  margin: var(--space-md) 0;
}

pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

/* ============================================
   Utility Classes
   ============================================ */

.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.text-muted { color: var(--color-gray-mid); }

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

.text-sm { font-size: var(--font-size-sm); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }

.font-light { font-weight: var(--font-weight-light); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }

/* ============================================
   Special Highlight - Wiglaf Red
   ============================================ */

.highlight {
  color: var(--color-accent);
  font-weight: var(--font-weight-semibold);
}

.highlight-box {
  background: linear-gradient(to right, var(--color-accent-light) 0%, transparent 100%);
  padding: var(--space-xs) var(--space-sm);
  border-left: 3px solid var(--color-accent);
}
