/* ============================================
   BehaviourStatements.com — Design System
   Version 1.0 | Based on Design & Branding Bible
   ============================================ */

/* ---- CSS Custom Properties (Design Tokens) ---- */
:root {
  /* Core palette */
  --ink: #14213D;
  --brand-blue: #1F4E79;
  --brand-blue-hover: #163A5C;
  --paper: #FDFBF7;
  --surface: #FFFFFF;
  --accent-amber: #E8A33D;
  --accent-amber-soft: #FBF0DC;
  --success-green: #2E7D4F;
  --alert-red: #C0392B;
  --muted: #5A6472;
  --border: #E3DED4;

  /* Grade accent tints (chips only) */
  --grade-aa-ao: #8FA9C4;
  --grade-eo: #6C8FB0;
  --grade-heo: #4A759C;
  --grade-seo: #2E5B88;
  --grade-g7-g6: #1F4E79;
  --grade-scs: #14213D;

  /* Typography */
  --font-heading: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'Cascadia Code', monospace;

  /* Type scale (1.25 ratio, 18px base) */
  --text-h1: 2.75rem;      /* 44px */
  --text-h2: 2rem;         /* 32px */
  --text-h3: 1.5rem;       /* 24px */
  --text-h4: 1.25rem;      /* 20px */
  --text-body: 1.125rem;   /* 18px */
  --text-small: 0.9375rem; /* 15px */
  --text-lead: 1.3125rem;  /* 21px */
  --text-pull: 1.5rem;     /* 24px */

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  /* Layout */
  --max-container: 1120px;
  --content-max: 680px;
  --rail-width: 260px;
  --gutter: 24px;

  /* Borders */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --border-width: 1px;
  --border-width-thick: 1.5px;

  /* Shadows */
  --shadow-hover: 0 2px 8px rgba(20, 33, 61, 0.08);
  --shadow-card: 0 1px 3px rgba(20, 33, 61, 0.06);
}

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

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

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

/* ---- Typography ---- */
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.15;
}

h4, h5, h6 {
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: var(--text-h1);
  margin-bottom: var(--space-5);
}

h2 {
  font-size: var(--text-h2);
  font-weight: 600;
  margin-top: var(--space-7);
  margin-bottom: var(--space-4);
  line-height: 1.2;
}

h3 {
  font-size: var(--text-h3);
  font-weight: 600;
  margin-top: var(--space-6);
  margin-bottom: var(--space-3);
  line-height: 1.25;
}

h4 {
  font-size: var(--text-h4);
  margin-top: var(--space-5);
  margin-bottom: var(--space-2);
}

p {
  margin-bottom: var(--space-5);
  max-width: var(--content-max);
}

a {
  color: var(--brand-blue);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s ease;
}

a:hover, a:focus {
  color: var(--brand-blue-hover);
}

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

/* Lead paragraph */
.lead {
  font-size: var(--text-lead);
  line-height: 1.55;
  margin-bottom: var(--space-6);
  color: var(--muted);
}

/* Small / caption */
.small, .caption, .meta {
  font-size: var(--text-small);
  line-height: 1.45;
  color: var(--muted);
}

/* Pull quote */
.pull-quote {
  font-family: var(--font-heading);
  font-size: var(--text-pull);
  font-weight: 600;
  font-style: italic;
  line-height: 1.4;
  padding: var(--space-5) var(--space-6);
  border-left: 4px solid var(--accent-amber);
  background: var(--surface);
  margin: var(--space-6) 0;
}

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

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
  max-width: var(--max-container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (min-width: 1024px) {
  .content-wrapper {
    grid-template-columns: 1fr var(--rail-width);
  }
}

main {
  max-width: var(--content-max);
}

/* ---- Header ---- */
.site-header {
  background: var(--brand-blue);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--surface);
  text-decoration: none;
}

.site-logo span {
  color: var(--accent-amber);
}

.site-nav {
  display: flex;
  gap: var(--space-5);
  list-style: none;
}

.site-nav a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: var(--text-small);
  font-weight: 500;
  padding: var(--space-2) 0;
}

.site-nav a:hover {
  color: var(--surface);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--surface);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .site-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--brand-blue);
    flex-direction: column;
    padding: var(--space-4);
  }
  .site-nav.active {
    display: flex;
  }
  .nav-toggle {
    display: block;
  }
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  padding: var(--space-4) 0;
  font-size: var(--text-small);
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
  text-decoration: none;
}

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

