/* =====================================================
   style.css
   Dan's bloody glorious stylesheet for dancoleman.co.uk and other stuff.
   Version 1 - March 2026
   Contents:
   01. Design tokens (CSS custom properties)
   02. Reset & base
   03. Typography
   04. Links
   05. Layout — hero
   06. Layout — back link
   07. Layout — main & sections
   08. Layout — grid
   09. Components — cards
   10. Components — prose (long-form text)
   11. Components — badges & tags
   12. Components — buttons & CTAs
   13. Components — toggle switch (light/dark)
   14. Components — footer
   15. Page — contact form
   16. Page — CV / download card
   17. Page — websites (pricing)
   18. Utilities
   19. Animations
   20. Responsive overrides
   ===================================================== */


/* ─────────────────────────────────────────────────────
   01. Design tokens
   
   Colour contrast ratios (WCAG 2.2 AA, tested against
   both --bg and --card in each theme):
   
   DARK:
     --text   on --bg    14.53:1  ✅ AAA
     --text   on --card  12.29:1  ✅ AAA
     --muted  on --bg     6.71:1  ✅ AA
     --muted  on --card   5.67:1  ✅ AA
     --accent on --bg     5.56:1  ✅ AA
     --accent on --card   4.70:1  ✅ AA
     --border vs --bg     3.60:1  ✅ WCAG 1.4.11
     --border vs --card   3.04:1  ✅ WCAG 1.4.11
   
   LIGHT:
     --text   on --bg    16.41:1  ✅ AAA
     --text   on --card  17.86:1  ✅ AAA
     --muted  on --bg     6.34:1  ✅ AA
     --muted  on --card   6.90:1  ✅ AA
     --accent on --bg     4.96:1  ✅ AA
     --accent on --card   5.40:1  ✅ AA
     --border vs --bg     3.41:1  ✅ WCAG 1.4.11
     --border vs --card   3.71:1  ✅ WCAG 1.4.11
   ───────────────────────────────────────────────────── */

:root {
  /* Colour — dark theme (default) */
  --bg:       #1a1d27;
  --bg2:      #22263a;
  --card:     #252a3d;
  --border:   #6b7299;
  --text:     #eceef8;
  --muted:    #9ca2c4;
  --accent:   #4a95f8;
  --accent2:  #7c5cfc;
  --success:  #3ab97a;
  --error:    #e05252;

  /* Colour — semantic aliases (reassigned per theme below) */
  --focus-ring: color-mix(in srgb, var(--accent) 40%, transparent);

  /* Typography */
  --font-sans: "Space Grotesk", sans-serif;
  --font-mono: "Space Mono", monospace;

  /* Spacing scale */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  1rem;
  --space-lg:  1.5rem;
  --space-xl:  2rem;
  --space-2xl: 3rem;
  --space-3xl: 3.5rem;

  /* Radii */
  --radius-sm: 6px;
  --radius:    12px;
  --radius-lg: 16px;

  /* Transitions */
  --transition-fast:   0.15s ease;
  --transition-base:   0.2s ease;
  --transition-slow:   0.3s ease;

  /* Shadows */
  --shadow-card:   0 6px 24px rgba(0, 0, 0, 0.18);
  --shadow-btn:    0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
  --bg:      #1a1d27;
  --bg2:     #22263a;
  --card:    #252a3d;
  --border:  #6b7299;
  --text:    #eceef8;
  --muted:   #9ca2c4;
  --accent:  #4a95f8;
}

[data-theme="light"] {
  --bg:      #f4f5fb;
  --bg2:     #eaecf7;
  --card:    #ffffff;
  --border:  #7c83a6;
  --text:    #13162a;
  --muted:   #545878;
  --accent:  #0062e6;
  --success: #1e9e62;
}


/* ─────────────────────────────────────────────────────
   02. Reset & base
   ───────────────────────────────────────────────────── */

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

html {
  scroll-behavior: smooth;
  /* Prevent font size inflation on iOS */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background var(--transition-slow),
    color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Visible focus ring for keyboard navigation (WCAG 2.4.7) */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}


