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

* {
  margin: 0;
  padding: 0;
}

html {
  hanging-punctuation: first last;
}

body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

#root,
#__next {
  isolation: isolate;
}

/* Remove list styles on ul, ol elements with a list role */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  text-rendering: optimizeSpeed;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
}

/* Remove all animations, transitions and smooth scroll for people that prefer not to see them */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }

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

:root {
  /* University of Alberta color palette using OKLCH */
  --ua-dark-green: oklch(0.35 0.08 145); /* #275D38 */
  --ua-green: oklch(0.48 0.15 145); /* #007A33 */
  --ua-light-green: oklch(0.72 0.14 125); /* #6cc24a */
  --ua-gold: oklch(0.83 0.12 95); /* #F2CD00 */
  --ua-dark-yellow: oklch(0.78 0.12 75); /* #FFb600 */
  --ua-red: oklch(0.67 0.12 25); /* #e56a54 */
  --ua-blue: oklch(0.71 0.08 235); /* #7ba4db */
  --ua-orange: oklch(0.7 0.13 55); /* #f68d2e */
  --ua-teal: oklch(0.7 0.08 175); /* #6bbbae */
  --ua-purple: oklch(0.65 0.15 335); /* #c86ba8 */

  /* Primary color system */
  --color-primary: var(--ua-green);
  --color-primary-light: var(--ua-light-green);
  --color-primary-dark: var(--ua-dark-green);

  /* Secondary color system */
  --color-secondary: var(--ua-teal);
  --color-secondary-light: oklch(0.75 0.08 175);
  --color-secondary-dark: oklch(0.65 0.08 175);

  /* Accent color system */
  --color-accent: var(--ua-gold);
  --color-accent-light: oklch(0.88 0.12 95);
  --color-accent-dark: var(--ua-dark-yellow);

  /* Additional accent colors for variety */
  --color-accent-red: var(--ua-red);
  --color-accent-blue: var(--ua-blue);
  --color-accent-orange: var(--ua-orange);
  --color-accent-purple: var(--ua-purple);

  /* Semantic color applications */
  --color-success: var(--ua-light-green);
  --color-warning: var(--ua-dark-yellow);
  --color-error: var(--ua-red);
  --color-info: var(--ua-blue);

  /* Neutrals using OKLCH */
  --color-text: oklch(0.25 0.02 240); /* Dark gray for text */
  --color-text-light: oklch(0.5 0.02 240); /* Medium gray */
  --color-text-lighter: oklch(0.65 0.02 240); /* Light gray */

  --color-bg: oklch(1 0 0); /* Pure white */
  --color-bg-alt: oklch(0.98 0.005 240); /* Very light gray */
  --color-bg-accent: oklch(0.96 0.01 240); /* Light gray background */

  --color-border: oklch(0.9 0.005 240); /* Light border */
  --color-border-light: oklch(0.96 0.01 240); /* Very light border */

  /* Typography */
  --font-family-sans:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  --font-family-serif: Georgia, "Times New Roman", Times, serif;
  --font-family-mono: "SF Mono", Monaco, Inconsolata, "Roboto Mono", monospace;

  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;
  --font-size-5xl: 3rem;

  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;

  --line-height-tight: 1.25;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --space-32: 8rem;

  /* Layout */
  --max-width-xs: 20rem;
  --max-width-sm: 24rem;
  --max-width-md: 28rem;
  --max-width-lg: 32rem;
  --max-width-xl: 36rem;
  --max-width-2xl: 42rem;
  --max-width-3xl: 48rem;
  --max-width-4xl: 56rem;
  --max-width-5xl: 64rem;
  --max-width-6xl: 72rem;
  --max-width-7xl: 80rem;

  --container-padding: var(--space-4);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:
    0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* Border radius */
  --radius-sm: 0.125rem;
  --radius: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;

  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-popover: 1050;
  --z-tooltip: 1060;
  --z-toast: 1070;
}

