/*
Theme Name: Muscardin
Description: Accessible WordPress theme for critics and magazines (tile grid, light/dark, block patterns).
Author: Yvan
Version: 0.7.0
Requires at least: 6.0
Tested up to: 6.9
Text Domain: muscardin
*/

/*
  Typography: BBB Poppins TN + BBB Baskervvol — fonts-bbb.css
  https://typotheque.genderfluid.space

  Theme: html[data-theme="auto"|"light"|"dark"] — auto follows prefers-color-scheme; persisted in localStorage.
  Per-post tile accent: post meta muscardin_tile_color (hex) → CSS --tile-accent on .post-card

  Inclusive glyphs: see v0.4 header note in git history.
*/

/* —— Light (explicit) —— */
html[data-theme="light"] {
  color-scheme: light;
  --fg: #0a0a0a;
  --fg-muted: #4a4a4a;
  --bg: #ffffff;
  --rule: #cccccc;
  --link: #0a0a0a;
  --tile-accent-default: #b3b3b3;
}

/* —— Dark (explicit) —— */
html[data-theme="dark"] {
  color-scheme: dark;
  --fg: #f2f2f2;
  --fg-muted: #a8a8a8;
  --bg: #0a0a0a;
  --rule: #3a3a3a;
  --link: #f2f2f2;
  --tile-accent-default: #666666;
}

/* —— System (follow OS) —— */
html[data-theme="auto"] {
  color-scheme: light;
  --fg: #0a0a0a;
  --fg-muted: #4a4a4a;
  --bg: #ffffff;
  --rule: #cccccc;
  --link: #0a0a0a;
  --tile-accent-default: #b3b3b3;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --fg: #f2f2f2;
    --fg-muted: #a8a8a8;
    --bg: #0a0a0a;
    --rule: #3a3a3a;
    --link: #f2f2f2;
    --tile-accent-default: #666666;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-optical-sizing: auto;
  line-height: 1.6;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

:root {
  --font-display: "BBB Baskervvol", Georgia, "Times New Roman", serif;
  --font-body: "BBB Poppins TN", system-ui, -apple-system, "Segoe UI", sans-serif;
  --measure: 42rem;
  --measure-wide: min(92vw, 72rem);
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover,
a:focus {
  text-decoration-thickness: 0.12em;
}

.site {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) clamp(1rem, 4vw, 1.75rem) 4rem;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding: 1rem 0;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.site-header__brand {
  flex: 1 1 12rem;
  min-width: 0;
}

.site-nav {
  flex: 0 1 auto;
}

.site-nav__list,
.site-nav .menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: center;
  justify-content: flex-end;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav .menu-item {
  margin: 0;
}

.site-nav a,
.site-nav__link {
  color: var(--fg);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav a:hover,
.site-nav a:focus,
.site-nav__link:hover,
.site-nav__link:focus {
  text-decoration: underline;
}

/* Site name: bold sans (BBB Poppins TN Bold), distinct from body text */
.site-title {
  font-family: var(--font-body);
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.35rem;
}

.site-title a {
  color: var(--fg);
  text-decoration: none;
}

.site-title a:hover,
.site-title a:focus {
  text-decoration: underline;
}

.site-tagline {
  margin: 0;
  font-size: 0.95rem;
  color: var(--fg-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* —— Archive: square tiles (no rounded corners) —— */
.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14.5rem, 1fr));
  gap: 1px;
  margin: 0 0 2rem;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.post-card {
  --tile-accent: var(--tile-accent-default);
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  border: none;
  transition: opacity 0.15s ease;
}

.post-card:hover,
.post-card:focus-within {
  opacity: 0.92;
}

.post-card__link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.post-card__link:hover .post-card__title,
.post-card__link:focus .post-card__title {
  text-decoration: underline;
}

.post-card__media {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--bg);
  border-bottom: 3px solid var(--tile-accent);
}

.post-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-card__placeholder {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 12rem;
  background: color-mix(in srgb, var(--tile-accent) 22%, var(--bg));
}

.post-card__body {
  padding: 0.75rem 0.85rem 1rem;
  border-top: 1px solid var(--rule);
}

.post-card__time {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg-muted);
  margin-bottom: 0.35rem;
}

.post-card__title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  line-height: 1.25;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.pagination {
  margin: 2rem 0 1rem;
}

.pagination .nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: center;
  align-items: center;
}