/* ─────────────────────────────────────────────────────
   03. Typography
   ───────────────────────────────────────────────────── */

h1 {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
}

h2 {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

p {
  line-height: 1.6;
}

small,
.text-sm {
  font-size: 0.8125rem;
}

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

.text-muted {
  color: var(--muted);
}


/* ─────────────────────────────────────────────────────
   04. Links
   ───────────────────────────────────────────────────── */

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-base);
}

a:hover {
  border-color: var(--accent);
}


/* ─────────────────────────────────────────────────────
   05. Layout — hero
   ───────────────────────────────────────────────────── */

.hero {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-3xl) var(--space-xl);
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  animation: fadeUp 0.5s ease both;
}

.avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--card);
  border: 3px solid var(--border);
  flex-shrink: 0;
  object-fit: cover;
  overflow: hidden;
}

.hero-text h1 {
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
}

.hero-text p {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--muted);
  margin-top: 0.35rem;
}


/* ─────────────────────────────────────────────────────
   06. Layout — back link
   ───────────────────────────────────────────────────── */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  border-bottom: none;
  max-width: 680px;
  margin: 0 auto 0.25rem;
  width: 100%;
  padding: 0 var(--space-xl) var(--space-md);
  transition: color var(--transition-base), gap var(--transition-base);
  animation: fadeUp 0.5s ease both;
  animation-delay: 0.08s;
}

.back-link:hover {
  color: var(--accent);
  gap: 0.65rem;
  border-bottom: none;
}


/* ─────────────────────────────────────────────────────
   07. Layout — main & sections
   ───────────────────────────────────────────────────── */

main {
  flex: 1;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
  padding: 0 var(--space-xl) var(--space-2xl);
}

.section {
  margin-bottom: 2.5rem;
  animation: fadeUp 0.5s ease both;
}

.section:nth-child(2) { animation-delay: 0.05s; }
.section:nth-child(3) { animation-delay: 0.10s; }
.section:nth-child(4) { animation-delay: 0.15s; }

.section-title {
  font-size: 1.125rem;
  font-weight: 500;
  margin-bottom: 0.75rem;
  color: var(--text);
}


/* ─────────────────────────────────────────────────────
   08. Layout — grid
   ───────────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: 0.75rem;
}

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


/* ─────────────────────────────────────────────────────
   09. Components — cards
   ───────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md) 1.25rem;
  transition:
    background var(--transition-slow),
    border-color var(--transition-slow),
    transform var(--transition-fast),
    box-shadow var(--transition-fast);
}

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

.card-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--space-sm);
}

.card-icon {
  font-size: 1.25rem;
  line-height: 1;
  /* Prevent emoji from being announced redundantly by screen readers */
  aria-hidden: true;
}

.card-title {
  font-size: 0.9375rem;
  font-weight: 500;
}

.card-body {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
}


/* ─────────────────────────────────────────────────────
   10. Components — prose (long-form / blog text)
   ───────────────────────────────────────────────────── */

.prose {
  font-size: 0.9375rem;
  line-height: 1.75;
  color: var(--text);
}

.prose p              { margin-bottom: 1.1rem; }
.prose h2             { font-size: 1.125rem; font-weight: 700; margin: 2rem 0 0.6rem; }
.prose h3             { font-size: 1rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
.prose ul,
.prose ol             { padding-left: 1.4rem; margin-bottom: var(--space-md); }
.prose li             { margin-bottom: 0.35rem; }
.prose code           {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--bg2);
  border-radius: 4px;
  padding: 0.1em 0.4em;
}
.prose pre            {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  overflow-x: auto;
  margin-bottom: var(--space-md);
}
.prose pre code       { background: none; padding: 0; }
.prose hr             { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.prose blockquote     {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-md);
  color: var(--muted);
  font-style: italic;
  margin: 1.5rem 0;
}
.prose a              { color: var(--accent); }
.prose strong         { font-weight: 700; color: var(--text); }


/* ─────────────────────────────────────────────────────
   11. Components — badges & tags
   ───────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--font-mono);
  font-size: 0.725rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2em 0.6em;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
}


/* ─────────────────────────────────────────────────────
   12. Components — buttons & CTAs
   ───────────────────────────────────────────────────── */

