/**
 * CSS Reset and Base Styles
 * Cultiv8 Ventures Web Ecosystem
 * 
 * Provides cross-browser normalization and foundational styles
 * Based on modern CSS reset principles with Japanese zen aesthetic
 */

/* Box sizing reset */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Remove default margin and padding */
* {
  margin: 0;
  padding: 0;
}

/* HTML and Body foundation */
html {
  font-size: 16px; /* Base: 1rem = 16px */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  line-height: 1.5;
  font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
  font-size: var(--font-size-base, 1rem);
  color: var(--color-ink, #1A1A1A);
  background-color: var(--color-paper, #FAFAF8);
}

/* Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Remove list styles on ul, ol elements with list role */
ul[role='list'],
ol[role='list'] {
  list-style: none;
}

/* Remove default button styles */
button {
  font: inherit;
  cursor: pointer;
  background: none;
  border: none;
}

/* Remove default link underline */
a {
  text-decoration: none;
  color: inherit;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font: inherit;
}

/* Remove textarea resize handle */
textarea {
  resize: vertical;
}

/* Prevent horizontal overflow */
html,
body {
  overflow-x: hidden;
}

/* Smooth scrolling for users who don't prefer reduced motion */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Focus styles for accessibility */
:focus {
  outline: 2px solid var(--color-vermillion, #D64933);
  outline-offset: 2px;
}

/* Only show focus styles for keyboard navigation */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-vermillion, #D64933);
  outline-offset: 2px;
}

/* Heading defaults */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: var(--font-weight-medium, 500);
  line-height: var(--line-height-tight, 1.2);
  color: var(--color-ink, #1A1A1A);
}

/* Paragraph spacing */
p {
  margin-bottom: var(--space-sm, 1rem);
}

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

/* Balance text wrapping */
h1,
h2,
h3,
h4,
h5,
h6,
p {
  text-wrap: balance;
}

/* Selection color */
::selection {
  background-color: var(--color-vermillion, #D64933);
  color: var(--color-white, #FFFFFF);
}

/* Remove default table spacing */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Accessibility: Hidden but still available to screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Skip link (keyboard navigation) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-vermillion, #D64933);
  color: var(--color-white, #FFFFFF);
  padding: var(--space-sm, 1rem);
  text-decoration: none;
  z-index: var(--z-toast, 10000);
  font-weight: var(--font-weight-semibold, 600);
}

.skip-link:focus {
  top: 0;
  outline: 2px solid var(--color-ink, #1A1A1A);
  outline-offset: 2px;
}