/* ==========================================================================
   Knowledge Pulp — Base reset, typography, accessibility utilities
   ========================================================================== */

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

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

body {
  background: var(--kp-surface);
  color: var(--kp-text-primary);
  font-family: var(--kp-font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

button {
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

ul,
ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--kp-font-display);
  text-wrap: pretty;
}

p {
  text-wrap: pretty;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* Visible only to assistive tech until focused */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--kp-accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 18px;
  border-radius: 0 0 6px 0;
}

.skip-link:focus {
  left: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Consistent keyboard focus ring across interactive elements */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--kp-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Page enter/exit transition, see js/main.js */
@keyframes kp-page-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

#page-root {
  min-height: 100vh;
  background: var(--kp-surface);
  animation: kp-page-in var(--kp-duration-page-in) var(--kp-ease) both;
}

#page-root.is-leaving {
  transition: opacity var(--kp-duration-page-out) var(--kp-ease),
              transform var(--kp-duration-page-out) var(--kp-ease);
  opacity: 0;
  transform: translateY(-8px);
}

/* Generic placeholder block standing in for real imagery until assets are supplied */
.img-placeholder {
  background: repeating-linear-gradient(135deg, #eeeef0 0, #eeeef0 4px, #f6f6f8 4px, #f6f6f8 20px);
  border: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--kp-text-faint);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  font-size: 11px;
  line-height: 1.7;
}

.img-placeholder--dark {
  background: repeating-linear-gradient(135deg, #111 0, #111 4px, #161616 4px, #161616 20px);
  border-color: #1e1e1e;
  color: #333;
}