/* Dark theme using OKLCH and University of Alberta colors */
[data-theme="dark"] {
  --color-text: oklch(0.95 0.005 240); /* Very light gray text */
  --color-text-light: oklch(0.8 0.01 240); /* Medium light gray */
  --color-text-lighter: oklch(0.65 0.02 240); /* Light gray */

  --color-bg: oklch(0.15 0.02 240); /* Very dark background */
  --color-bg-alt: oklch(0.2 0.02 240); /* Dark background */
  --color-bg-accent: oklch(0.25 0.02 240); /* Medium dark background */

  --color-border: oklch(0.25 0.02 240); /* Dark border */
  --color-border-light: oklch(0.3 0.02 240); /* Medium dark border */

  /* Use lighter UA colors for dark theme */
  --color-primary: var(--ua-light-green);
  --color-primary-light: oklch(0.77 0.14 125); /* Even lighter green */
  --color-primary-dark: var(--ua-green);
}

/* Base styles */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition:
    background-color var(--transition-normal),
    color var(--transition-normal);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

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

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

h3 {
  font-size: var(--font-size-2xl);
}

h4 {
  font-size: var(--font-size-xl);
}

h5 {
  font-size: var(--font-size-lg);
}

h6 {
  font-size: var(--font-size-base);
}

p {
  margin-bottom: var(--space-4);
  color: var(--color-text-light);
}

/* Links */
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);

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

/* Lists */
ul,
ol {
  margin-bottom: var(--space-4);
  padding-inline-start: var(--space-6);
}

li {
  margin-bottom: var(--space-2);
  color: var(--color-text-light);
}

/* Forms */
input,
textarea,
select {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background-color: var(--color-bg);
  color: var(--color-text);
  transition:
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px oklch(from var(--color-primary) l c h / 0.1);
}

label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

/* Buttons inherit from utilities */

.btn-primary:hover {
  background-color: var(--color-accent-blue);
  color: white;
  transform: translateY(-1px);
}

.btn-secondary:hover {
  background-color: var(--color-accent-teal);
  color: white;
  transform: translateY(-1px);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-6);
}

th,
td {
  padding: var(--space-3);
  text-align: start;
  border-bottom: 1px solid var(--color-border);
}

th {
  font-weight: var(--font-weight-semibold);
  color: var(--color-text);
  background-color: var(--color-bg-alt);
}

td {
  color: var(--color-text-light);
}

/* Code */
code {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  background-color: var(--color-bg-accent);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

pre {
  background-color: var(--color-bg-accent);
  padding: var(--space-4);
  border-radius: var(--radius);
  overflow-x: auto;
  margin: var(--space-6) 0;
}

pre code {
  background-color: transparent;
  padding: 0;
}

/* Images */
img {
  border-radius: var(--radius);
}

/* Blockquotes */
blockquote {
  border-inline-start: 4px solid var(--color-primary);
  padding-inline-start: var(--space-4);
  margin: var(--space-6) 0;
  font-style: italic;
  color: var(--color-text-light);
}

/* Horizontal rule */
hr {
  border: none;
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-8) 0;
}

/* Focus styles handled by utilities */

/* Selection */
::selection {
  background-color: var(--color-primary);
  color: white;
}

/* Fix for sticky header blocking anchor links */
[id] {
  scroll-margin-top: var(--header-height, 80px);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -40px;
  inset-inline-start: var(--space-4);
  background-color: var(--color-primary);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  text-decoration: none;
  z-index: var(--z-tooltip);
  transition: top var(--transition-fast);
}

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

/* Header */
.site-header {
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-4) 0;
  gap: var(--space-6);
}

.site-branding a {
  text-decoration: none;
  color: inherit;
}

.site-branding h1 {
  font-size: var(--font-size-2xl);
  margin-bottom: var(--space-1);
  color: var(--color-text);
}

.site-branding .tagline {
  font-size: var(--font-size-sm);
  color: var(--color-text-light);
  margin-bottom: 0;
}

/* Navigation */
.main-navigation {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  gap: var(--space-1);
  background: none;
  border: none;
  padding: var(--space-2);
  cursor: pointer;
}

.hamburger {
  width: 20px;
  height: 2px;
  background-color: var(--color-text);
  transition: all var(--transition-fast);
}

.nav-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: var(--space-6);
}

.nav-link {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-light);
  text-decoration: none;
  padding: var(--space-2) 0;
  position: relative;
  transition: color var(--transition-fast);

  &:hover,
  &.active {
    color: var(--color-primary);
  }

  &:focus-visible {
    outline-offset: 4px;
  }
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -1px;
  inset-inline-start: 0;
  inset-inline-end: 0;
  height: 2px;
  background-color: var(--color-primary);
}

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.search-wrapper .search-container {
  width: 200px;
}