.breadcrumb .sep {
  margin: 0 var(--space-2);
  color: var(--border);
}

/* ---- Hero ---- */
.hero {
  padding: var(--space-8) 0 var(--space-7);
  background: var(--paper);
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 120px;
  height: 4px;
  background: var(--accent-amber);
}

.hero h1 {
  max-width: var(--content-max);
  margin-bottom: var(--space-4);
}

.hero .lead {
  max-width: 560px;
}

.hero-actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-5);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  border: none;
  gap: var(--space-2);
}

.btn-primary {
  background: var(--brand-blue);
  color: var(--surface);
}

.btn-primary:hover {
  background: var(--brand-blue-hover);
  color: var(--surface);
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--brand-blue);
  border: var(--border-width-thick) solid var(--brand-blue);
}

.btn-secondary:hover {
  background: var(--brand-blue);
  color: var(--surface);
  text-decoration: none;
}

.btn-full {
  width: 100%;
}

@media (max-width: 480px) {
  .btn {
    width: 100%;
  }
}

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover {
  text-decoration: none;
  color: inherit;
}

/* ---- Chips / Badges ---- */
.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: 100px;
  font-size: var(--text-small);
  font-weight: 600;
  line-height: 1.4;
}

.chip-behaviour {
  background: #EAF1F7;
  color: var(--brand-blue);
}

.chip-grade {
  background: var(--grade-heo);
  color: var(--surface);
}

.chip-word-count {
  background: var(--paper);
  color: var(--muted);
  border: var(--border-width) solid var(--border);
}

.chip-amber {
  background: var(--accent-amber-soft);
  color: var(--ink);
}

/* Grade-specific chips */
.chip-grade-ao { background: var(--grade-aa-ao); color: var(--ink); }
.chip-grade-eo { background: var(--grade-eo); color: var(--surface); }
.chip-grade-heo { background: var(--grade-heo); color: var(--surface); }
.chip-grade-seo { background: var(--grade-seo); color: var(--surface); }
.chip-grade-g7 { background: var(--grade-g7-g6); color: var(--surface); }
.chip-grade-g6 { background: var(--grade-g7-g6); color: var(--surface); }
.chip-grade-scs { background: var(--grade-scs); color: var(--surface); }

/* ---- Meta row ---- */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  border-bottom: var(--border-width) solid var(--border);
}

/* ---- Example Panel (Signature Component) ---- */
.example-panel {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-left: 4px solid var(--brand-blue);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-6) 0;
  position: relative;
}

.example-panel .word-count-badge {
  position: absolute;
  top: var(--space-4);
  right: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--muted);
  background: var(--paper);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-sm);
}

.example-text {
  font-size: var(--text-body);
  line-height: 1.7;
  margin-top: var(--space-5);
}

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

/* STAR annotations */
.star-marker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-right: var(--space-2);
  vertical-align: middle;
}

.star-s { background: #E3F2FD; color: #1565C0; }
.star-t { background: #FFF3E0; color: #E65100; }
.star-a { background: #E8F5E9; color: #2E7D32; }
.star-r { background: #F3E5F5; color: #6A1B9A; }

.star-toggle {
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--paper);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--text-small);
  font-weight: 600;
  color: var(--brand-blue);
}

/* ---- Callout Boxes ---- */
.callout {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin: var(--space-5) 0;
  position: relative;
}

.callout-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.callout-tip {
  background: var(--accent-amber-soft);
  border: var(--border-width) solid var(--accent-amber);
}

.callout-tip .callout-label { color: #B7791F; }

.callout-mistake {
  background: #FBEDEA;
  border: var(--border-width) solid var(--alert-red);
}

.callout-mistake .callout-label { color: var(--alert-red); }

.callout-success {
  background: #EAF4EE;
  border: var(--border-width) solid var(--success-green);
}

.callout-success .callout-label { color: var(--success-green); }

.callout-official {
  background: #EAF1F7;
  border: var(--border-width) solid var(--brand-blue);
}

.callout-official .callout-label { color: var(--brand-blue); }

/* ---- Quick Answer Box ---- */
.quick-answer {
  background: var(--accent-amber-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin: var(--space-5) 0;
}

.quick-answer p {
  margin-bottom: 0;
  font-size: var(--text-lead);
}

/* ---- Grid layouts ---- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-5);
  margin: var(--space-6) 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-5);
  margin: var(--space-6) 0;
}

/* ---- Behaviour Grid (3x3) ---- */
.behaviour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-4);
  margin: var(--space-6) 0;
}

.behaviour-card {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.behaviour-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.behaviour-card .icon {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-3);
  color: var(--brand-blue);
}

.behaviour-card h3 {
  font-size: var(--text-h4);
  margin: 0 0 var(--space-2) 0;
}

.behaviour-card p {
  font-size: var(--text-small);
  color: var(--muted);
  margin: 0;
}

/* ---- Grade chips strip ---- */
.grade-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-5) 0;
}

