/**
 * L'Accordage — Global Base Styles
 * Body, headings, paragraphs, links, lists, images.
 * Top-level layout: sidebar + main content structure.
 * Footer styles.
 *
 * Depends on: tokens.css
 *
 * @package laccordage
 */

/* ── Box Model Reset ─────────────────────────────────────────────────────── */

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

/* ── Document ────────────────────────────────────────────────────────────── */

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

/* ── Body & Layout ───────────────────────────────────────────────────────── */

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  color: var(--color-text-primary);
  background-color: var(--color-background);
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Main Content Area ───────────────────────────────────────────────────── */

.wp-site-blocks,
#page,
.site {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

/* Override WP block gap that adds margin-block-start to direct children */
.wp-site-blocks > * {
  margin-block-start: 0 !important;
}

/* Ensure dynamic block wrappers (site-main) never overflow */
.site-main {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  .wp-site-blocks,
  #page,
  .site {
    margin-left: 0;
  }
}

/* ── Headings ────────────────────────────────────────────────────────────── */

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--color-text-primary);
  margin-top: 0;
  margin-bottom: var(--space-4);
  line-height: var(--leading-tight);
}

h4,
h5,
h6 {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  margin-top: 0;
  margin-bottom: var(--space-3);
  line-height: var(--leading-snug);
}

h1 {
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-semibold);
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

h5 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

/* ── Paragraphs ──────────────────────────────────────────────────────────── */

p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-primary);
  margin-top: 0;
  margin-bottom: var(--space-4);
}

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

/* ── Links ───────────────────────────────────────────────────────────────── */

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition:
    color var(--duration-fast) var(--ease-out),
    text-decoration-color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--color-link-hover);
  text-decoration-color: transparent;
}

a:focus-visible {
  outline: 3px solid var(--color-sage-300);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ── Lists ───────────────────────────────────────────────────────────────── */

ul,
ol {
  margin-top: 0;
  margin-bottom: var(--layout-element-gap, var(--space-8));
  padding-left: var(--space-6);
}

li {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--layout-item-gap, var(--space-4));
}

ul ul,
ol ol,
ul ol,
ol ul {
  margin-top: var(--space-1);
  margin-bottom: 0;
}

/* Organic bullet treatment — soft dot */
ul {
  list-style: disc;
  padding-left: var(--space-6);
}

ul > li {
  /* Use native disc bullets for clean rendering */
}

ul > li::marker {
  color: var(--color-sage-400);
}

ol {
  list-style-type: decimal;
  padding-left: var(--space-6);
}

/* Unstyled list utility */
.list-none,
nav ul,
.sidebar__nav-list,
.site-footer__nav-list,
.site-footer__contact-list {
  list-style: none;
  padding-left: 0;
}

/* ── Images ──────────────────────────────────────────────────────────────── */

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

figure {
  margin: 0;
}

figcaption {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-2);
  font-style: italic;
}

/* ── Horizontal Rule ─────────────────────────────────────────────────────── */

hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: var(--space-8) 0;
}

/* ── Blockquote ──────────────────────────────────────────────────────────── */

blockquote {
  border-left: 3px solid var(--color-earth-700);
  padding: var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  background: var(--color-earth-50);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lg);
  color: var(--color-earth-700);
  line-height: var(--leading-relaxed);
}

blockquote cite {
  display: block;
  margin-top: var(--space-3);
  font-family: var(--font-body);
  font-style: normal;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
}

/* ── Strong & Em ─────────────────────────────────────────────────────────── */

strong,
b {
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}

em,
i {
  font-style: italic;
}

/* ── Address ─────────────────────────────────────────────────────────────── */

address {
  font-style: normal;
  line-height: var(--leading-relaxed);
}

/* ── Section Layout Utilities ────────────────────────────────────────────── */

.section {
  padding-top: var(--layout-page-py, var(--section-py));
  padding-bottom: var(--layout-page-py, var(--section-py));
}

.section--alt {
  background-color: var(--color-surface);  /* White cards on sage-beige canvas */
}

.section--sage {
  background-color: var(--color-surface-sage);
}

.section--dark {
  background-color: var(--color-section-dark-bg);
  color: var(--color-section-dark-text);
}