@media (max-width: 768px) {
  .search-wrapper .search-container {
    width: 150px;
  }

  .search-wrapper input {
    font-size: var(--font-size-sm);
    padding: var(--space-2) var(--space-8) var(--space-2) var(--space-2);
  }
}

.theme-toggle {
  background: none;
  border: 2px solid var(--color-accent-gold);
  border-radius: var(--radius-full);
  width: 40px;
  height: 40px;
  position: relative;

  &:hover {
    background-color: var(--color-accent-gold);
    border-color: var(--color-accent-orange);
    transform: scale(1.05);
  }

  &:focus-visible {
    outline: 2px solid var(--color-accent-purple);
    outline-offset: 2px;
  }
}

.theme-icon {
  position: absolute;
  transition: all var(--transition-fast);
}

[data-theme="light"] .dark-icon,
[data-theme="dark"] .light-icon {
  opacity: 0;
  transform: rotate(180deg);
}

[data-theme="light"] .light-icon,
[data-theme="dark"] .dark-icon {
  opacity: 1;
  transform: rotate(0deg);
}

/* Footer */
.site-footer {
  background-color: var(--color-bg-alt);
  border-top: 1px solid var(--color-border);
  margin-top: var(--space-20);
  transition:
    background-color var(--transition-normal),
    border-color var(--transition-normal);
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
  padding: var(--space-12) 0 var(--space-8);
}

.footer-section h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

.footer-section p {
  margin-bottom: var(--space-4);
}

.footer-section {
  margin-bottom: var(--space-6);
}

.footer-section address {
  font-style: normal;
  line-height: var(--line-height-relaxed);
}

.footer-links,
.social-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li,
.social-links li {
  margin-bottom: var(--space-3);
}

.footer-links a,
.social-links a {
  color: var(--color-text-light);
  text-decoration: none;
  transition: all var(--transition-fast);
  position: relative;
}

.footer-links a:hover,
.social-links a:hover {
  color: var(--color-accent-gold);
}

.footer-links a:nth-child(odd):hover {
  color: var(--color-accent-blue);
}

.footer-links a:nth-child(even):hover {
  color: var(--color-accent-purple);
}

.social-links a:nth-child(1):hover {
  color: var(--color-accent-blue);
}

.social-links a:nth-child(2):hover {
  color: var(--color-accent-purple);
}

.social-links a:nth-child(3):hover {
  color: var(--color-accent-orange);
}

.social-links a:nth-child(4):hover {
  color: var(--color-accent-red);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) 0;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.footer-bottom p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--color-text-lighter);
}

/* Cards with container queries */
.card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  container-type: inline-size;
  position: relative;
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-accent-teal);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

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

.card:hover::after {
  opacity: 1;
}

/* Specific card type colors */
.card:nth-child(3n + 1)::after {
  background: var(--color-accent-blue);
}

.card:nth-child(3n + 2)::after {
  background: var(--color-accent-purple);
}

.card:nth-child(3n + 3)::after {
  background: var(--color-accent-orange);
}

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

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

/* Container query for larger cards */
@container (min-width: 300px) {
  .card {
    padding: var(--space-6);
  }

  .card-title {
    font-size: var(--font-size-xl);
  }
}

@container (min-width: 500px) {
  .card {
    padding: var(--space-8);
  }

  .card-title {
    font-size: var(--font-size-2xl);
  }
}

.card-subtitle {
  color: var(--color-text-light);
  font-size: var(--font-size-sm);
  margin-bottom: 0;
}

.card-content {
  margin-bottom: var(--space-4);
}

.card-footer {
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-4);
  margin-top: var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

/* Publication card */
.publication-card {
  border-left: 4px solid var(--color-accent-blue);
  padding-left: var(--space-4);
}

/* Only add bottom margin when not in grid */
.publication-card:not(.grid *) {
  margin-bottom: var(--space-8);
}

.publication-title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
  color: var(--color-accent-blue);
}

.publication-authors {
  color: var(--color-text-light);
  margin-bottom: var(--space-2);
}