/* Base button reset */
button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
}

/* Primary CTA button — used across pages */
.btn,
.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem 1.35rem;
  margin-top:1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  text-decoration: none;
  transition:
    opacity var(--transition-base),
    transform var(--transition-fast);
}

.btn:hover,
.cta:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  border-bottom: none;
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Secondary / ghost button */
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: var(--accent);
}


/* ─────────────────────────────────────────────────────
   13. Components — toggle switch (light/dark)
   ───────────────────────────────────────────────────── */

.toggle-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  /* Prevent emoji labels being selected */
  user-select: none;
}

.toggle {
  position: relative;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle input {
  /* Visually hidden but still keyboard-accessible */
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  transition: background var(--transition-base);
  pointer-events: none;
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  pointer-events: none;
  transition: transform var(--transition-base);
}

.toggle input:checked ~ .toggle-thumb {
  transform: translateX(20px);
}


/* ─────────────────────────────────────────────────────
   14. Components — footer
   ───────────────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  transition: border-color var(--transition-slow);
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.footer-left p {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  color: var(--muted);
  line-height: 1.5;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────────────
   15. Page — contact form
   ───────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: var(--space-md);
}

.form-group:last-of-type {
  margin-bottom: 0;
}

label {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input[type="text"],
input[type="email"],
textarea {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  width: 100%;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background var(--transition-slow),
    color var(--transition-slow);
  outline: none;
  resize: none;
  /* Inherit body font smoothing */
  -webkit-font-smoothing: antialiased;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

textarea {
  min-height: 140px;
}

/* Honeypot — visually hidden, traps bots */
.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* Submit button inherits .btn styles; just adds margin */
.submit-btn {
  margin-top: 1.25rem;
}

/* Form feedback messages */
.form-feedback {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  padding: 0.75rem var(--space-md);
  border-radius: var(--radius-sm);
  margin-top: var(--space-md);
  /* role="alert" set in JS so screen readers announce it */
}

.form-feedback.success {
  display: block;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--text);
}

.form-feedback.error {
  display: block;
  background: color-mix(in srgb, var(--error) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--error) 35%, transparent);
  color: var(--text);
}


/* ─────────────────────────────────────────────────────
   16. Page — CV / download card
   ───────────────────────────────────────────────────── */

.download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.download-meta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.file-icon {
  width: 48px;
  height: 48px;
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.file-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.file-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text);
}

.file-info {
  font-family: var(--font-mono);
  font-size: 0.775rem;
  color: var(--muted);
}

/* Download button re-uses .btn */
.download-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.65rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  white-space: nowrap;
  text-decoration: none;
  transition:
    opacity var(--transition-base),
    transform var(--transition-fast);
  flex-shrink: 0;
}

.download-btn:hover {
  opacity: 0.88;
  transform: translateY(-1px);
  border-bottom: none;
  color: #fff;
}

.download-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}


/* ─────────────────────────────────────────────────────
   17. Page — websites (pricing)
   ───────────────────────────────────────────────────── */

/* Struck-through text (used for ironic "awful" great tools line) */
.struck {
  text-decoration: line-through;
  color: var(--muted);
}

/* Pricing display */
.price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.25rem 0 0.25rem;
}

.price span {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  margin-left: 0.25rem;
}


/* ─────────────────────────────────────────────────────
   18. Utilities
   ───────────────────────────────────────────────────── */

/* Visually hidden — accessible to screen readers */
.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;
}

/* Skip to main content link — shown on focus for keyboard users (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  z-index: 9999;
  padding: var(--space-sm) var(--space-md);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
}


/* ─────────────────────────────────────────────────────
   19. Animations
   ───────────────────────────────────────────────────── */

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Respect prefers-reduced-motion (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ─────────────────────────────────────────────────────
   20. Responsive overrides
   ───────────────────────────────────────────────────── */

@media (max-width: 520px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .hero {
    flex-direction: column;
    text-align: center;
    padding-top: 2.5rem;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-md);
  }

  .download-card {
    flex-direction: column;
    align-items: flex-start;
  }
}
