@import "tailwindcss";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

@theme inline {
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --font-sans: var(--font-chivo-mono), Chivo Mono, monospace;
  --font-mono: Fira Code, monospace;
  --font-serif: var(--font-merriweather), Merriweather, serif;
  --font-heading: var(--font-merriweather), Merriweather, serif;
  --radius: 0.3rem;
  --tracking-normal: 0em;
  --tracking-tighter: calc(var(--tracking-normal) - 0.05em);
  --tracking-tight: calc(var(--tracking-normal) - 0.025em);
  --tracking-wide: calc(var(--tracking-normal) + 0.025em);
  --tracking-wider: calc(var(--tracking-normal) + 0.05em);
  --tracking-widest: calc(var(--tracking-normal) + 0.1em);
  --shadow-2xl: var(--shadow-2xl);
  --shadow-xl: var(--shadow-xl);
  --shadow-lg: var(--shadow-lg);
  --shadow-md: var(--shadow-md);
  --shadow: var(--shadow);
  --shadow-sm: var(--shadow-sm);
  --shadow-xs: var(--shadow-xs);
  --shadow-2xs: var(--shadow-2xs);
  --spacing: var(--spacing);
  --letter-spacing: var(--letter-spacing);
  --shadow-offset-y: var(--shadow-offset-y);
  --shadow-offset-x: var(--shadow-offset-x);
  --shadow-spread: var(--shadow-spread);
  --shadow-blur: var(--shadow-blur);
  --shadow-opacity: var(--shadow-opacity);
  --color-shadow-color: var(--shadow-color);
  --color-destructive-foreground: var(--destructive-foreground);
  --color-sidebar-ring: var(--sidebar-ring);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar: var(--sidebar);
  --color-chart-5: var(--chart-5);
  --color-chart-4: var(--chart-4);
  --color-chart-3: var(--chart-3);
  --color-chart-2: var(--chart-2);
  --color-chart-1: var(--chart-1);
  --color-ring: var(--ring);
  --color-input: var(--input);
  --color-border: var(--border);
  --color-destructive: var(--destructive);
  --color-accent-foreground: var(--accent-foreground);
  --color-accent: var(--accent);
  --color-muted-foreground: var(--muted-foreground);
  --color-muted: var(--muted);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-secondary: var(--secondary);
  --color-primary-foreground: var(--primary-foreground);
  --color-primary: var(--primary);
  --color-popover-foreground: var(--popover-foreground);
  --color-popover: var(--popover);
  --color-card-foreground: var(--card-foreground);
  --color-card: var(--card);
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --background-end-rgb: var(----background-end-rgb);
  --background-start-rgb: var(----background-start-rgb);
  --foreground-rgb: var(----foreground-rgb);
}