.grade-chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  border-radius: 100px;
  font-size: var(--text-small);
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.1s ease;
}

.grade-chip:hover {
  transform: scale(1.05);
  text-decoration: none;
}

/* ---- FAQ Accordion ---- */
.faq-item {
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  background: var(--surface);
  border: none;
  padding: var(--space-4) var(--space-5);
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question:hover {
  background: var(--paper);
}

.faq-question .icon {
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: var(--space-3);
}

.faq-question[aria-expanded="true"] .icon {
  transform: rotate(45deg);
}

.faq-answer {
  padding: 0 var(--space-5) var(--space-4);
  background: var(--surface);
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

/* ---- Comparison Table ---- */
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-5) 0;
  font-size: var(--text-small);
}

.comparison-table th,
.comparison-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  border-bottom: var(--border-width) solid var(--border);
}

.comparison-table th {
  background: var(--paper);
  font-weight: 700;
  position: sticky;
  top: 0;
}

.comparison-table tr:nth-child(even) {
  background: #F7F4ED;
}

@media (max-width: 768px) {
  .comparison-table {
    display: block;
    overflow-x: auto;
  }
}

/* ---- Link Module ---- */
.link-module {
  background: var(--paper);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin: var(--space-6) 0;
}

.link-module h3 {
  margin-top: 0;
  font-size: var(--text-h4);
}

.link-module ul {
  list-style: none;
  padding: 0;
}

.link-module li {
  margin-bottom: var(--space-3);
}

.link-module a {
  font-weight: 500;
}

/* ---- Checklist ---- */
.checklist {
  list-style: none;
  padding: 0;
}

.checklist li {
  position: relative;
  padding-left: var(--space-6);
  margin-bottom: var(--space-3);
}

.checklist li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--success-green);
  font-weight: 700;
}

/* ---- Section Nav (On this page) ---- */
.section-nav {
  background: var(--surface);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: sticky;
  top: 80px;
}

.section-nav h3 {
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 var(--space-3) 0;
  color: var(--muted);
}

.section-nav ul {
  list-style: none;
  padding: 0;
}

.section-nav li {
  margin-bottom: var(--space-2);
}

.section-nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: var(--text-small);
}

.section-nav a:hover {
  color: var(--brand-blue);
  text-decoration: underline;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--ink);
  color: rgba(255,255,255,0.7);
  padding: var(--space-7) 0 var(--space-5);
  margin-top: var(--space-8);
}

.site-footer a {
  color: rgba(255,255,255,0.8);
}

.site-footer a:hover {
  color: var(--surface);
}

.footer-disclaimer {
  font-size: var(--text-small);
  border-top: var(--border-width) solid rgba(255,255,255,0.1);
  padding-top: var(--space-5);
  margin-top: var(--space-5);
  color: rgba(255,255,255,0.5);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}

.footer-col h4 {
  color: var(--surface);
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

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

.footer-col li {
  margin-bottom: var(--space-2);
  font-size: var(--text-small);
}

/* ---- Utility classes ---- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  :root {
    --text-h1: 2rem;      /* 32px */
    --text-h2: 1.625rem;  /* 26px */
    --text-h3: 1.3125rem; /* 21px */
    --text-h4: 1.125rem;  /* 18px */
  }

  .hero {
    padding: var(--space-6) 0 var(--space-5);
  }

  .example-panel {
    padding: var(--space-4);
  }

  .grid-3, .grid-2 {
    grid-template-columns: 1fr;
  }

  .behaviour-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Print styles ---- */
@media print {
  .site-header, .site-footer, .section-nav, .nav-toggle {
    display: none;
  }

  body {
    background: white;
    color: black;
  }

  a {
    text-decoration: underline;
    color: black;
  }

  .example-panel {
    border: 1px solid #ccc;
    page-break-inside: avoid;
  }
}
