/* =========================================================
   Oxford Hydrogen – Premium CSS v2.5 Optimized
   Enhancements: Critical-path readiness, font swap, CLS prevention, accessibility focus, mobile touch
========================================================= */

/* ------------------------------
   1. ROOT VARIABLES (Light Theme)
------------------------------ */
:root {
  --color-bg: #ffffff;
  --color-text: #0B0C10;
  --color-accent: #00ADEF;
  --color-accent-dark: #0089b5;
  --color-muted: #555a60;

  --color-bg-dark: #0B0C10;
  --color-text-dark: #f5f5f5;
  --color-muted-dark: #b0b5ba;
  --color-card-bg-dark: rgba(20, 20, 20, 0.6);

  --font-serif: 'Playfair Display', serif;
  --font-sans: 'Inter', system-ui, sans-serif;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --space-7: 6rem;

  --max-width: 1200px;

  --shadow-soft: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 6px 20px rgba(0, 0, 0, 0.15);

  --radius: 12px;
  --transition: all 0.4s ease-out;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: var(--color-bg-dark);
    --color-text: var(--color-text-dark);
    --color-muted: var(--color-muted-dark);
    --color-card-bg: var(--color-card-bg-dark);
  }
}

/* ------------------------------
   2. RESET / BASE
------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s, color 0.3s;
  padding-top: 120px; /* Offset for fixed nav */
}

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

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

/* ------------------------------
   3. TYPOGRAPHY
------------------------------ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  line-height: 1.2;
  margin-bottom: var(--space-2);
  color: var(--color-text);
  font-weight: 700;
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  margin-bottom: var(--space-3);
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  margin-bottom: var(--space-2);
}

p {
  font-size: 1.125rem;
  color: var(--color-muted);
  margin-bottom: var(--space-2);
}

a {
  text-decoration: none;
  color: var(--color-accent);
  position: relative;
  transition: var(--transition);
  touch-action: manipulation;
  min-height: 44px; /* mobile-friendly target size */
}

a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 0%;
  height: 2px;
  background-color: var(--color-accent);
  transition: width 0.3s ease;
}

a:hover::after {
  width: 100%;
}

a:focus, .btn:focus {
  outline: 2px solid var(--color-accent-dark);
  outline-offset: 2px;
}

/* ------------------------------
   4. LAYOUT / GRID
------------------------------ */
section {
  padding: var(--space-5) 0;
}

@media (min-width: 1024px) {
  section {
    padding: var(--space-6) 0;
  }
}

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

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ------------------------------
   5. HERO SECTION
------------------------------ */
.hero {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  min-height: 100vh;
  background: linear-gradient(120deg, #b0dcff, #ffffff);
  animation: gradient-shift 12s ease infinite;
  padding: var(--space-6) var(--space-3);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.1);
  z-index: 0;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero h1,
.hero h2,
.hero p {
  color: #0B0C10 !important;
  font-weight: 700 !important;
}

/* ------------------------------
   6. NAVIGATION
------------------------------ */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-2) var(--space-3);
  box-shadow: var(--shadow-soft);
  z-index: 100;
  transition: background 0.3s ease;
}

nav .nav-left img {
  height: 100px;
  width: auto; /* Prevent CLS */
}

nav a {
  margin-left: var(--space-3);
  font-weight: 500;
}

@media (prefers-color-scheme: dark) {
  nav {
    background: rgba(20,20,20,0.7);
  }
}

/* ------------------------------
   7. BUTTONS
------------------------------ */
.btn {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  font-weight: 600;
  transition: var(--transition);
  touch-action: manipulation;
  min-height: 44px;
}

.btn:hover {
  background: var(--color-accent);
  color: #fff;
  box-shadow: var(--shadow-hover);
}

/* ------------------------------
   8. CARDS
------------------------------ */
.card {
  background: var(--color-card-bg, rgba(255,255,255,0.6));
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow-soft);
  transition: var(--transition);
}

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

/* ------------------------------
   9. HORIZONTAL SCROLL SHADOW
------------------------------ */
.scroll-shadow {
  display: flex;
  gap: 1.5rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  position: relative;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
}

.scroll-shadow:active {
  cursor: grabbing;
}

.scroll-shadow::-webkit-scrollbar {
  display: none;
}

.scroll-shadow .card {
  min-width: 280px;
  scroll-snap-align: start;
}

.scroll-shadow::before,
.scroll-shadow::after {
  content: "";
  position: sticky;
  top: 0;
  bottom: 0;
  width: 20px;
  pointer-events: none;
  z-index: 1;
}

.scroll-shadow::before {
  left: 0;
  background: linear-gradient(to right, rgba(255,255,255,1), rgba(255,255,255,0));
}

.scroll-shadow::after {
  right: 0;
  background: linear-gradient(to left, rgba(255,255,255,1), rgba(255,255,255,0));
}

/* ------------------------------
   10. ANIMATIONS
------------------------------ */
@keyframes fade-up {
  0% { opacity: 0; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}

@keyframes gradient-shift {
  0% { background: linear-gradient(120deg, #b0dcff, #ffffff); }
  50% { background: linear-gradient(120deg, #ffffff, #b0dcff); }
  100% { background: linear-gradient(120deg, #b0dcff, #ffffff); }
}

.fade-up {
  animation: fade-up 1s ease forwards;
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ------------------------------
   11. RESPONSIVENESS
------------------------------ */
@media (max-width: 768px) {
  nav a {
    margin-left: var(--space-2);
  }

  .hero h1 {
    font-size: clamp(2rem, 6vw, 3rem);
    font-weight: 700;
  }

  .card {
    padding: var(--space-3);
  }
}