:root {
  --radius: 0.3rem;
  --background: oklch(0.9885 0.0057 84.5659);
  --foreground: oklch(0.3660 0.0251 49.6085);
  --card: oklch(0.9686 0.0091 78.2818);
  --card-foreground: oklch(0.3660 0.0251 49.6085);
  --popover: oklch(0.9686 0.0091 78.2818);
  --popover-foreground: oklch(0.3660 0.0251 49.6085);
  --primary: oklch(0.5553 0.1455 48.9975);
  --primary-foreground: oklch(1.0000 0 0);
  --secondary: oklch(0.8276 0.0752 74.4400);
  --secondary-foreground: oklch(0.4444 0.0096 73.6390);
  --muted: oklch(0.9363 0.0218 83.2637);
  --muted-foreground: oklch(0.5534 0.0116 58.0708);
  --accent: oklch(0.9000 0.0500 74.9889);
  --accent-foreground: oklch(0.4444 0.0096 73.6390);
  --destructive: oklch(0.4437 0.1613 26.8994);
  --border: oklch(0.8866 0.0404 89.6994);
  --input: oklch(0.8866 0.0404 89.6994);
  --ring: oklch(0.5553 0.1455 48.9975);
  --chart-1: oklch(0.5553 0.1455 48.9975);
  --chart-2: oklch(0.5534 0.0116 58.0708);
  --chart-3: oklch(0.5538 0.1207 66.4416);
  --chart-4: oklch(0.5534 0.0116 58.0708);
  --chart-5: oklch(0.6806 0.1423 75.8340);
  --sidebar: oklch(0.9363 0.0218 83.2637);
  --sidebar-foreground: oklch(0.3660 0.0251 49.6085);
  --sidebar-primary: oklch(0.5553 0.1455 48.9975);
  --sidebar-primary-foreground: oklch(1.0000 0 0);
  --sidebar-accent: oklch(0.5538 0.1207 66.4416);
  --sidebar-accent-foreground: oklch(1.0000 0 0);
  --sidebar-border: oklch(0.8866 0.0404 89.6994);
  --sidebar-ring: oklch(0.5553 0.1455 48.9975);
  --destructive-foreground: oklch(1.0000 0 0);
  --font-sans: Oxanium, sans-serif;
  --font-serif: Merriweather, serif;
  --font-mono: Fira Code, monospace;
  --shadow-color: hsl(28 18% 25%);
  --shadow-opacity: 0.18;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-offset-x: 0px;
  --shadow-offset-y: 2px;
  --letter-spacing: 0em;
  --spacing: 0.25rem;
  --shadow-2xs: 0px 2px 3px 0px hsl(28 18% 25% / 0.09);
  --shadow-xs: 0px 2px 3px 0px hsl(28 18% 25% / 0.09);
  --shadow-sm: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 1px 2px -1px hsl(28 18% 25% / 0.18);
  --shadow: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 1px 2px -1px hsl(28 18% 25% / 0.18);
  --shadow-md: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 2px 4px -1px hsl(28 18% 25% / 0.18);
  --shadow-lg: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 4px 6px -1px hsl(28 18% 25% / 0.18);
  --shadow-xl: 0px 2px 3px 0px hsl(28 18% 25% / 0.18), 0px 8px 10px -1px hsl(28 18% 25% / 0.18);
  --shadow-2xl: 0px 2px 3px 0px hsl(28 18% 25% / 0.45);
  --tracking-normal: 0em;
  --foreground-rgb: 255, 255, 255;
  --background-start-rgb: 0, 0, 0;
  --background-end-rgb: 0, 0, 0;
}

