/* ==========================================================================
   VCAN FITNESS - Base Styles
   Reset and Foundational Styles
   ========================================================================== */

/* ==========================================================================
   RESET - Modern CSS Reset
   ========================================================================== */

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

html {
  font-size: 16px;
  line-height: 1;
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary, 'Archivo', sans-serif);
  font-size: var(--body, 16px);
  line-height: var(--lh-base, 1.6);
  color: var(--vc-fg-primary, #000000);
  /* Explicit white background as safety net */
  background: #ffffff;
  background: var(--vc-bg-main, #ffffff);
  text-rendering: optimizeSpeed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  margin-top: 0;
  margin-bottom: var(--space-3);
  /* Subtle rotation for handmade feel */
  transform: rotate(-0.1deg);
}

h1 {
  font-size: var(--h1);
  font-weight: var(--fw-black);
  letter-spacing: var(--ls-tight);
}

h2 {
  font-size: var(--h2);
  font-weight: var(--fw-bold);
}

h3 {
  font-size: var(--h3);
  font-weight: var(--fw-semibold);
}

h4 {
  font-size: var(--h4);
  font-weight: var(--fw-semibold);
}

h5 {
  font-size: var(--h5);
  font-weight: var(--fw-medium);
}

h6 {
  font-size: var(--h6);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
}

p {
  margin-bottom: var(--space-3);
  max-width: 65ch;
}

/* Mobile text improvements */
@media (max-width: 768px) {
  p {
    max-width: none;
    margin-bottom: var(--space-3);
  }

  .hero-subtitle,
  .section-subtitle {
    max-width: none;
  }
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--vc-primary);
  text-decoration: none;
  transition: color var(--duration-quick);
}

a:hover {
  color: var(--vc-primary-light);
}

a:focus-visible {
  outline: var(--focus-outline-width) solid var(--focus-outline-color);
  outline-offset: var(--focus-outline-offset);
}

strong, b {
  font-weight: var(--fw-bold);
}

em, i {
  font-style: italic;
}

small {
  font-size: var(--caption);
}

blockquote {
  padding-left: var(--space-4);
  border-left: 3px solid var(--vc-primary);
  margin: var(--space-4) 0;
  font-style: italic;
  color: var(--vc-fg-secondary);
}

/* ==========================================================================
   LISTS
   ========================================================================== */

ul, ol {
  margin-bottom: var(--space-3);
  padding-left: var(--space-4);
}

ul {
  list-style-type: disc;
}

ol {
  list-style-type: decimal;
}

li {
  margin-bottom: var(--space-1);
}

li:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   IMAGES & MEDIA
   ========================================================================== */

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

img {
  /* Anti-aliasing for images */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

figure {
  margin: var(--space-4) 0;
}

figcaption {
  margin-top: var(--space-2);
  font-size: var(--caption);
  color: var(--vc-fg-muted);
  font-style: italic;
}

/* ==========================================================================
   TABLES
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--space-4);
}

th,
td {
  padding: var(--space-2);
  text-align: left;
  border-bottom: 1px solid var(--vc-border);
}

th {
  font-weight: var(--fw-semibold);
  background: var(--vc-bg-alt);
}

/* ==========================================================================
   FORMS - Base Styles
   ========================================================================== */

button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

fieldset {
  border: 1px solid var(--vc-border);
  padding: var(--space-3);
  margin-bottom: var(--space-4);
}

legend {
  padding: 0 var(--space-2);
  font-weight: var(--fw-semibold);
}

/* ==========================================================================
   LAYOUT UTILITIES
   ========================================================================== */

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

@media (min-width: 640px) {
  .container {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .container {
    padding: 0 var(--space-8);
  }
}

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

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

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

/* Mobile section spacing */
@media (max-width: 768px) {
  .section {
    padding: var(--space-12) 0;
  }

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

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

/* ==========================================================================
   GRID SYSTEM
   ========================================================================== */

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

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Mobile-first responsive grids */
@media (max-width: 480px) {
  .grid,
  .grid--2,
  .grid--3,
  .grid--4 {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .grid--3,
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid--2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .grid--2,
  .grid--3,
  .grid--4 {
    gap: var(--space-4);
  }
}

/* Broken Grid Variant */
.grid--broken {
  display: grid;
  gap: var(--space-4);
  position: relative;
}

.grid--broken > *:nth-child(odd) {
  transform: translateY(var(--offset-subtle));
}

.grid--broken > *:nth-child(even) {
  transform: translateY(calc(var(--offset-subtle) * -1));
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.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;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Focus styles */
:focus-visible {
  outline: var(--focus-outline-width) solid var(--focus-outline-color);
  outline-offset: var(--focus-outline-offset);
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  background: var(--vc-primary);
  color: var(--vc-fg-primary);
  padding: var(--space-2) var(--space-3);
  text-decoration: none;
  z-index: var(--z-max);
  white-space: nowrap;
}

.skip-link:focus {
  position: absolute;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  overflow: visible;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: translateX(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Reduced motion */
@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;
  }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  img {
    max-width: 100% !important;
  }

  @page {
    margin: 0.5cm;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}