/* ============================================================
   BASE.CSS — Tokens, reset, typography
   davidbunton.design
   ============================================================ */


/* ------------------------------------------------------------
   DESIGN TOKENS
   ------------------------------------------------------------ */

:root {

  /* Surface depth */
  --color-sunken:         #171719;   /* inset surfaces — sandbox containers, inputs */
  --color-bg:             #1c1c1f;   /* base background */
  --color-surface:        #242428;   /* lifted cards, sections */
  --color-surface-raised: #2e2e33;   /* even more elevated elements */
  --color-overlay:        #38383f;   /* popovers, modals, sidebars */

  /* Text */
  --color-text-headline:  #ededf2;   /* cool off-white */
  --color-text-body:      #cbcbd4;   /* light metallic grey */
  --color-text-muted:     #bcbcc7;   /* secondary / muted */

  /* Border */
  --color-border:         #34343a;

  /* Accent */
  --color-accent:         #c4356a;   /* warm magenta */
  --color-accent-hover:   #d4407a;   /* slightly lighter on hover */

  /* Focus */
  --color-focus:          #2997ff;   /* Apple blue — accessible focus ring */

  /* Button border (secondary/outline CTAs) */
  --color-btn-border:     #8a8a92;   /* --color-text-muted — visible but not heavy */

  /* Typography */
  --font-display:  'Space Grotesk', sans-serif;
  --font-body:     'Inter', sans-serif;

  /* Type scale */
  --text-xs:   0.75rem;    /*  12px */
  --text-sm:   0.875rem;   /*  14px */
  --text-base: 1rem;       /*  16px */
  --text-lg:   1.125rem;   /*  18px */
  --text-xl:   1.25rem;    /*  20px */
  --text-2xl:  1.5rem;     /*  24px */
  --text-3xl:  2rem;       /*  32px */
  --text-4xl:  3rem;       /*  48px */
  --text-5xl:  4rem;       /*  64px */
  --text-6xl:  5.5rem;     /*  88px */

  /* Spacing scale */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  48px;
  --space-2xl: 80px;
  --space-3xl: 120px;
  --space-4xl: 200px;

  /* Layout */
  --max-width: 1200px;
  --header-height: 52px;

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;
  --transition-crawl:  600ms ease;

  /* Elevation shadows */
  --shadow-overlay: 0 8px 32px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
}


/* ------------------------------------------------------------
   RESET
   ------------------------------------------------------------ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100vh;
}

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

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

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}


/* ------------------------------------------------------------
   BASE TYPOGRAPHY
   ------------------------------------------------------------ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text-headline);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

h1 { font-size: var(--text-4xl); font-weight: 700; }
h2 { font-size: var(--text-3xl); font-weight: 700; }
h3 { font-size: var(--text-2xl); font-weight: 600; }
h4 { font-size: var(--text-xl);  font-weight: 600; }
h5 { font-size: var(--text-2xl); font-weight: 500; }
h6 { font-size: var(--text-xl);  font-weight: 500; }

p {
  font-size: var(--text-base);
  color: var(--color-text-body);
  line-height: 1.7;
  max-width: 65ch;
}


/* ------------------------------------------------------------
   UTILITY
   ------------------------------------------------------------ */

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

/* ------------------------------------------------------------
   FOCUS STYLES
   ------------------------------------------------------------ */

/* Remove default outline globally, replace with custom */
*:focus {
  outline: none;
}

/* Only show focus ring for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: 6px;
}


/* ------------------------------------------------------------
   BUTTONS / CTAs
   ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 8px 18px;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast);
  text-decoration: none;
  border: 1px solid transparent;
}

/* Primary — crimson fill */
.btn-primary {
  background: var(--color-accent);
  color: #ffffff;
  border-color: var(--color-accent);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

/* Secondary — outline */
.btn-secondary {
  background: transparent;
  color: var(--color-text-body);
  border-color: var(--color-btn-border);
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  color: var(--color-text-headline);
  border-color: var(--color-text-headline);
}


/* ------------------------------------------------------------
   PROJECT CARD — sunken container for projects overview sections
   ------------------------------------------------------------ */

.project-card {
  width: 100%;
  background:
    radial-gradient(ellipse at var(--grad-x, 12%) var(--grad-y, 88%), rgba(179, 27, 58, 0.03) 0%, transparent 35%),
    radial-gradient(ellipse 65% 55% at var(--grad-light-x, 25%) var(--grad-light-y, 30%), #0e0e12 0%, var(--color-sunken) 65%);
  border-radius: 0;
  padding: var(--space-3xl) var(--space-2xl);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  text-align: center;
  position: relative;
  overflow: hidden;
}


/* ------------------------------------------------------------
   SCROLL ANIMATIONS
   ------------------------------------------------------------ */

/* Base state — invisible, shifted down */
.anim-fade-up {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity  0.72s cubic-bezier(0.2, 0, 0, 1),
    transform 0.72s cubic-bezier(0.2, 0, 0, 1);
}

/* Visible state — triggered by JS when element enters viewport */
.anim-fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger delays — headline first, then each element after */
.anim-delay-1 { transition-delay: 0.08s; }
.anim-delay-2 { transition-delay: 0.18s; }
.anim-delay-3 { transition-delay: 0.30s; }
.anim-delay-4 { transition-delay: 0.44s; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .anim-fade-up {
    opacity: 1;
    transform: none;
    transition: none;
  }
}


/* ------------------------------------------------------------
   UTILITY
   ------------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