.dark {
  --background: oklch(0.2161 0.0061 56.0434);
  --foreground: oklch(0.9699 0.0013 106.4238);
  --card: oklch(0.2685 0.0063 34.2976);
  --card-foreground: oklch(0.9699 0.0013 106.4238);
  --popover: oklch(0.2685 0.0063 34.2976);
  --popover-foreground: oklch(0.9699 0.0013 106.4238);
  --primary: oklch(0.7049 0.1867 47.6044);
  --primary-foreground: oklch(1.0000 0 0);
  --secondary: oklch(0.4444 0.0096 73.6390);
  --secondary-foreground: oklch(0.9232 0.0026 48.7171);
  --muted: oklch(0.2330 0.0073 67.4563);
  --muted-foreground: oklch(0.7161 0.0091 56.2590);
  --accent: oklch(0.3598 0.0497 229.3202);
  --accent-foreground: oklch(0.9232 0.0026 48.7171);
  --destructive: oklch(0.5771 0.2152 27.3250);
  --border: oklch(0.3741 0.0087 67.5582);
  --input: oklch(0.3741 0.0087 67.5582);
  --ring: oklch(0.7049 0.1867 47.6044);
  --chart-1: oklch(0.7049 0.1867 47.6044);
  --chart-2: oklch(0.6847 0.1479 237.3225);
  --chart-3: oklch(0.7952 0.1617 86.0468);
  --chart-4: oklch(0.7161 0.0091 56.2590);
  --chart-5: oklch(0.5534 0.0116 58.0708);
  --sidebar: oklch(0.2685 0.0063 34.2976);
  --sidebar-foreground: oklch(0.9699 0.0013 106.4238);
  --sidebar-primary: oklch(0.7049 0.1867 47.6044);
  --sidebar-primary-foreground: oklch(1.0000 0 0);
  --sidebar-accent: oklch(0.6847 0.1479 237.3225);
  --sidebar-accent-foreground: oklch(0.2839 0.0734 254.5378);
  --sidebar-border: oklch(0.3741 0.0087 67.5582);
  --sidebar-ring: oklch(0.7049 0.1867 47.6044);
  --destructive-foreground: oklch(1.0000 0 0);
  --radius: 0.3rem;
  --font-sans: Oxanium, sans-serif;
  --font-serif: Merriweather, serif;
  --font-mono: Fira Code, monospace;
  --shadow-color: hsl(0 0% 5%);
  --shadow-opacity: 0.18;
  --shadow-blur: 3px;
  --shadow-spread: 0px;
  --shadow-offset-x: 0px;
  --shadow-offset-y: 2px;
  --letter-spacing: 0em;
  --spacing: 0.25rem;
  --shadow-2xs: 0px 2px 3px 0px hsl(0 0% 5% / 0.09);
  --shadow-xs: 0px 2px 3px 0px hsl(0 0% 5% / 0.09);
  --shadow-sm: 0px 2px 3px 0px hsl(0 0% 5% / 0.18), 0px 1px 2px -1px hsl(0 0% 5% / 0.18);
  --shadow: 0px 2px 3px 0px hsl(0 0% 5% / 0.18), 0px 1px 2px -1px hsl(0 0% 5% / 0.18);
  --shadow-md: 0px 2px 3px 0px hsl(0 0% 5% / 0.18), 0px 2px 4px -1px hsl(0 0% 5% / 0.18);
  --shadow-lg: 0px 2px 3px 0px hsl(0 0% 5% / 0.18), 0px 4px 6px -1px hsl(0 0% 5% / 0.18);
  --shadow-xl: 0px 2px 3px 0px hsl(0 0% 5% / 0.18), 0px 8px 10px -1px hsl(0 0% 5% / 0.18);
  --shadow-2xl: 0px 2px 3px 0px hsl(0 0% 5% / 0.45);
}

@layer base {
  * {
    @apply border-border outline-ring/50;
  }
  html {
    /* Cross-browser viewport height fix */
    height: 100%;
    height: -webkit-fill-available;
  }
  body {
    @apply bg-background text-foreground;
    font-family: var(--font-chivo-mono), Chivo Mono, monospace;
    letter-spacing: var(--tracking-normal);
    min-height: 100vh;
    min-height: 100dvh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    /* Prevent horizontal scrollbar */
    width: 100%;
    max-width: 100vw;
  }
  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-merriweather), Merriweather, serif;
  }
  h1 {
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  h2 {
    line-height: 1.2;
    letter-spacing: -0.01em;
  }
  h3 {
    line-height: 1.3;
  }
  p, body {
    line-height: 1.6;
  }
  /* Ensure consistent box-sizing */
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }
}

