/* ==========================================================================
   Computerbank Victoria - Global Styles
   ========================================================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Brand colours - from stakeholder spec */
  --color-orange: #d1541a;
  --color-orange-dark: #b54716;
  --color-orange-darker: #9c3d13;
  --color-orange-light: #e06a30;
  --color-blue: #2b3990;
  --color-blue-light: #3a48a0;

  /* Neutrals */
  --color-white: #ffffff;
  --color-grey-50: #f8f8f8;
  --color-grey-100: #f0f0f0;
  --color-grey-200: #e0e0e0;
  /* #999 is 2.85:1 on white - it fails WCAG AA for text. Borders, dividers
     and decorative icons only; use --color-text-muted for small print. */
  --color-grey-400: #999999;
  --color-grey-600: #666666;
  --color-grey-800: #333333;
  --color-grey-900: #1a1a1a;

  /* Semantic */
  --color-text: var(--color-grey-800);
  --color-text-muted: var(--color-grey-600);
  --color-text-on-dark: var(--color-white);
  --color-text-muted-on-dark: #d0d0d0;
  --color-bg: var(--color-white);
  --color-bg-alt: var(--color-grey-50);
  --color-link: var(--color-orange-dark);
  --color-link-hover: var(--color-orange-darker);
  --color-accent: var(--color-orange);
  --color-accent-hover: var(--color-orange-dark);

  /* Typography - 2 fonts max (Hanken Grotesk for body, Bricolage Grotesque for headings) */
  --font-body: 'Hanken Grotesk', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-heading: 'Bricolage Grotesque', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  /* Semantic status colours */
  --color-success: #2e7d32;
  --color-success-light: #e8f5e9;
  --color-warning: #a84300;
  --color-warning-light: #fff3e0;
  --color-error: #c62828;
  --color-error-light: #ffebee;
  --color-info: #1565c0;
  --color-info-light: #e3f2fd;

  /* Sizing */
  --max-width: 1200px;
  --header-height: 72px;
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.2);

  /* 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: 4rem;
  --space-4xl: 6rem;
}

/* --- 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: 1rem;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--color-link-hover);
}

/* Underline inline links in body text, so they are not distinguished by colour
   alone (WCAG 1.4.1). Links with no class of their own, inside list items and
   spans, count too -
   those are prose, not navigation. */
p a,
td a,
li a:not([class]),
span a:not([class]) {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* Navigation and link lists read as menus, not prose - no underline needed. */
nav a:not([class]),
.footer__list a:not([class]) {
  text-decoration: none;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-grey-900);
}

h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}
h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  margin-bottom: var(--space-lg);
}
h3 {
  font-size: clamp(1.25rem, 3vw, 1.5rem);
}

p + p {
  margin-top: var(--space-md);
}

/* --- Utility Classes --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.section {
  padding-block: var(--space-3xl);
}

/* 320px is the narrowest width WCAG 1.4.10 (Reflow) has to work at - 24px of
   gutter each side is too much to give away there. */
@media (max-width: 400px) {
  .container {
    padding-inline: var(--space-md);
  }
}

.section--alt {
  background-color: var(--color-bg-alt);
}

.section--dark {
  background-color: var(--color-grey-900);
  color: var(--color-text-on-dark);
}

.section--orange {
  background-color: var(--color-orange-dark);
  color: var(--color-text-on-dark);
}

.text-center {
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    transform 0.1s ease;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background-color: var(--color-orange-dark);
  color: var(--color-white);
}

.btn--primary:hover {
  background-color: var(--color-orange-darker);
  color: var(--color-white);
}

.btn--secondary {
  background-color: var(--color-white);
  color: var(--color-orange-dark);
  border: 2px solid var(--color-orange-dark);
}

.btn--secondary:hover {
  background-color: var(--color-orange-dark);
  color: var(--color-white);
}

.btn--white {
  background-color: var(--color-white);
  color: var(--color-orange-dark);
}

.btn--white:hover {
  background-color: var(--color-grey-100);
  color: var(--color-orange-dark);
}

.btn--outline-on-dark {
  background-color: transparent;
  color: var(--color-white);
  border: 2px solid var(--color-white);
}

.btn--outline-on-dark:hover {
  background-color: var(--color-white);
  color: var(--color-orange-dark);
}

/* --- Cards --- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* --- Skip link (accessibility) --- */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-orange-dark);
  color: var(--color-white);
  border-radius: var(--radius);
  z-index: 1000;
  font-weight: 600;
}

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

/* --- External link indicator (accessibility) --- */
a[target='_blank']:not([aria-label])::after {
  content: ' (opens in new window)';
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

a[target='_blank']:not([aria-label]) {
  position: relative;
}

/* --- Focus styles (accessibility) --- */
a:focus-visible {
  outline: 2px solid var(--color-orange);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Fallback focus ring for everything else that can take keyboard focus, so a
   component can never end up with no visible focus state at all. Wrapped in
   :where() for zero specificity - components with their own focus styles still
   override this. */
:where(button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--color-orange-dark);
  outline-offset: 2px;
}

/* On dark and orange sections an orange ring disappears - use white there. */
:where(.section--dark, .section--orange)
  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline-color: var(--color-white);
}

/* --- Page header (shared across pages) --- */
.page-header {
  padding-bottom: 0;
}

.page-header__subtitle {
  color: var(--color-text-muted);
  font-size: 1.25rem;
  max-width: 600px;
  margin-top: var(--space-md);
}

/* --- Section intro (shared across pages) --- */
.section-intro {
  color: var(--color-text-muted);
  font-size: 1.125rem;
  margin-bottom: var(--space-xl);
  max-width: 700px;
}

.text-center .section-intro {
  margin-inline: auto;
}

/* --- Reduced motion (accessibility) --- */
@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;
  }
}