.publication-venue {
  font-style: italic;
  color: var(--color-accent-purple);
  margin-bottom: var(--space-3);
  font-weight: var(--font-weight-medium);
}

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

.publication-links a {
  padding: var(--space-1) var(--space-3);
}

.publication-links a:hover {
  background-color: var(--color-accent-orange);
  color: white;
}

.publication-links a:nth-child(1):hover {
  background-color: var(--color-accent-blue);
}

.publication-links a:nth-child(2):hover {
  background-color: var(--color-accent-red);
}

.publication-links a:nth-child(3):hover {
  background-color: var(--color-accent-purple);
}

/* Person card */
.person-card {
  text-align: center;
  position: relative;
}

/* Only add bottom margin when not in grid */
.person-card:not(.grid *) {
  margin-bottom: var(--space-8);
}

.person-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(
    90deg,
    var(--color-accent-purple),
    var(--color-accent-blue),
    var(--color-accent-teal)
  );
}

.person-photo {
  width: 150px;
  height: 150px;
  border-radius: var(--radius-full);
  object-fit: cover;
  margin: 0 auto var(--space-4);
  border: 3px solid var(--color-accent-teal);
}

.person-name {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  margin-bottom: var(--space-2);
  color: var(--color-accent-purple);
}

.person-title {
  color: var(--color-accent-orange);
  margin-bottom: var(--space-3);
  font-weight: var(--font-weight-medium);
}

.person-bio {
  text-align: left;
  font-size: var(--font-size-sm);
}

/* News item */
.news-item {
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
  border-left: 4px solid var(--color-accent-gold);
  padding-left: var(--space-4);
  transition: all var(--transition-fast);
}

/* Only add bottom margin when not in grid */
.news-item:not(.grid *) {
  margin-bottom: var(--space-8);
}

.news-item:hover {
  border-left-color: var(--color-accent-orange);
}

.news-date {
  font-size: var(--font-size-sm);
  color: var(--color-accent-blue);
  margin-bottom: var(--space-2);
  font-weight: var(--font-weight-medium);
}

.news-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-3);
  color: var(--color-accent-purple);
}

/* Hero section */
.hero {
  background: linear-gradient(
    135deg,
    var(--color-primary) 0%,
    var(--color-secondary) 100%
  );
  color: white;
  padding: var(--space-24) 0;
  text-align: center;
  margin-bottom: var(--space-8);
}

.hero h1 {
  font-size: var(--font-size-5xl);
  margin-bottom: var(--space-4);
  color: white;
}

.hero p {
  font-size: var(--font-size-xl);
  margin-bottom: var(--space-8);
  color: oklch(1 0 0 / 0.9);
  max-width: var(--max-width-3xl);
  margin-inline-start: auto;
  margin-inline-end: auto;
}

.hero .btn-primary {
  background-color: white;
  color: var(--color-primary);
  font-size: var(--font-size-lg);
  padding: var(--space-4) var(--space-8);
}

.hero .btn-primary:hover {
  background-color: var(--color-bg-alt);
}

/* Mobile styles */
@media (max-width: 768px) {
  .mobile-menu-toggle {
    display: flex;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    inset-inline-start: 0;
    inset-inline-end: 0;
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-top: none;
    flex-direction: column;
    gap: 0;
    padding: var(--space-4);
    box-shadow: var(--shadow-lg);
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-item {
    width: 100%;
  }

  .nav-link {
    display: block;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
  }

  .nav-link.active::after {
    display: none;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .hero h1 {
    font-size: var(--font-size-3xl);
  }

  .hero p {
    font-size: var(--font-size-lg);
  }
}

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

.container-narrow {
  max-width: var(--max-width-4xl);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

/* Grid layouts */
.grid {
  display: grid;
  gap: var(--space-8);
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-8);
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-8);
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-8);
}

/* Flex layouts */

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

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

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

.items-start {
  align-items: flex-start;
}

.items-end {
  align-items: flex-end;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-around {
  justify-content: space-around;
}

.justify-evenly {
  justify-content: space-evenly;
}

/* Sections */
.section {
  padding: var(--space-16) 0;
}

.section-sm {
  padding: var(--space-8) 0;
}

.section-lg {
  padding: var(--space-24) 0;
}

/* Section spacing utilities */
.section + .section {
  border-top: 1px solid var(--color-border-light);
}

.section-divider {
  margin: var(--space-8) 0;
  border-top: 1px solid var(--color-border-light);
}

/* Content areas */
.content-area {
  max-width: var(--max-width-4xl);
  margin: 0 auto;
}

.prose {
  max-width: var(--max-width-2xl);
  margin: 0 auto;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-4);
}

