/* ============================================================
   DECIDING DESIGN SYSTEM — Colors & Typography
   ============================================================
   Brand: Deciding by Sufficient Certainty Pty Ltd
   Voice: Editorial restraint. Serif-first. Single accent.
   ============================================================ */

/* --- Self-hosted Source Serif 4 --- */
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-It.ttf') format('truetype');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-Semibold.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-SemiboldIt.ttf') format('truetype');
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-Semibold.ttf') format('truetype');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('fonts/SourceSerif4-BoldIt.ttf') format('truetype');
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* --- Source Serif 4 Display (for large headings) --- */
@font-face {
  font-family: 'Source Serif 4 Display';
  src: url('fonts/SourceSerif4Display-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4 Display';
  src: url('fonts/SourceSerif4Display-Semibold.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4 Display';
  src: url('fonts/SourceSerif4Display-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ============================================================
   BASE TOKENS
   ============================================================ */
:root {
  /* --- Typography Families --- */
  --font-serif:        'Source Serif 4', 'Georgia', 'Times New Roman', serif;
  --font-serif-display:'Source Serif 4 Display', 'Source Serif 4', 'Georgia', serif;
  --font-sans:         system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono:         'SFMono-Regular', 'Consolas', 'Liberation Mono', 'Menlo', monospace;

  /* --- Type Scale (based on 1.25 ratio, 18px base) --- */
  --text-xs:           0.75rem;    /* 12px — captions, legal */
  --text-sm:           0.875rem;   /* 14px — small labels */
  --text-base:         1.125rem;   /* 18px — body */
  --text-lg:           1.25rem;    /* 20px — lead/intro */
  --text-xl:           1.5rem;     /* 24px — H4 */
  --text-2xl:          1.875rem;   /* 30px — H3 */
  --text-3xl:          2.25rem;    /* 36px — H2 */
  --text-4xl:          3rem;       /* 48px — H1 */
  --text-5xl:          3.75rem;    /* 60px — Display */

  /* --- Line Heights --- */
  --leading-tight:     1.2;
  --leading-snug:      1.35;
  --leading-normal:    1.6;
  --leading-relaxed:   1.75;

  /* --- Font Weights --- */
  --weight-regular:    400;
  --weight-medium:     500;
  --weight-semibold:   600;
  --weight-bold:       700;

  /* --- Letter Spacing --- */
  --tracking-tight:   -0.01em;
  --tracking-normal:   0;
  --tracking-wide:     0.02em;
  --tracking-caps:     0.08em;

  /* --- Measure (max line width) --- */
  --measure:           65ch;
  --measure-wide:      70ch;
  --measure-narrow:    45ch;

  /* --------------------------------------------------------
     COLOUR — Background
     -------------------------------------------------------- */
  --bg-primary:        #FAFAF7;    /* warm cream — page background */
  --bg-secondary:      #F2F1EC;    /* slightly darker — cards, wells */
  --bg-tertiary:       #E8E7E2;    /* borders, dividers, hover fills */
  --bg-inverse:        #1A1A1A;    /* dark sections */
  --bg-inverse-soft:   #2A2A28;    /* dark sections — elevated */

  /* --------------------------------------------------------
     COLOUR — Foreground / Text
     -------------------------------------------------------- */
  --fg-primary:        #1A1A1A;    /* main text — NOT pure black */
  --fg-secondary:      #4A4A46;    /* secondary text, descriptions */
  --fg-tertiary:       #7A7A74;    /* captions, timestamps, muted */
  --fg-inverse:        #FAFAF7;    /* text on dark backgrounds */
  --fg-inverse-muted:  #B0AFA8;    /* muted text on dark */

  /* --------------------------------------------------------
     COLOUR — Accent (single accent — editorial blue)
     -------------------------------------------------------- */
  --accent:            #3B7FC7;    /* refined editorial blue */
  --accent-hover:      #2E6AAD;    /* darker on hover */
  --accent-active:     #245890;    /* pressed state */
  --accent-light:      #EBF2FA;    /* very subtle blue tint */
  --accent-muted:      #8AB4DB;    /* de-emphasised accent */

  /* --------------------------------------------------------
     COLOUR — Borders
     -------------------------------------------------------- */
  --border:            #D6D5CF;    /* default border */
  --border-light:      #E8E7E2;    /* subtle dividers */
  --border-strong:     #ACABAA;    /* emphasis borders */
  --border-accent:     #3B7FC7;    /* accent-coloured border */

  /* --------------------------------------------------------
     COLOUR — Semantic / Feedback
     Three colours only. Info = accent (one blue, not two).
     Warning removed — editorial brands rarely need four.
     -------------------------------------------------------- */
  --color-success:     #6B7F56;    /* olive/sage — restrained, warm */
  --color-error:       #94443A;    /* oxblood/terracotta — serious, not alarming */
  --color-info:        var(--accent); /* merged into brand accent */

  /* --------------------------------------------------------
     SPACING
     -------------------------------------------------------- */
  --space-1:           0.25rem;    /* 4px */
  --space-2:           0.5rem;     /* 8px */
  --space-3:           0.75rem;    /* 12px */
  --space-4:           1rem;       /* 16px */
  --space-5:           1.5rem;     /* 24px */
  --space-6:           2rem;       /* 32px */
  --space-7:           3rem;       /* 48px */
  --space-8:           4rem;       /* 64px */
  --space-9:           6rem;       /* 96px */
  --space-10:          8rem;       /* 128px */

  /* --------------------------------------------------------
     BORDERS & RADII
     -------------------------------------------------------- */
  --radius-sm:         3px;        /* subtle rounding — inputs */
  --radius-md:         5px;        /* cards, buttons */
  --radius-lg:         8px;        /* modals, larger panels */
  --radius-none:       0;
  --border-width:      1px;

  /* --------------------------------------------------------
     SHADOWS — minimal, editorial
     -------------------------------------------------------- */
  --shadow-sm:         0 1px 2px rgba(26, 26, 26, 0.05);
  --shadow-md:         0 2px 8px rgba(26, 26, 26, 0.08);
  --shadow-lg:         0 4px 16px rgba(26, 26, 26, 0.10);

  /* --------------------------------------------------------
     TRANSITIONS
     -------------------------------------------------------- */
  --duration-fast:     120ms;
  --duration-normal:   200ms;
  --easing:            ease-in-out;
}


/* ============================================================
   SEMANTIC / COMPONENT-LEVEL TOKENS
   ============================================================ */
:root {
  /* --- Headings --- */
  --h1-font:           var(--font-serif);
  --h1-size:           var(--text-4xl);
  --h1-weight:         var(--weight-medium);
  --h1-leading:        var(--leading-tight);
  --h1-tracking:       var(--tracking-tight);

  --h2-font:           var(--font-serif);
  --h2-size:           var(--text-3xl);
  --h2-weight:         var(--weight-medium);
  --h2-leading:        var(--leading-tight);

  --h3-font:           var(--font-serif);
  --h3-size:           var(--text-2xl);
  --h3-weight:         var(--weight-regular);
  --h3-leading:        var(--leading-snug);

  --h4-font:           var(--font-serif);
  --h4-size:           var(--text-xl);
  --h4-weight:         var(--weight-medium);
  --h4-leading:        var(--leading-snug);

  /* --- Body --- */
  --body-font:         var(--font-serif);
  --body-size:         var(--text-base);
  --body-weight:       var(--weight-regular);
  --body-leading:      var(--leading-relaxed);
  --body-color:        var(--fg-primary);

  /* --- Small / Caption --- */
  --caption-font:      var(--font-serif);
  --caption-size:      var(--text-sm);
  --caption-color:     var(--fg-tertiary);

  /* --- Overline / Label --- */
  --label-font:        var(--font-sans);
  --label-size:        var(--text-xs);
  --label-weight:      var(--weight-semibold);
  --label-tracking:    var(--tracking-caps);
  --label-color:       var(--fg-tertiary);

  /* --- Code --- */
  --code-font:         var(--font-mono);
  --code-size:         0.9em;
  --code-bg:           var(--bg-secondary);
  --code-color:        var(--fg-primary);

  /* --- Links --- */
  --link-color:        var(--accent);
  --link-hover:        var(--accent-hover);
  --link-decoration:   underline;
  --link-underline-offset: 0.15em;

  /* --- Buttons (forms + CTAs use sans) --- */
  --btn-font:          var(--font-sans);
  --btn-size:          var(--text-sm);
  --btn-weight:        var(--weight-medium);
  --btn-radius:        var(--radius-md);
  --btn-padding:       var(--space-2) var(--space-5);

  /* --- Inputs --- */
  --input-font:        var(--font-sans);
  --input-size:        var(--text-base);
  --input-radius:      var(--radius-sm);
  --input-border:      var(--border);
  --input-bg:          #FFFFFF;
  --input-padding:     var(--space-3) var(--space-4);

  /* --- Section spacing --- */
  --section-gap:       var(--space-9);      /* 6rem between sections */
  --section-gap-lg:    var(--space-10);     /* 8rem for major breaks */
}


/* ============================================================
   BASE RESET + DEFAULTS
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  font-family: var(--body-font);
  font-size: var(--body-size);
  font-weight: var(--body-weight);
  line-height: var(--body-leading);
  color: var(--body-color);
  background-color: var(--bg-primary);
}

/* --- Headings --- */
h1, .h1 {
  font-family: var(--h1-font);
  font-size: var(--h1-size);
  font-weight: var(--h1-weight);
  line-height: var(--h1-leading);
  letter-spacing: var(--h1-tracking);
  color: var(--fg-primary);
  margin: 0 0 var(--space-5) 0;
}

h2, .h2 {
  font-family: var(--h2-font);
  font-size: var(--h2-size);
  font-weight: var(--h2-weight);
  line-height: var(--h2-leading);
  color: var(--fg-primary);
  margin: 0 0 var(--space-4) 0;
}

h3, .h3 {
  font-family: var(--h3-font);
  font-size: var(--h3-size);
  font-weight: var(--h3-weight);
  line-height: var(--h3-leading);
  color: var(--fg-primary);
  margin: 0 0 var(--space-3) 0;
}

h4, .h4 {
  font-family: var(--h4-font);
  font-size: var(--h4-size);
  font-weight: var(--h4-weight);
  line-height: var(--h4-leading);
  color: var(--fg-primary);
  margin: 0 0 var(--space-3) 0;
}

/* --- Paragraphs --- */
p {
  margin: 0 0 var(--space-4) 0;
  max-width: var(--measure);
  text-wrap: pretty;
}

/* --- Links --- */
a {
  color: var(--link-color);
  text-decoration: var(--link-decoration);
  text-underline-offset: var(--link-underline-offset);
  transition: color var(--duration-fast) var(--easing);
}
a:hover {
  color: var(--link-hover);
}

/* --- Code --- */
code {
  font-family: var(--code-font);
  font-size: var(--code-size);
  background: var(--code-bg);
  color: var(--code-color);
  padding: 0.15em 0.35em;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--code-font);
  font-size: var(--text-sm);
  background: var(--bg-secondary);
  color: var(--fg-primary);
  padding: var(--space-5);
  border-radius: var(--radius-md);
  overflow-x: auto;
  line-height: 1.5;
}

/* --- Blockquote --- */
blockquote {
  margin: var(--space-6) 0;
  padding-left: var(--space-5);
  border-left: 3px solid var(--border-strong);
  color: var(--fg-secondary);
  font-style: italic;
}

/* --- Horizontal Rule --- */
hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: var(--space-7) 0;
}

/* --- Small text --- */
small, .caption {
  font-family: var(--caption-font);
  font-size: var(--caption-size);
  color: var(--caption-color);
}

/* --- Overline / Label --- */
.overline, .label {
  font-family: var(--label-font);
  font-size: var(--label-size);
  font-weight: var(--label-weight);
  letter-spacing: var(--label-tracking);
  text-transform: uppercase;
  color: var(--label-color);
}
