/* ========================================================================
   Variables
   ======================================================================== */
:root {
  /* Color palette - education-focused, vibrant yet professional */
  --color-background: #f8fbff; /* soft, fresh background */
  --color-surface: #ffffff;
  --color-text: #1b2430;
  --color-text-muted: #5f6b7a;

  --color-primary: #1b6fd8; /* bright academic blue */
  --color-primary-soft: #e1efff;
  --color-primary-dark: #0f4f9a;

  --color-accent-apricot: #ffb680; /* warm apricot */
  --color-accent-sage: #9ac7a1;   /* soft sage green */
  --color-accent-coral: #ff6f61;  /* lively coral */

  --color-success: #24a26f; /* aligned with sage, slightly deeper */
  --color-warning: #ffb347; /* academic warm highlight */
  --color-danger: #e04444;

  /* Neutral grays */
  --gray-50: #f8fafc;
  --gray-100: #edf1f7;
  --gray-200: #d8dde7;
  --gray-300: #c0c7d6;
  --gray-400: #a1a9bb;
  --gray-500: #7b8498;
  --gray-600: #5b6477;
  --gray-700: #444c5c;
  --gray-800: #2f3542;
  --gray-900: #1b2028;

  /* Typography */
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-serif: "Merriweather", "Georgia", ui-serif, serif;
  --font-mono: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono",
    "Courier New", monospace;

  /* Font sizes (fluid where helpful) */
  --font-size-xs: 0.75rem;  /* 12px */
  --font-size-sm: 0.875rem; /* 14px */
  --font-size-md: 1rem;     /* 16px */
  --font-size-lg: 1.125rem; /* 18px */
  --font-size-xl: 1.25rem;  /* 20px */
  --font-size-2xl: clamp(1.5rem, 1.3rem + 0.6vw, 1.875rem);   /* section titles */
  --font-size-3xl: clamp(1.875rem, 1.6rem + 1vw, 2.5rem);     /* h2 */
  --font-size-4xl: clamp(2.25rem, 1.9rem + 1.4vw, 3rem);      /* h1 */

  /* Line heights */
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.7;

  /* Spacing scale (0–96px) */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-5: 1.25rem;  /* 20px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-10: 2.5rem;  /* 40px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
  --space-20: 5rem;    /* 80px */
  --space-24: 6rem;    /* 96px */

  /* Radius */
  --radius-sm: 0.25rem;   /* 4px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-full: 999px;

  /* Shadows - soft and modern for educational cards */
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06),
               0 1px 2px rgba(15, 23, 42, 0.03);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, 0.12);

  /* Transitions */
  --transition-fast: 120ms ease-out;
  --transition-normal: 180ms ease-out;
  --transition-slow: 260ms ease-out;

  /* Layout */
  --container-max-width: 1120px; /* comfortable for content & imagery */
  --container-padding-x: 1.25rem;
}

/* Respect user motion preferences */
@media (prefers-reduced-motion: reduce) {
  :root {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================================================
   Reset / Normalize
   ======================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
dl,
dd {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
  margin: 0;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
}

button {
  border: none;
  background: none;
  padding: 0;
}

textarea {
  resize: vertical;
}

/* Improve text rendering */
body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ========================================================================
   Base Styles
   ======================================================================== */
body {
  font-family: var(--font-sans);
  font-size: var(--font-size-md);
  line-height: var(--line-height-relaxed);
  background-color: var(--color-background);
  color: var(--color-text);
}

main {
  min-height: 60vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  color: var(--color-text);
  line-height: var(--line-height-tight);
}

h1 {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-4);
}

h2 {
  font-size: var(--font-size-3xl);
  margin-bottom: var(--space-3);
}

h3 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-3);
}

h4 {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-2);
}

h5 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-2);
}

