/* ============================================
   YOUNG & INDEPENDENT PTY LTD
   Base CSS - Design System & Reset
   ============================================ */

/* CSS Custom Properties */
:root {
  /* Color Palette */
  --color-primary: #1B4D3E;
  --color-primary-dark: #123D31;
  --color-primary-light: #2A6B56;
  --color-secondary: #FFD700;
  --color-secondary-dark: #CCA000;
  --color-accent: #FFD700;
  --color-neutral: #333333;
  --color-neutral-light: #555555;
  --color-neutral-dark: #2D2D2D;
  --color-bg: #FAF9F6;
  --color-bg-alt: #F5F3EE;
  --color-white: #FFFFFF;
  --color-black: #000000;

  /* Theme Colors */
  --color-surface: #FFFFFF;
  --color-heading: #123D31;
  /* Derived from --color-primary-dark */

  /* Semantic Colors */
  --color-success: #2A6B56;
  --color-warning: #FFD700;
  --color-error: #C94C4C;

  /* Typography — Rule of Thirds Scale (ratio ≈ 1.333)
     ─────────────────────────────────────────────────
     Each step = previous × 1.333, creating harmonious
     proportional jumps. 7 purposeful sizes for a service
     business: captions → body → subheads → section → page → hero.
     
     Base: 16px (1rem) × 1.333 ratio
     ──────────────────────────────
     xs    = 12px  (0.75rem)   — captions, fine print, badges
     sm    = 14px  (0.875rem)  — labels, meta text, nav links
     base  = 16px  (1rem)      — body text, paragraphs
     lg    = 21px  (1.333rem)  — lead paragraphs, card titles
     xl    = 28px  (1.777rem)  — subheadings (h4, h3)
     2xl   = 38px  (2.369rem)  — section headings (h2)
     3xl   = 50px  (3.157rem)  — page titles (h1)
     4xl   = 67px  (4.209rem)  — hero display (homepage only)
  */

  --font-headline: 'Pangolin', 'Montserrat', 'Segoe UI', sans-serif;
  --font-body: 'Open Sans', 'Segoe UI', sans-serif;
  --font-accent: 'Pangolin', 'Montserrat', 'Segoe UI', sans-serif;

  /* Font Sizes — Rule of Thirds (fluid with clamp) */
  --text-xs: clamp(0.7rem, 0.65rem + 0.25vw, 0.75rem);
  --text-sm: clamp(0.8rem, 0.75rem + 0.25vw, 0.875rem);
  --text-base: clamp(0.938rem, 0.875rem + 0.3vw, 1rem);
  --text-lg: clamp(1.125rem, 1rem + 0.65vw, 1.333rem);
  --text-xl: clamp(1.425rem, 1.2rem + 1.1vw, 1.777rem);
  --text-2xl: clamp(1.75rem, 1.4rem + 1.75vw, 2.369rem);
  --text-3xl: clamp(2.25rem, 1.7rem + 2.75vw, 3.157rem);
  --text-4xl: clamp(2.75rem, 2rem + 3.75vw, 4.209rem);

  /* Line Heights */
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  /* Font Weights */
  --font-light: 300;
  --font-regular: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  --font-black: 900;

  /* Spacing Scale */
  --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;
  --space-40: 10rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(27, 77, 62, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;
  --transition-slower: 800ms cubic-bezier(0.22, 1, 0.36, 1);
  --transition-bounce: 600ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Z-Index Scale */
  --z-base: 0;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-fixed: 300;
  --z-modal-backdrop: 400;
  --z-modal: 500;
  --z-popover: 600;
  --z-tooltip: 700;
  --z-webgl: -1;

  /* Container */
  --container-max: 1400px;
  --container-padding: clamp(1rem, 5vw, 3rem);

  /* Navbar */
  --navbar-height: 80px;
  --navbar-height-mobile: 70px;
}

/* Dark mode support (if needed later) */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121212;
    --color-bg-alt: #1E1E1E;
    --color-neutral: #E0E0E0;
    --color-neutral-light: #CCCCCC;
    --color-surface: #2D2D2D;
    --color-heading: #FFFFFF;

    /* Adjust primary brightness for dark mode */
    --color-primary: #2A6B56;
    --color-primary-dark: #1B4D3E;
  }
}

/* Reduced motion preference */
@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;
  }
}