.prose h1:first-child,
.prose h2:first-child,
.prose h3:first-child,
.prose h4:first-child,
.prose h5:first-child,
.prose h6:first-child {
  margin-top: 0;
}

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

.prose ul,
.prose ol {
  margin-bottom: var(--space-4);
}

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

/* Two column layout */
.two-column {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-8);
  align-items: start;
}

@media (max-width: 1024px) {
  .two-column {
    grid-template-columns: 1fr;
  }
}

/* Sidebar */
.sidebar {
  background-color: var(--color-bg-alt);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
}

.sidebar h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-4);
  color: var(--color-text);
}

/* Page header */
.page-header {
  text-align: center;
  margin-bottom: var(--space-12);
}

.page-title {
  font-size: var(--font-size-4xl);
  margin-bottom: var(--space-4);
}

.page-subtitle {
  font-size: var(--font-size-xl);
  color: var(--color-text-light);
  max-width: var(--max-width-3xl);
  margin: 0 auto;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .container,
  .container-narrow {
    padding: 0 var(--space-4);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .section {
    padding: var(--space-10) 0;
  }

  .section-lg {
    padding: var(--space-16) 0;
  }

  .page-title {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--space-6);
  }

  .page-subtitle {
    font-size: var(--font-size-lg);
  }

  .page-header {
    margin-bottom: var(--space-8);
  }
}

@media (max-width: 480px) {
  .container,
  .container-narrow {
    padding: 0 var(--space-3);
  }

  .grid-2,
  .grid-3,
  .grid-4 {
    gap: var(--space-4);
  }

  .page-title {
    font-size: var(--font-size-2xl);
    margin-bottom: var(--space-4);
  }

  .section {
    padding: var(--space-8) 0;
  }

  .page-header {
    margin-bottom: var(--space-6);
  }
}

/* Spacing utilities */
.mt-0 {
  margin-top: 0;
}
.mt-1 {
  margin-top: var(--space-1);
}
.mt-2 {
  margin-top: var(--space-2);
}
.mt-3 {
  margin-top: var(--space-3);
}
.mt-4 {
  margin-top: var(--space-4);
}
.mt-6 {
  margin-top: var(--space-6);
}
.mt-8 {
  margin-top: var(--space-8);
}
.mt-12 {
  margin-top: var(--space-12);
}

.mb-0 {
  margin-bottom: 0;
}
.mb-1 {
  margin-bottom: var(--space-1);
}
.mb-2 {
  margin-bottom: var(--space-2);
}
.mb-3 {
  margin-bottom: var(--space-3);
}
.mb-4 {
  margin-bottom: var(--space-4);
}
.mb-6 {
  margin-bottom: var(--space-6);
}
.mb-8 {
  margin-bottom: var(--space-8);
}
.mb-12 {
  margin-bottom: var(--space-12);
}

.ml-0 {
  margin-inline-start: 0;
}
.ml-1 {
  margin-inline-start: var(--space-1);
}
.ml-2 {
  margin-inline-start: var(--space-2);
}
.ml-3 {
  margin-inline-start: var(--space-3);
}
.ml-4 {
  margin-inline-start: var(--space-4);
}
.ml-6 {
  margin-inline-start: var(--space-6);
}
.ml-8 {
  margin-inline-start: var(--space-8);
}

.mr-0 {
  margin-inline-end: 0;
}
.mr-1 {
  margin-inline-end: var(--space-1);
}
.mr-2 {
  margin-inline-end: var(--space-2);
}
.mr-3 {
  margin-inline-end: var(--space-3);
}
.mr-4 {
  margin-inline-end: var(--space-4);
}
.mr-6 {
  margin-inline-end: var(--space-6);
}
.mr-8 {
  margin-inline-end: var(--space-8);
}