/* Hide scrollbar but keep scroll functionality */
.hide-scrollbar {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.hide-scrollbar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

/* Card depth utilities using theme shadow variables */
.card-depth-1 {
  box-shadow: var(--shadow-lg), inset 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.card-depth-2 {
  box-shadow: var(--shadow-2xl), inset 0 2px 4px 0 rgba(0, 0, 0, 0.08);
}

/* Text shadow utilities using foreground with opacity */
.text-shadow-sm {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.text-shadow-md {
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.text-shadow-lg {
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* Noise texture using SVG pattern */
.noise-texture {
  position: relative;
}

.noise-texture::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 1;
}

/* Typography scale utilities */
.text-heading-1 {
  font-size: clamp(2.5rem, 8vw, 6rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.text-heading-2 {
  font-size: clamp(1.875rem, 4vw, 3rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.text-heading-3 {
  font-size: clamp(1.25rem, 2.5vw, 1.875rem);
  line-height: 1.3;
}

/* Theme wipe overlay - shows old theme on left, reveals new theme on right */
.theme-wipe-overlay {
  background: var(--background);
  backgroundSize: cover;
  backgroundPosition: center;
  backgroundRepeat: no-repeat;
  WebkitMaskImage: linear-gradient(to right, transparent 0%, transparent 0%, black 0%, black 100%);
  maskImage: linear-gradient(to right, transparent 0%, transparent 0%, black 0%, black 100%);
  WebkitMaskSize: 100% 100%;
  maskSize: 100% 100%;
  WebkitMaskRepeat: no-repeat;
  maskRepeat: no-repeat;
  transition: opacity 0.1s ease-out;
}

.theme-wipe-overlay.theme-wipe-active {
  animation: theme-wipe 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes theme-wipe {
  0% {
    WebkitMaskImage: linear-gradient(to right, transparent 0%, transparent 0%, black 0%, black 100%);
    maskImage: linear-gradient(to right, transparent 0%, transparent 0%, black 0%, black 100%);
  }
  100% {
    WebkitMaskImage: linear-gradient(to right, transparent 0%, transparent 100%, black 100%, black 100%);
    maskImage: linear-gradient(to right, transparent 0%, transparent 100%, black 100%, black 100%);
  }
}


/* Rocker Switch Styles */
.rocker {
  display: inline-block;
  position: relative;
  font-size: 2em;
  font-weight: bold;
  text-align: center;
  text-transform: uppercase;
  color: #888;
  width: 7em;
  height: 4em;
  overflow: hidden;
  border-bottom: 0.5em solid #eee;
}

.rocker-small {
  font-size: 0.75em;
  width: 5.5em;
  height: 3.2em;
  border-bottom: 0.4em solid #eee;
}

.rocker input {
  opacity: 0;
  width: 0;
  height: 0;
}

.rocker label {
  position: absolute;
  top: 0.5em;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  color: #aaa;
  cursor: pointer;
  transition: color 0.2s;
  user-select: none;
}

.rocker input:checked + .switch-left,
.rocker input:not(:checked) + .switch-left + .switch-right {
  color: #fff;
}

.rocker input:checked + .switch-left + .switch-right,
.rocker input:not(:checked) + .switch-left {
  color: #888;
}

.switch-left,
.switch-right {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2.5em;
  width: 3em;
  transition: all 0.2s;
  user-select: none;
}

.switch-left {
  height: 2.4em;
  width: 2.75em;
  left: 0.85em;
  bottom: 0.4em;
  background-color: #ddd;
  transform: rotate(15deg) skewX(15deg);
}

.switch-right {
  right: 0.8em;
  bottom: 0;
  background-color: #575757;
  color: #fff;
  transform: rotate(-15deg) skewX(-15deg);
}

.rocker-small .switch-left {
  height: 1.9em;
  width: 2.2em;
  left: 0.65em;
  bottom: 0.35em;
}

.rocker-small .switch-right {
  right: 0.65em;
  bottom: 0;
}

.rocker input:checked + .switch-left {
  background-color: #575757;
  color: #fff;
  bottom: 0px;
  left: 0.5em;
  height: 2.5em;
  width: 2.75em;
  transform: rotate(0deg) skewX(0deg);
}

.rocker input:checked + .switch-left + .switch-right {
  background-color: #ddd;
  color: #888;
  bottom: 0.4em;
  right: 0.8em;
  height: 2.4em;
  width: 2.75em;
  transform: rotate(0deg) skewX(0deg);
}

.rocker-small input:checked + .switch-left {
  left: 0.4em;
  height: 1.9em;
  width: 2.2em;
}

.rocker-small input:checked + .switch-left + .switch-right {
  right: 0.4em;
  height: 1.9em;
  width: 2.2em;
}