.pagination a,
.pagination span {
  display: inline-block;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--rule);
  background: var(--bg);
  text-decoration: none;
}

.pagination a:hover {
  border-color: var(--fg);
}

.pagination .current {
  font-weight: 700;
}

.no-results {
  padding: 2rem;
  text-align: center;
  color: var(--fg-muted);
}

/* —— Single post / page —— */
.single .site,
.page:not(.front-page) .site {
  max-width: var(--measure);
}

/* —— Front page (block editor) —— */
.home-landing {
  max-width: var(--measure-wide);
}

.home-entry-content {
  margin-top: 0;
}

.home-entry-content > .wp-block-group:first-child,
.home-entry-content > .wp-block-shortcode:first-child {
  margin-top: 0;
}

.home-entry-content .alignwide {
  max-width: var(--measure-wide);
  margin-left: auto;
  margin-right: auto;
}

.home-landing__empty {
  color: var(--fg-muted);
  max-width: var(--measure);
  margin: 0 0 1rem;
}

.home-landing__edit {
  margin: 0;
  font-size: 0.95rem;
}

.home-hero {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.home-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0 0 0.5rem;
  color: var(--fg);
}

.home-hero__subtitle {
  font-family: var(--font-body);
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 0 0 1rem;
  color: var(--fg);
}

.home-hero__lead {
  margin: 0 0 1.25rem;
  font-size: 1.08rem;
  max-width: var(--measure);
}

.home-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}

.home-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.home-section__title {
  font-family: var(--font-body);
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 1rem;
  color: var(--fg);
}

.home-section__text p {
  margin: 0 0 1rem;
  max-width: var(--measure);
}

.home-section__text p:last-child {
  margin-bottom: 0;
}

.home-section__empty {
  color: var(--fg-muted);
  margin: 0;
}

.home-section__cta {
  margin: 1rem 0 0;
}

.home-cta {
  display: inline-block;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.home-cta:hover,
.home-cta:focus {
  text-decoration-thickness: 0.12em;
}

/* —— Reviews archive filters —— */
.review-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.review-filters__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin: 0;
}

.review-filters__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.review-filters__item {
  margin: 0;
}

.review-filters__link {
  display: inline-block;
  padding: 0.25rem 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--fg);
}

.review-filters__link:hover,
.review-filters__link:focus {
  border-color: var(--fg);
}

.review-filters__link.is-active {
  border-color: var(--fg);
  font-weight: 700;
}

/* —— About-style sections (optional HTML classes in the block editor) —— */
.about-section,
.about-annex {
  margin-bottom: 2.25rem;
}

.about-section:last-child,
.about-annex:last-child {
  margin-bottom: 0;
}

.about-section__title {
  font-family: var(--font-body);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
  color: var(--fg);
}

.about-annex {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
}

.entry-meta {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin: 0 0 0.75rem;
}

.entry-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 0 0 1rem;
  color: var(--fg);
}

.entry-content {
  font-size: 1.05rem;
}

.entry-content > *:first-child {
  margin-top: 0;
}

.entry-content p {
  margin: 0 0 1.15em;
}

.entry-content code {
  font-size: 0.9em;
}

.entry--bbb-inclusive {
  margin-top: 3rem;
  padding-top: 2.25rem;
  border-top: 1px solid var(--rule);
}

.entry--bbb-inclusive .entry-title,
.entry--bbb-inclusive .entry-content {
  font-feature-settings:
    "liga" 1,
    "calt" 1,
    "clig" 1;
  font-variant-ligatures: common-ligatures contextual;
  text-rendering: optimizeLegibility;
}

.entry-content__patterns {
  font-size: 0.92rem;
  color: var(--fg-muted);
  line-height: 1.65;
}

.site-footer {
  margin-top: 3.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--fg-muted);
}

.site-footer__line {
  margin: 0 0 0.75rem;
}

.theme-toggle {
  font: inherit;
  font-size: 0.85rem;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--rule);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus {
  border-color: var(--fg);
}
