/* ==========================================================================
   base.css — theme-agnostic layer
   Reset + accessibility + structural sanity ONLY.
   No colors, no fonts, no layout opinions. A page loaded with base.css alone
   must read as a clean plain document (the "naked Zen Garden" test).
   ========================================================================== */

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

* {
  margin: 0;
}

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

body {
  min-height: 100svh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  line-height: 1.2;
}

ul,
ol {
  padding: 0;
}

a {
  color: inherit;
}

table {
  border-collapse: collapse;
}

[hidden] {
  display: none !important;
}

/* --- Accessibility --- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  z-index: 100;
  padding: 0.6em 1em;
  background: #000;
  color: #fff;
}

.skip-link:focus {
  left: 0.5rem;
  top: 0.5rem;
}

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

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

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

/* --- Structural sanity (theme-agnostic defaults) --- */

/* Ornament hooks exist but are inert until a theme activates them */
.decor {
  display: none;
}

/* The optional per-category homepage showcase is inert until a theme reveals it
   (magazine layouts: [data-section="category-showcase"]{display:block}) */
.section--category-showcase {
  display: none;
}

/* The homepage h1 is for SEO/screen readers by default; themes may reveal it */
.page-title--home {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Nav: list is always visible until a theme + nav.js collaborate to collapse it.
   nav.js removes [hidden] from .nav-toggle and adds .is-collapsible to .site-nav;
   themes opt into the hamburger inside their own breakpoint via those hooks. */
.site-nav__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em 1em;
}

.nav-toggle {
  display: none;
}

/* Sensible default list resets for structural lists (themes restyle freely) */
.breadcrumbs__list,
.pagination__list,
.tag-list,
.social-list,
.site-footer__list,
.site-footer__legal-links,
.category-grid,
.widget-categories {
  list-style: none;
}

/* Media areas never overflow their boxes */
.post-card__image,
.post__hero-image {
  width: 100%;
  object-fit: cover;
}

/* Prevent grid/flex children from forcing horizontal overflow */
.layout__primary,
.layout__sidebar,
.post-card,
.post-card__body {
  min-width: 0;
}

/* Forms: give unstyled pages usable controls */
.search-form__input,
.newsletter-form__input,
.form-field__input,
.form-field__textarea {
  width: 100%;
  max-width: 100%;
}

.form-field__textarea {
  min-height: 8em;
  resize: vertical;
}

/* Form submission feedback (newsletter widget + contact form) */
.form-status {
  padding: 0.6em 0.9em;
  border-radius: 8px;
  font-size: 0.9em;
  border: 1px solid;
}

.form-status--ok {
  color: #14532d;
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.form-status--error {
  color: #7f1d1d;
  background: #fef2f2;
  border-color: #fecaca;
}

/* Owner-only banner on unpublished-article previews */
.preview-notice {
  padding: 0.7em 1em;
  margin-bottom: 1.2em;
  border-radius: 8px;
  font-size: 0.9em;
  font-weight: 600;
  color: #713f12;
  background: #fefce8;
  border: 1px dashed #facc15;
}

/* Honeypot: invisible to people, tempting to bots */
.hp-field {
  position: absolute !important;
  left: -9999px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Disabled pagination links are inert */
.pagination__link[aria-disabled="true"] {
  pointer-events: none;
}

.pagination__ellipsis {
  opacity: 0.6;
  padding: 0 0.35em;
}

/* --- Per-site logo image (additive contract hook) ---
   When a site sets a logo, an <img class="site-brand__logo-img"> is rendered
   inside the .site-brand__logo span. This neutralizes any theme's CSS-drawn
   mark (background or ::before/::after) on that span so the real logo isn't
   doubled, and constrains the image. Theme-agnostic on purpose: adding a logo
   must not require editing 9 theme files. See docs/HTML-CONTRACT.md. */
.site-brand__logo:has(.site-brand__logo-img) {
  background: none !important;
}
.site-brand__logo:has(.site-brand__logo-img)::before,
.site-brand__logo:has(.site-brand__logo-img)::after {
  content: none !important;
  display: none !important;
}
.site-brand__logo-img {
  display: block;
  height: 32px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}