.section--dark h1,
.section--dark h2,
.section--dark h3,
.section--dark h4,
.section--dark h5,
.section--dark h6 {
  color: var(--color-earth-100);
}

.section--dark p,
.section--dark li {
  color: var(--color-earth-300);
}

.container {
  max-width: var(--container-max);
  margin-left: auto;
  margin-right: auto;
  width: 100%;
  padding-left: var(--section-px);
  padding-right: var(--section-px);
}

.container--prose {
  max-width: var(--container-prose);
}

/* ── Scroll Reveal ───────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(22px);
    transition:
      opacity var(--duration-slow) var(--ease-gentle),
      transform var(--duration-slow) var(--ease-gentle);
  }

  .reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* Staggered children */
  .reveal-stagger > *:nth-child(1) { transition-delay: 60ms; }
  .reveal-stagger > *:nth-child(2) { transition-delay: 130ms; }
  .reveal-stagger > *:nth-child(3) { transition-delay: 200ms; }
  .reveal-stagger > *:nth-child(4) { transition-delay: 270ms; }
  .reveal-stagger > *:nth-child(5) { transition-delay: 340ms; }
  .reveal-stagger > *:nth-child(6) { transition-delay: 410ms; }
}

/* ── Floating Badge Animation ────────────────────────────────────────────── */

/* .badge--float base animation is overridden per-badge in components.css */
@keyframes laccordage-float {
  0%, 100% {
    transform: translateY(0px) rotate(-1.5deg);
  }
  50% {
    transform: translateY(-10px) rotate(1.5deg);
  }
}

/* ── Text Utilities ──────────────────────────────────────────────────────── */

.text-center  { text-align: center; }
.text-muted   { color: var(--color-text-muted); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-lg      { font-size: var(--text-lg); }

/* ── Accessibility ───────────────────────────────────────────────────────── */

.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 {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  background: var(--color-sage-600);
  color: #ffffff;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transition: top var(--duration-fast);
}

.skip-link:focus {
  top: var(--space-4);
}

/* ── WordPress Block Overrides ───────────────────────────────────────────── */

.wp-block-cover,
.wp-block-group.alignfull,
.wp-block-image.alignfull {
  width: 100%;
}

.entry-content > *,
.wp-block-post-content > * {
  max-width: var(--container-prose);
  margin-left: auto;
  margin-right: auto;
}

.entry-content > .alignwide,
.wp-block-post-content > .alignwide {
  max-width: var(--container-max);
}

.entry-content > .alignfull,
.wp-block-post-content > .alignfull {
  max-width: none;
}

/* ── Site Footer ─────────────────────────────────────────────────────────── */

.site-footer {
  background-color: var(--color-earth-900);
  color: var(--color-earth-100);
  width: 100%;
  margin-top: auto;
}

.site-footer a {
  color: var(--color-earth-300);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

.site-footer a:hover {
  color: #ffffff;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 1.4fr) 1fr 1fr;
  gap: var(--space-10);
  padding: var(--space-16) var(--section-px);
  max-width: var(--container-max);
  margin: 0 auto;
}

@media (max-width: 900px) {
  .site-footer__inner {
    grid-template-columns: 1fr 1fr;
  }
}

.site-footer__name {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: #ffffff;
  margin: 0 0 var(--space-2);
}

.site-footer__tagline {
  font-size: var(--text-sm);
  color: var(--color-earth-300);
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-style: italic;
}

.site-footer__type {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  list-style: none;
  padding: 0;
}

.site-footer__heading {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-sage-400);
  margin: 0 0 var(--space-4);
}

.site-footer__contact-list,
.site-footer__nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer__contact-list li,
.site-footer__nav-list li {
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  padding-left: 0;
}

.site-footer__contact-list li::before,
.site-footer__nav-list li::before {
  display: none;
}

.site-footer__nav-list a {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.site-footer address {
  font-size: var(--text-sm);
  color: var(--color-earth-300);
  line-height: var(--leading-relaxed);
}

.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--space-6) var(--section-px);
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-3);
}

.site-footer__bottom p {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--color-earth-300);
}

@media (max-width: 640px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
    gap: var(--space-8);
    padding: var(--space-10) var(--section-px);
  }

  .site-footer__bottom {
    flex-direction: column;
    text-align: center;
  }
}