.pt-0 {
  padding-top: 0;
}
.pt-1 {
  padding-top: var(--space-1);
}
.pt-2 {
  padding-top: var(--space-2);
}
.pt-3 {
  padding-top: var(--space-3);
}
.pt-4 {
  padding-top: var(--space-4);
}
.pt-6 {
  padding-top: var(--space-6);
}
.pt-8 {
  padding-top: var(--space-8);
}

.pb-0 {
  padding-bottom: 0;
}
.pb-1 {
  padding-bottom: var(--space-1);
}
.pb-2 {
  padding-bottom: var(--space-2);
}
.pb-3 {
  padding-bottom: var(--space-3);
}
.pb-4 {
  padding-bottom: var(--space-4);
}
.pb-6 {
  padding-bottom: var(--space-6);
}
.pb-8 {
  padding-bottom: var(--space-8);
}

.pl-0 {
  padding-inline-start: 0;
}
.pl-1 {
  padding-inline-start: var(--space-1);
}
.pl-2 {
  padding-inline-start: var(--space-2);
}
.pl-3 {
  padding-inline-start: var(--space-3);
}
.pl-4 {
  padding-inline-start: var(--space-4);
}
.pl-6 {
  padding-inline-start: var(--space-6);
}
.pl-8 {
  padding-inline-start: var(--space-8);
}

.pr-0 {
  padding-inline-end: 0;
}
.pr-1 {
  padding-inline-end: var(--space-1);
}
.pr-2 {
  padding-inline-end: var(--space-2);
}
.pr-3 {
  padding-inline-end: var(--space-3);
}
.pr-4 {
  padding-inline-end: var(--space-4);
}
.pr-6 {
  padding-inline-end: var(--space-6);
}
.pr-8 {
  padding-inline-end: var(--space-8);
}

/* Text utilities */
.text-center {
  text-align: center;
}
.text-left {
  text-align: start;
}
.text-right {
  text-align: end;
}

.text-xs {
  font-size: var(--font-size-xs);
}
.text-sm {
  font-size: var(--font-size-sm);
}
.text-base {
  font-size: var(--font-size-base);
}
.text-lg {
  font-size: var(--font-size-lg);
}
.text-xl {
  font-size: var(--font-size-xl);
}
.text-2xl {
  font-size: var(--font-size-2xl);
}
.text-3xl {
  font-size: var(--font-size-3xl);
}

.font-normal {
  font-weight: var(--font-weight-normal);
}
.font-medium {
  font-weight: var(--font-weight-medium);
}
.font-semibold {
  font-weight: var(--font-weight-semibold);
}
.font-bold {
  font-weight: var(--font-weight-bold);
}

.text-primary {
  color: var(--color-primary);
}
.text-secondary {
  color: var(--color-secondary);
}
.text-accent {
  color: var(--color-accent);
}
.text-light {
  color: var(--color-text-light);
}
.text-lighter {
  color: var(--color-text-lighter);
}

/* Display utilities */
.block {
  display: block;
}
.inline {
  display: inline;
}
.inline-block {
  display: inline-block;
}
.flex {
  display: flex;
}
.grid {
  display: grid;
}
.hidden {
  display: none;
}

/* Visibility utilities */
.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;
}

/* Border utilities */
.border {
  border: 1px solid var(--color-border);
}
.border-t {
  border-top: 1px solid var(--color-border);
}
.border-b {
  border-bottom: 1px solid var(--color-border);
}
.border-l {
  border-inline-start: 1px solid var(--color-border);
}
.border-r {
  border-inline-end: 1px solid var(--color-border);
}

.rounded {
  border-radius: var(--radius);
}
.rounded-lg {
  border-radius: var(--radius-lg);
}
.rounded-xl {
  border-radius: var(--radius-xl);
}
.rounded-full {
  border-radius: var(--radius-full);
}

/* Shadow utilities */
.shadow {
  box-shadow: var(--shadow);
}
.shadow-sm {
  box-shadow: var(--shadow-sm);
}
.shadow-md {
  box-shadow: var(--shadow-md);
}
.shadow-lg {
  box-shadow: var(--shadow-lg);
}
.shadow-xl {
  box-shadow: var(--shadow-xl);
}

/* Background utilities */
.bg-primary {
  background-color: var(--color-primary);
}
.bg-secondary {
  background-color: var(--color-secondary);
}
.bg-accent {
  background-color: var(--color-accent);
}
.bg-alt {
  background-color: var(--color-bg-alt);
}