h6 {
  font-size: var(--font-size-md);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

p {
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
}

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

strong {
  font-weight: 600;
}

/* Links - clean, academic, and accessible */
a {
  color: var(--color-primary);
  text-decoration: none;
  text-underline-offset: 0.2em;
  transition: color var(--transition-normal),
    text-decoration-color var(--transition-normal),
    background-color var(--transition-normal);
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

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

small {
  font-size: var(--font-size-sm);
}

code,
pre {
  font-family: var(--font-mono);
  font-size: 0.95em;
}

/* ========================================================================
   Accessibility & Focus Styles
   ======================================================================== */
:focus-visible {
  outline: 2px solid var(--color-accent-coral);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Screen-reader-only utility */
.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;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ========================================================================
   Utilities
   ======================================================================== */

/* Container for readable content with generous breathing room */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-x);
  padding-right: var(--container-padding-x);
}

.section {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
}

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

/* Flex helpers */
.flex {
  display: flex;
}

.inline-flex {
  display: inline-flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-sm {
  gap: var(--space-3);
}

.gap-md {
  gap: var(--space-4);
}

.gap-lg {
  gap: var(--space-6);
}

/* Grid helpers for responsive course & service layouts */
.grid {
  display: grid;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Alignment & text utilities */
.text-center {
  text-align: center;
}

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

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

.mt-0 {
  margin-top: 0;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-sm {
  margin-bottom: var(--space-3);
}

.mb-md {
  margin-bottom: var(--space-4);
}

.mb-lg {
  margin-bottom: var(--space-6);
}

/* ========================================================================
   Components
   ======================================================================== */

/* Buttons - primary, secondary, subtle. Rounded, friendly, and confident. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: var(--font-size-sm);
  letter-spacing: 0.02em;
  text-transform: none;
  cursor: pointer;
  transition: background-color var(--transition-normal),
    color var(--transition-normal),
    border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    transform var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent-coral));
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  background-color: var(--color-surface);
  border-color: var(--gray-200);
  color: var(--color-text);
  box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
  border-color: var(--color-primary-soft);
  box-shadow: var(--shadow-sm);
}

.btn-ghost {
  background-color: transparent;
  color: var(--color-primary);
}

.btn-ghost:hover {
  background-color: var(--color-primary-soft);
}

.btn-success {
  background-color: var(--color-success);
  color: #ffffff;
}

.btn[disabled],
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

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

/* Inputs - consistent, approachable, and calm */
.input,
select,
textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-normal);
  transition: border-color var(--transition-normal),
    box-shadow var(--transition-normal),
    background-color var(--transition-normal);
}

.input::placeholder,
textarea::placeholder {
  color: var(--gray-400);
}

.input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary-soft);
  outline: none;
}

.input[disabled],
select[disabled],
textarea[disabled] {
  background-color: var(--gray-100);
  cursor: not-allowed;
  color: var(--gray-500);
}

label {
  display: inline-block;
  margin-bottom: 0.35rem;
  font-weight: 500;
  font-size: var(--font-size-sm);
}

.form-field {
  margin-bottom: var(--space-4);
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

.form-error {
  font-size: var(--font-size-xs);
  color: var(--color-danger);
  margin-top: 0.25rem;
}

/* Card - for courses, tutors, learning pathways */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
  border: 1px solid rgba(148, 163, 184, 0.18);
  transition: box-shadow var(--transition-normal),
    transform var(--transition-fast),
    border-color var(--transition-normal),
    background-color var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, 0.25);
}

.card-header {
  margin-bottom: var(--space-3);
}

.card-title {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-1);
}

.card-meta {
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gray-500);
}

.card-body {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

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

/* Tag / pill for course types, levels, formats */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.badge--online {
  background-color: var(--color-primary-soft);
  color: var(--color-primary-dark);
}

.badge--inperson {
  background-color: rgba(154, 199, 161, 0.18);
  color: #245b37;
}

.badge--exam {
  background-color: rgba(255, 111, 97, 0.14);
  color: #b53b2f;
}

/* Hero imagery helpers - to keep classroom photos consistent */
.media-cover {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.media-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-overlay-soft {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left,
      rgba(27, 111, 216, 0.18),
      transparent 55%),
    radial-gradient(circle at bottom right,
      rgba(255, 111, 97, 0.18),
      transparent 55%);
}

/* Simple badge-style label for locations like "London" */
.location-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.7rem;
  border-radius: var(--radius-full);
  background-color: rgba(27, 111, 216, 0.06);
  color: var(--color-primary-dark);
  font-size: var(--font-size-xs);
}

/* ========================================================================
   End of base.css
   ======================================================================== */