/* ============================================
   CSS Reset & Base Styles
   ============================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--font-regular);
  line-height: var(--leading-normal);
  color: var(--color-neutral);
  background-color: var(--color-bg);
  overflow-x: hidden;
  min-height: 100vh;
}

/* Ensure consistent section alignment */
section {
  width: 100%;
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

/* Improved text contrast */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--color-heading);
}

p {
  color: var(--color-neutral);
}

/* Typography Reset */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-headline);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--color-heading);
  margin-bottom: var(--space-4);
}

h1 {
  font-size: var(--text-4xl);
}

h2 {
  font-size: var(--text-3xl);
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-size: var(--text-xl);
}

h5 {
  font-size: var(--text-lg);
}

h6 {
  font-size: var(--text-base);
}

p {
  margin-bottom: var(--space-4);
  max-width: 70ch;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-secondary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* Focus styles for accessibility */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Selection styles */
::selection {
  background-color: var(--color-primary);
  color: var(--color-white);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg-alt);
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary-dark);
}

/* ============================================
   Utility Classes
   ============================================ */

/* Screen reader only */
.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;
}

/* Container */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.container-narrow {
  max-width: 900px;
}

.container-wide {
  max-width: 1600px;
}

/* Section spacing */
.section {
  padding-top: var(--space-24);
  padding-bottom: var(--space-24);
  position: relative;
}

.section-sm {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}

.section-lg {
  padding-top: var(--space-32);
  padding-bottom: var(--space-32);
}

/* Text utilities */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-primary {
  color: var(--color-primary);
}

.text-secondary {
  color: var(--color-secondary);
}

.text-accent {
  color: var(--color-accent);
}

.text-neutral {
  color: var(--color-neutral);
}

.text-white {
  color: var(--color-white);
}

.font-light {
  font-weight: var(--font-light);
}

.font-regular {
  font-weight: var(--font-regular);
}

.font-medium {
  font-weight: var(--font-medium);
}

.font-semibold {
  font-weight: var(--font-semibold);
}

.font-bold {
  font-weight: var(--font-bold);
}

.font-headline {
  font-family: var(--font-headline);
}

.font-body {
  font-family: var(--font-body);
}

.font-accent {
  font-family: var(--font-accent);
}

/* Background utilities */
.bg-primary {
  background-color: var(--color-primary);
}

.bg-secondary {
  background-color: var(--color-secondary);
}

.bg-accent {
  background-color: var(--color-accent);
}

.bg-bg {
  background-color: var(--color-bg);
}

.bg-bg-alt {
  background-color: var(--color-bg-alt);
}

.bg-white {
  background-color: var(--color-white);
}

/* Flex utilities */
.flex {
  display: flex;
}

.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;
}

.gap-1 {
  gap: var(--space-1);
}

.gap-2 {
  gap: var(--space-2);
}

.gap-4 {
  gap: var(--space-4);
}

.gap-6 {
  gap: var(--space-6);
}

.gap-8 {
  gap: var(--space-8);
}

/* Grid utilities */
.grid {
  display: grid;
}

.grid-cols-1 {
  grid-template-columns: repeat(1, 1fr);
}

.grid-cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid-cols-4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Spacing utilities */
.mt-0 {
  margin-top: 0;
}

.mt-4 {
  margin-top: var(--space-4);
}

.mt-8 {
  margin-top: var(--space-8);
}

.mt-16 {
  margin-top: var(--space-16);
}

.mb-0 {
  margin-bottom: 0;
}

.mb-4 {
  margin-bottom: var(--space-4);
}

.mb-8 {
  margin-bottom: var(--space-8);
}

.mb-16 {
  margin-bottom: var(--space-16);
}

/* Visibility */
.hidden {
  display: none !important;
}

.invisible {
  visibility: hidden;
}

.visible {
  visibility: visible;
}

/* Responsive visibility */
@media (max-width: 768px) {
  .hidden-mobile {
    display: none !important;
  }
}

@media (min-width: 769px) {
  .hidden-desktop {
    display: none !important;
  }
}

/* Loading state */
.loading {
  pointer-events: none;
  opacity: 0.7;
}

/* WebGL Canvas base */
.webgl-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-webgl);
  pointer-events: none;
}

.webgl-canvas-interactive {
  pointer-events: auto;
}