/* CSS Variables - Chadforge Ink & Citrus palette */
:root {
  --color-bg: #FFF7E6;
  --color-surface: #FFFFFF;
  --color-text: #121826;
  --color-muted: #4B5563;
  --color-border: #1F2A44;
  --color-primary: #1F2A44;
  --color-secondary: #FFB000;
  --color-accent: #FF3D7F;
  --radius: 14px;
  --shadow: 6px 6px 0 #1F2A44;
  --maxw: 1100px;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

/* Typography */
h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.2;
  margin-bottom: 1.5rem;
  font-weight: 900;
  color: var(--color-primary);
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.3;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  font-weight: 800;
  color: var(--color-primary);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
  line-height: 1.4;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  font-weight: 700;
  color: var(--color-primary);
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: background-color 0.2s, color 0.2s, text-decoration-thickness 0.2s;
}

a:hover {
  background-color: var(--color-secondary);
  color: var(--color-text);
  text-decoration-thickness: 3px;
}

a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 2px;
}

strong {
  font-weight: 700;
  color: var(--color-primary);
}

/* Layout container */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
header {
  background-color: var(--color-surface);
  border-bottom: 4px solid var(--color-border);
  padding: 1.5rem 0;
  box-shadow: 0 4px 0 var(--color-border);
}

.site-name {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 900;
  color: var(--color-primary);
  margin-bottom: 1rem;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

nav a {
  padding: 0.5rem 1rem;
  background-color: var(--color-bg);
  border: 3px solid var(--color-border);
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
  box-shadow: 3px 3px 0 var(--color-border);
}

nav a:hover {
  background-color: var(--color-secondary);
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--color-border);
}

nav a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* Main content */
main {
  padding: 2.5rem 0;
}

/* Breadcrumbs */
.breadcrumbs {
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  color: var(--color-muted);
}

.breadcrumbs a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.breadcrumbs a:hover {
  text-decoration: underline;
}

/* Sections and articles */
article, section {
  margin-bottom: 3rem;
}

.intro-text {
  font-size: 1.1rem;
  color: var(--color-muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

/* Blockquote */
blockquote {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--color-bg);
  border-left: 6px solid var(--color-primary);
  border-radius: var(--radius);
  font-style: italic;
  box-shadow: var(--shadow);
}

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

/* Aside */
aside {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--color-surface);
  border: 3px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

aside h3 {
  margin-top: 0;
  color: var(--color-accent);
}

/* Details/Summary accordion */
details {
  margin: 2rem 0;
  padding: 1.5rem;
  background-color: var(--color-surface);
  border: 3px solid var(--color-border);
  border-radius: var(--radius);
  transition: box-shadow 0.3s;
}

details[open] {
  box-shadow: var(--shadow);
  background-color: var(--color-bg);
}

summary {
  font-weight: 700;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--color-primary);
  list-style: none;
  transition: background-color 0.2s;
  padding: 0.5rem;
  margin: -0.5rem;
  border-radius: calc(var(--radius) - 3px);
}

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

summary::before {
  content: '▶ ';
  display: inline-block;
  transition: transform 0.3s;
}

details[open] summary::before {
  transform: rotate(90deg);
}

summary:hover {
  background-color: var(--color-secondary);
}

summary:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

details div {
  margin-top: 1rem;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border: 3px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

caption {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1rem;
  text-align: left;
  background-color: var(--color-primary);
  color: var(--color-surface);
  border-radius: calc(var(--radius) - 3px) calc(var(--radius) - 3px) 0 0;
}

thead {
  background-color: var(--color-secondary);
  color: var(--color-text);
}

th {
  padding: 1rem;
  text-align: left;
  font-weight: 700;
  border-bottom: 3px solid var(--color-border);
}

td {
  padding: 1rem;
  border-bottom: 2px solid var(--color-border);
}

tbody tr:nth-child(even) {
  background-color: var(--color-bg);
}

tbody tr:hover {
  background-color: var(--color-secondary);
}

/* Lists */
ul, ol {
  margin: 1rem 0 1rem 1.5rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Footer */
footer {
  background-color: var(--color-surface);
  border-top: 4px solid var(--color-border);
  padding: 2rem 0;
  text-align: center;
  box-shadow: 0 -4px 0 var(--color-border);
  margin-top: 3rem;
}

footer p {
  margin: 0;
  color: var(--color-muted);
  font-weight: 600;
}

/* Responsive breakpoints */
@media (min-width: 768px) {
  nav {
    gap: 1.5rem;
  }
  
  nav a {
    padding: 0.75rem 1.5rem;
  }
  
  .container {
    padding: 0 2rem;
  }
  
  main {
    padding: 3rem 0;
  }
}

@media (min-width: 1024px) {
  thead {
    position: sticky;
    top: 0;
    z-index: 10;
  }
  
  main {
    padding: 4rem 0;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
  
  a:hover,
  nav a:hover,
  summary:hover {
    transform: none !important;
  }
  
  summary::before {
    transition: none !important;
  }
}

/* Focus visible enhancement */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 3px;
}

/* Print styles */
@media print {
  body {
    background-color: white;
    color: black;
  }
  
  header, footer {
    border: none;
    box-shadow: none;
  }
  
  a {
    text-decoration: underline;
    color: black;
  }
  
  nav, .breadcrumbs {
    display: none;
  }
}