/* ============================================================
   Deep Sea Fauna — Base Styles
   Reset, body, typography defaults, skip link, focus, utilities
   ============================================================ */

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

html {
  font-size: 100%;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background: var(--gutter-bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ── Typography ── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  line-height: var(--line-height-heading);
  color: var(--color-text);
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, var(--text-4xl)); }
h2 { font-size: clamp(1.5rem, 3.5vw, var(--text-3xl)); font-weight: 400; }
h3 { font-size: clamp(1.125rem, 2.5vw, var(--text-xl)); font-weight: 700; }
h4 { font-size: var(--text-lg); font-weight: 700; }
h5 { font-size: var(--text-base); font-weight: 600; }
h6 { font-size: var(--text-sm); font-weight: 600; }

p {
  margin-block-end: var(--space-md);
  max-width: 68ch;
}

p:last-child {
  margin-block-end: 0;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

strong {
  font-weight: 600;
}

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-bg-alt);
  padding: 0.1em 0.35em;
  border-radius: var(--radius);
}

ul,
ol {
  list-style: none;
}

table {
  border-collapse: collapse;
  width: 100%;
}

/* ── Focus visible ── */
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ── Skip link ── */
.skip-link {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: var(--z-skip);
  text-decoration: none;
}

.skip-link:focus {
  position: fixed;
  top: var(--space-sm);
  left: var(--space-sm);
  width: auto;
  height: auto;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-primary);
  color: var(--color-text-on-dark);
  font-weight: 700;
  font-size: var(--text-sm);
  border-radius: var(--radius);
  z-index: var(--z-skip);
  text-decoration: none;
}

/* ── Visually hidden (screen-reader only) ── */
.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;
}

/* ── Skeleton loading ── */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-border) 25%,
    #e8e5de 50%,
    var(--color-border) 75%
  );
  background-size: 200% 100%;
  border-radius: var(--radius);
}

.skeleton-text {
  height: 1em;
  border-radius: var(--radius);
}

.skeleton-img {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
}

/* ── Image placeholder ── */
.img-placeholder {
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-light);
  font-size: var(--text-sm);
}

/* ── 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;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: skeleton-pulse 1.5s ease-in-out infinite;
  }
}

@keyframes skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Scroll reveal ── */
[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: no-preference) {
  [data-reveal] {
    transition: opacity var(--transition-slow), transform var(--transition-slow);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
