/**
 * Base Styles
 * Reset and foundational styles for Cohiru Lab.
 */

/* ===== CSS Reset ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-family-heading);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  margin-bottom: var(--space-md);
}

h1 { font-size: var(--font-size-4xl); }
h2 { font-size: var(--font-size-3xl); }
h3 { font-size: var(--font-size-2xl); }
h4 { font-size: var(--font-size-xl); }
h5 { font-size: var(--font-size-lg); }
h6 { font-size: var(--font-size-base); }

p {
  margin-bottom: var(--space-md);
}

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

/* ===== Links ===== */
a {
  color: var(--color-accent-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-accent-secondary-hover);
}

a:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* ===== Images ===== */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/**
 * Image Protection
 * Prevents casual copying of images
 * Note: This is a soft protection only
 */
img:not(.img--saveable) {
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Allow interaction for saveable images */
.img--saveable {
  pointer-events: auto;
  -webkit-user-select: auto;
  user-select: auto;
}

/* ===== Lists ===== */
ul, ol {
  padding-left: var(--space-lg);
}

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

/* ===== Buttons ===== */
button {
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

button:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* ===== Layout ===== */
.container {
  max-width: var(--container-max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding);
  padding-right: var(--container-padding);
}

.section {
  padding-top: var(--space-3xl);
  padding-bottom: var(--space-3xl);
}

/* ===== Visually Hidden (Accessibility) ===== */
.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;
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--color-accent-primary);
  color: #ffffff;
  padding: var(--space-sm) var(--space-md);
  z-index: var(--z-tooltip);
  transform: translateY(-100%);
  transition: transform var(--transition-fast);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ===== Selection ===== */
::selection {
  background-color: var(--color-accent-primary);
  color: #ffffff;
}

/* ===== Focus ===== */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--color-accent-secondary);
  outline-offset: 2px;
}

/* ===== Reduced Motion (Global) ===== */
@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;
  }
}