/* Width utilities */
.w-full {
  width: 100%;
}
.w-auto {
  width: auto;
}
.max-w-xs {
  max-width: var(--max-width-xs);
}
.max-w-sm {
  max-width: var(--max-width-sm);
}
.max-w-md {
  max-width: var(--max-width-md);
}
.max-w-lg {
  max-width: var(--max-width-lg);
}
.max-w-xl {
  max-width: var(--max-width-xl);
}
.max-w-2xl {
  max-width: var(--max-width-2xl);
}
.max-w-3xl {
  max-width: var(--max-width-3xl);
}
.max-w-4xl {
  max-width: var(--max-width-4xl);
}

/* Height utilities */
.h-auto {
  height: auto;
}
.h-full {
  height: 100%;
}
.min-h-screen {
  min-height: 100vh;
}

/* Button utilities */
.btn-base {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: var(--space-2) var(--space-4);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-decoration: none;
  background-color: var(--color-bg-accent);
  color: var(--color-text);
  border: 1px solid transparent;
}

/* Hover effect utilities */
.hover-lift {
  transition: transform var(--transition-fast);
}

.hover-lift:hover {
  transform: translateY(-1px);
}

.hover-slide {
  transition: transform var(--transition-fast);
}

.hover-slide:hover {
  transform: translateX(4px);
}

/* Focus utilities */
.focus-outline:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Transition utilities */
.transition-all {
  transition: all var(--transition-fast);
}

.transition-colors {
  transition: color var(--transition-fast);
}

/* Card utilities */
.card-base {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
}

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

/* Color cycling utilities */
.color-cycle-blue:nth-child(3n + 1) {
  color: var(--color-accent-blue) !important;
}
.color-cycle-purple:nth-child(3n + 2) {
  color: var(--color-accent-purple) !important;
}
.color-cycle-orange:nth-child(3n + 3) {
  color: var(--color-accent-orange) !important;
}

.bg-cycle-blue:nth-child(3n + 1) {
  background-color: var(--color-accent-blue) !important;
}
.bg-cycle-purple:nth-child(3n + 2) {
  background-color: var(--color-accent-purple) !important;
}
.bg-cycle-orange:nth-child(3n + 3) {
  background-color: var(--color-accent-orange) !important;
}

/* Border accent utilities */
.border-accent-left {
  border-left: 4px solid var(--color-accent-blue);
  padding-left: var(--space-4);
}

.border-accent-left-gold {
  border-left: 4px solid var(--color-accent-gold);
  padding-left: var(--space-4);
}

.border-accent-top::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--color-accent-teal);
}

/* Enhanced hover utilities */
.hover-lift-sm {
  transition: transform var(--transition-fast);
}

.hover-lift-sm:hover {
  transform: translateY(-1px);
}

.hover-lift-lg {
  transition: transform var(--transition-fast);
}

.hover-lift-lg:hover {
  transform: translateY(-2px);
}

.hover-shadow {
  transition: box-shadow var(--transition-fast);
}

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

/* Flex utilities - commonly used patterns */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

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

/* Interactive element base */
.interactive-base {
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius);
}

/* Print utilities */
@media print {
  .no-print {
    display: none !important;
  }

  .print-only {
    display: block !important;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    color: var(--color-text-light);
    font-size: var(--font-size-sm);
  }

  .nav-menu,
  .mobile-menu-toggle,
  .theme-toggle,
  .footer-bottom {
    display: none !important;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  .card {
    border: 1px solid #000;
    box-shadow: none;
    break-inside: avoid;
  }
}

/* Responsive utilities */
@media (max-width: 768px) {
  .md\:hidden {
    display: none;
  }
  .md\:block {
    display: block;
  }
  .md\:flex {
    display: flex;
  }
  .md\:grid {
    display: grid;
  }
}

@media (max-width: 480px) {
  .sm\:hidden {
    display: none;
  }
  .sm\:block {
    display: block;
  }
  .sm\:flex {
    display: flex;
  }
  .sm\:grid {
    display: grid;
  }

  .sm\:text-center {
    text-align: center;
  }
  .sm\:text-sm {
    font-size: var(--font-size-sm);
  }
  .sm\:text-base {
    font-size: var(--font-size-base);
  }
}
