/*
 * LOUCHE 2025 — Full-site Swup child theme of Twenty Twenty-Five.
 *
 * Structure of this stylesheet:
 *   1. Design tokens (colors, fonts, motion, layout)
 *   2. Global base (html, body, links, scrollbars, selection)
 *   3. Accessibility (skip link, focus ring)
 *   4. Section accent system (body class, server-owned)
 *   5. Header (logo, primary nav, homepage nav-hide)
 *   6. Footer (copy, consent, social icons)
 *   7. Bento landing (grid, cards, Latin labels, entrance, image system)
 *   8. Inner pages (page hero, kicker, entry content)
 *   9. Archives, post cards, pagination (Work, category, tag, search)
 *  10. Single post
 *  11. 404
 *  12. Buttons
 *  13. Plugin polish (Formidable, Relevanssi)
 *  14. Responsive — tablet, mobile, reduced motion
 */


/* ────────────────────────────────────────────────────────────────────────
 * 1. Design tokens
 * ──────────────────────────────────────────────────────────────────────── */

:root {
  /*
   * Palette — sourced from the theme.json presets so the Site Editor and the
   * front end cannot drift apart. theme.json is the single definition; these
   * names exist because --louche-teal reads better in a rule than
   * --wp--preset--color--teal, not because they hold a second copy of the value.
   *
   * The literals are fallbacks for contexts that render without WordPress
   * emitting its preset custom properties (the editor iframe, the test
   * fixtures). They must stay equal to theme.json; CI asserts it.
   */
  --louche-cream:       var(--wp--preset--color--cream, #f0ebe3);
  --louche-cream-dark:  var(--wp--preset--color--cream-dark, #e8e1d7);
  --louche-ink:         var(--wp--preset--color--ink, #1a1a1a);
  --louche-ink-light:   var(--wp--preset--color--ink-light, #3a3a3a);
  --louche-teal:        var(--wp--preset--color--teal, #2d7a7a);
  --louche-gold:        var(--wp--preset--color--gold, #c8a84b);
  --louche-pink:        var(--wp--preset--color--pink-accent, #d4849a);
  --louche-midnight:    var(--wp--preset--color--midnight, #050d1f);

  /* Not a palette entry: the deep blue the Music section alone is tuned to. */
  --louche-navy:        #0a1a3a;

  /* Typography */
  --louche-font-display: var(--wp--preset--font-family--display, "Cormorant Garamond", Georgia, serif);
  --louche-font-mark:    var(--wp--preset--font-family--mark, "Tenor Sans", "Helvetica Neue", sans-serif);
  --louche-font-body:    var(--wp--preset--font-family--body, Montserrat, system-ui, sans-serif);

  /* Layout & motion */
  --louche-radius:    12px;
  --louche-gap:       10px;
  --louche-ease-out:  cubic-bezier(0.22, 1, 0.36, 1);
  --louche-shadow:    0 24px 80px rgba(26, 26, 26, 0.14);

  /* Section accent — set per route by the .louche-section-* rules below. */
  --louche-section-accent: var(--louche-teal);

  /* Bento image variables — defined only when has-louche-bento-images is on body. */
  --louche-bento-person-image:  none;
  --louche-bento-work-image:    none;
  --louche-bento-art-image:     none;
  --louche-bento-music-image:   none;
  --louche-bento-musings-image: none;
  --louche-bento-hello-image:   none;
  --louche-bento-legal-image:   none;
}


/* ────────────────────────────────────────────────────────────────────────
 * 2. Global base
 * ──────────────────────────────────────────────────────────────────────── */

html {
  background: var(--louche-cream);
  /* CSS smooth-scroll conflicts with Swup's own scroll handling; left to JS. */
}

body {
  background: var(--louche-cream);
  color: var(--louche-ink);
  font-family: var(--louche-font-body);
  overflow-x: hidden;
}

::selection {
  background: var(--louche-teal);
  color: var(--louche-cream);
}

a {
  transition:
    color 0.2s ease,
    border-color 0.2s ease,
    opacity 0.2s ease;
}

.wp-site-blocks {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-bar .louche-header {
  top: 32px;
}


/* ────────────────────────────────────────────────────────────────────────
 * 3. Accessibility
 * ──────────────────────────────────────────────────────────────────────── */

/*
 * The homepage's H1 is the brand and tagline. It is visually hidden because the
 * bento itself carries the identity on screen, but a page with no H1 at all
 * leaves screen-reader and heading-navigation users without a title — and gives
 * the route announcer nothing to announce.
 *
 * WordPress and the parent theme both define .screen-reader-text; it is
 * restated here so the theme does not depend on that continuing to be true.
 */
.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/*
 * The skip link belongs to WordPress core.
 *
 * Block themes get one automatically, pointed at the first <main> — which is
 * #swup-main here — with core's own translated label. The theme therefore
 * renders no skip link of its own; doing so is what produced two "Skip to
 * content" links on every live page. These rules only restyle core's element
 * to match the rest of the site.
 */
.skip-link.screen-reader-text:focus {
  z-index: 10000;
  border-radius: 999px;
  background: var(--louche-ink);
  color: var(--louche-cream);
  font-family: var(--louche-font-mark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  padding: 10px 16px;
  text-decoration: none;
  text-transform: uppercase;
  box-shadow: 0 0 0 3px rgba(45, 122, 122, 0.28);
}

.louche-logo:focus-visible,
.louche-nav a:focus-visible,
.louche-card:focus-visible,
.louche-consent:focus-visible,
.louche-footer-icons a:focus-visible,
.louche-button .wp-block-button__link:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(45, 122, 122, 0.28);
}


/* ────────────────────────────────────────────────────────────────────────
 * 4. Section accent system
 *
 * The body class is the only section signal. functions.php resolves it from
 * the real WordPress query (and Polylang relationships for translated
 * routes), and the Swup body-class plugin copies the incoming page's body
 * class after every client-side navigation. Nothing re-derives the section
 * from the URL, so there is exactly one owner and no way for the client to
 * disagree with the server.
 * ──────────────────────────────────────────────────────────────────────── */

.louche-section-person  { --louche-section-accent: var(--louche-teal); }
.louche-section-work    { --louche-section-accent: var(--louche-ink); }
.louche-section-art     { --louche-section-accent: var(--louche-pink); }
.louche-section-music   { --louche-section-accent: var(--louche-navy); }
.louche-section-hello   { --louche-section-accent: var(--louche-gold); }
.louche-section-privacy { --louche-section-accent: var(--louche-ink-light); }


/* ────────────────────────────────────────────────────────────────────────
 * 5. Header
 * ──────────────────────────────────────────────────────────────────────── */

.louche-header {
  padding: 24px 40px 14px;
  background: rgba(240, 235, 227, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}

.louche-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.louche-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
}

.louche-logo {
  position: relative;
  display: inline-grid;
  min-width: 11.85rem;
  margin: -4px -7px;
  padding: 4px 7px;
  overflow: visible;
  color: var(--louche-ink);
  font-family: var(--louche-font-mark);
  font-size: 26px;
  letter-spacing: -0.5px;
  text-decoration: none;
  white-space: nowrap;
}

.louche-logo-en,
.louche-logo-la {
  grid-area: 1 / 1;
  display: block;
  width: max-content;
  transition:
    opacity 0.32s ease,
    transform 0.32s var(--louche-ease-out);
}

.louche-logo-art {
  color: var(--louche-teal);
}

.louche-logo-la {
  align-self: center;
  color: var(--louche-ink);
  font-family: var(--louche-font-display);
  font-size: 0.82em;
  font-weight: 400;
  letter-spacing: 0.06em;
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px);
}

.louche-logo:hover .louche-logo-en,
.louche-logo:focus-visible .louche-logo-en {
  opacity: 0;
  transform: translateY(-7px);
}

.louche-logo:hover .louche-logo-la,
.louche-logo:focus-visible .louche-logo-la {
  opacity: 1;
  transform: translateY(0);
}

.louche-tagline {
  position: relative;
  display: inline-grid;
  align-self: flex-start;
  width: max-content;
  max-width: min(100%, calc(100vw - 40px));
  min-height: 1.35em;
  margin: 0;
  color: var(--louche-ink-light);
  cursor: default;
  font-family: var(--louche-font-display);
  font-size: clamp(0.82rem, 1vw, 0.95rem);
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.005em;
  line-height: 1.25;
}

.louche-tagline-en,
.louche-tagline-la {
  grid-area: 1 / 1;
  width: max-content;
  max-width: calc(100vw - 40px);
  transition:
    opacity 0.32s ease,
    transform 0.32s var(--louche-ease-out);
}

.louche-tagline-en {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.28em;
  color: var(--louche-ink);
}

.louche-tagline-en > span:first-child {
  color: var(--louche-teal);
}

.louche-tagline-la {
  color: var(--louche-teal);
  opacity: 0;
  pointer-events: none;
  transform: translateY(7px);
  white-space: nowrap;
}

.louche-tagline:hover .louche-tagline-en,
.louche-brand:focus-within .louche-tagline-en {
  opacity: 0;
  transform: translateY(-7px);
}

.louche-tagline:hover .louche-tagline-la,
.louche-brand:focus-within .louche-tagline-la {
  opacity: 1;
  transform: translateY(0);
}

.louche-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: clamp(10px, 1.6vw, 22px);
  flex-wrap: wrap;
}

.louche-nav a {
  font-size: 10px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
  text-decoration: none;
  color: #777;
  border-bottom: 1px solid transparent;
  padding-bottom: 3px;
}

.louche-nav a:hover,
.louche-nav a.is-active {
  color: var(--louche-section-accent);
  border-color: var(--louche-section-accent);
}

/*
 * Hide the primary nav on the homepage only.
 *
 * `.louche-section-home` is added to <body> by functions.php and is set only
 * by is_front_page(), so the nav is hidden on first paint before any JS runs
 * and stays visible everywhere else — including search results, which an
 * earlier URL-parsing implementation could misclassify as the homepage.
 */
.louche-section-home .louche-nav {
  display: none;
}


/* ────────────────────────────────────────────────────────────────────────
 * 6. Footer
 * ──────────────────────────────────────────────────────────────────────── */

.louche-footer {
  margin-top: auto;
  padding: 18px 40px 22px;
  background: var(--louche-cream);
  position: relative;
  z-index: 20;
}

.louche-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1180px;
  margin: 0 auto;
}

.louche-footer-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.louche-footer-copy {
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #888;
}

.louche-consent {
  font-family: var(--louche-font-body);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #888;
  background: transparent;
  border: 1px solid #ccc;
  border-radius: 20px;
  padding: 4px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.louche-consent:hover {
  border-color: var(--louche-teal);
  color: var(--louche-teal);
}

.louche-footer-icons {
  display: flex;
  align-items: center;
  gap: 16px;
}

.louche-footer-icons a {
  display: flex;
  color: #999;
  text-decoration: none;
}

.louche-footer-icons a:hover {
  color: var(--louche-teal);
}

.louche-footer-dot {
  width: 5px;
  height: 5px;
  background: var(--louche-teal);
  border-radius: 50%;
}


/* ────────────────────────────────────────────────────────────────────────
 * 7. Bento landing
 *
 * The bento composes three background layers per card, from top to bottom:
 *   1. A directional tint that protects label legibility
 *   2. The card's WebP image (or `none` when no images are installed)
 *   3. A radial gradient that serves as the fallback look
 * The middle layer activates only when functions.php confirms all seven
 * images exist and applies the `has-louche-bento-images` class to <body>.
 * ──────────────────────────────────────────────────────────────────────── */

.louche-main {
  flex: 1;
  width: 100%;
  padding: 0 40px 28px;
}

.louche-main-home {
  display: flex;
  align-items: stretch;
}

.louche-bento {
  display: grid;
  grid-template-columns: 280px 1fr 1fr;
  grid-template-rows: 230px 230px 200px;
  gap: var(--louche-gap);
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.louche-card {
  position: relative;
  border-radius: var(--louche-radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  display: block;
  background-color: var(--louche-cream-dark);
  transition:
    transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.28s ease;
  will-change: transform;
  isolation: isolate;
}

.louche-card:hover {
  transform: translateY(-5px) scale(1.012);
  box-shadow: 0 14px 45px rgba(0, 0, 0, 0.18);
  z-index: 2;
}

.louche-card-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-size: cover;
  background-repeat: no-repeat;
}

.louche-card-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px 22px 20px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 100%);
  pointer-events: none;
  z-index: 2;
}

.louche-card-label h2 {
  font-family: var(--louche-font-display);
  font-weight: 300;
  font-size: 32px;
  color: #fff;
  line-height: 1.1;
  margin: 0;
}

.louche-card-arrow {
  position: absolute;
  bottom: 20px;
  right: 20px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  font-family: var(--louche-font-display);
  pointer-events: none;
  transition: transform 0.25s;
  z-index: 2;
}

.louche-card:hover .louche-card-arrow {
  transform: translateX(3px);
}

.louche-accent {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  border-radius: var(--louche-radius) 0 0 var(--louche-radius);
  pointer-events: none;
  z-index: 2;
}

.louche-accent-teal { background: var(--louche-teal); }
.louche-accent-gold { background: var(--louche-gold); }
.louche-accent-pink { background: var(--louche-pink); }

/* Grid placement (desktop) */
.louche-card-person  { grid-column: 1;     grid-row: 1 / 3; }
.louche-card-work    { grid-column: 2;     grid-row: 1; }
.louche-card-art     { grid-column: 3;     grid-row: 1; }
.louche-card-music   { grid-column: 2;     grid-row: 2; }
.louche-card-musings { grid-column: 3;     grid-row: 2; }
.louche-card-hello   { grid-column: 1 / 3; grid-row: 3; }
.louche-card-legal   { grid-column: 3;     grid-row: 3; border-top: 4px solid var(--louche-teal); }

/* Per-card background layering: tint + image + radial fallback. */
.louche-card-person .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(0, 74, 74, 0.62) 0 36%, rgba(0, 0, 0, 0.18) 36% 100%),
    var(--louche-bento-person-image),
    radial-gradient(ellipse at 40% 30%, #2d5a5a, #0d1f1f);
  background-position: center, 56% 50%, center;
}

.louche-card-work .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(0, 0, 0, 0.68), rgba(0, 0, 0, 0.2)),
    var(--louche-bento-work-image),
    radial-gradient(ellipse at 60% 40%, #2a2a2a, #050505);
  background-position: center, center center, center;
}

.louche-card-art .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(216, 132, 154, 0.28) 0 18%, rgba(255, 246, 240, 0.1) 18% 100%),
    var(--louche-bento-art-image),
    radial-gradient(ellipse at 70% 20%, #e8ddd5, #a09088);
  background-position: center, 62% 40%, center;
}

.louche-card-music .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(2, 8, 16, 0.68), rgba(2, 8, 16, 0.18)),
    var(--louche-bento-music-image),
    radial-gradient(ellipse at 50% 60%, #0a1a3a, #020810);
  background-position: center, 66% 48%, center;
}

.louche-card-musings .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(240, 235, 227, 0.95) 0 48%, rgba(240, 235, 227, 0.28) 70% 100%),
    var(--louche-bento-musings-image),
    linear-gradient(90deg, var(--louche-cream-dark), var(--louche-cream));
  background-position: center, right center, center;
}

.louche-card-hello .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(248, 234, 200, 0.85), rgba(248, 234, 200, 0.2)),
    var(--louche-bento-hello-image),
    radial-gradient(ellipse at 30% 50%, #d4b896, #8a6840);
  background-position: center, center 42%, center;
}

.louche-card-legal .louche-card-bg {
  background-image:
    linear-gradient(90deg, rgba(3, 10, 10, 0.78), rgba(3, 10, 10, 0.24)),
    var(--louche-bento-legal-image),
    radial-gradient(ellipse at 50% 40%, #1a2a2a, #030a0a);
  background-position: center, 62% 50%, center;
}

/* Light-background cards need dark text & arrows. */
.louche-card-art .louche-card-label {
  background: linear-gradient(to top, rgba(200, 185, 175, 0.6), transparent);
}

.louche-card-art .louche-card-label h2,
.louche-card-art .louche-card-arrow,
.louche-card-musings .louche-card-label h2,
.louche-card-musings .louche-card-arrow {
  color: var(--louche-ink);
}

.louche-card-musings .louche-card-label {
  background: none;
  bottom: 22px;
  left: 22px;
  padding: 0;
}

.louche-card-musings .louche-card-label h2 {
  font-size: 30px;
}

/* Inline noise texture lifts the cards above flat gradients. */
.louche-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  pointer-events: none;
  mix-blend-mode: overlay;
  opacity: 0.35;
}

.louche-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 35%, rgba(0, 0, 0, 0.08));
  opacity: 0;
  transition: opacity 0.28s ease;
  z-index: 1;
  pointer-events: none;
}

.louche-card:hover::before {
  opacity: 1;
}

/* Entrance choreography — CSS keyframes serve as fallback before GSAP boots. */
@keyframes louche-fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.louche-card {
  animation: louche-fade-up 0.55s var(--louche-ease-out) both;
}

.louche-card:nth-child(1) { animation-delay: 0.05s; }
.louche-card:nth-child(2) { animation-delay: 0.12s; }
.louche-card:nth-child(3) { animation-delay: 0.18s; }
.louche-card:nth-child(4) { animation-delay: 0.24s; }
.louche-card:nth-child(5) { animation-delay: 0.30s; }
.louche-card:nth-child(6) { animation-delay: 0.36s; }
.louche-card:nth-child(7) { animation-delay: 0.42s; }

/* Bento WebP activation — class set by functions.php when all 7 files exist. */
body.has-louche-bento-images {
  --louche-bento-person-image:  url("../images/bento/person.webp");
  --louche-bento-work-image:    url("../images/bento/work.webp");
  --louche-bento-art-image:     url("../images/bento/art.webp");
  --louche-bento-music-image:   url("../images/bento/music.webp");
  --louche-bento-musings-image: url("../images/bento/musings.webp");
  --louche-bento-hello-image:   url("../images/bento/hello.webp");
  --louche-bento-legal-image:   url("../images/bento/legal.webp");
}


/*
 * Canonical Latin card labels.
 *
 * English on rest, epigraphical Latin on hover and focus. The Latin form is
 * deliberately upright — inscription styling, never italic.
 */

.louche-card-label h2 {
  position: relative;
  min-height: 2.2em;
}

.louche-card-title-en,
.louche-card-title-la {
  display: block;
  transition:
    opacity 0.28s ease,
    transform 0.28s var(--louche-ease-out);
}

.louche-card-title-la {
  position: absolute;
  inset: auto 0 0 0;
  opacity: 0;
  transform: translateY(8px);
  font-style: normal;
  letter-spacing: 0.015em;
  line-height: 0.98;
  pointer-events: none;
}

.louche-card:hover .louche-card-title-en,
.louche-card:focus-visible .louche-card-title-en {
  opacity: 0;
  transform: translateY(-8px);
}

.louche-card:hover .louche-card-title-la,
.louche-card:focus-visible .louche-card-title-la {
  opacity: 1;
  transform: translateY(0);
}

/* The longer inscriptions need a little more room than the short ones. */
.louche-card-person .louche-card-title-la,
.louche-card-work .louche-card-title-la,
.louche-card-art .louche-card-title-la,
.louche-card-music .louche-card-title-la,
.louche-card-legal .louche-card-title-la {
  font-size: 0.72em;
}

.louche-card-musings .louche-card-title-la,
.louche-card-hello .louche-card-title-la {
  font-size: 0.82em;
}


/* ────────────────────────────────────────────────────────────────────────
 * 8. Inner pages — page hero, kicker, entry content
 * ──────────────────────────────────────────────────────────────────────── */

.louche-page-shell {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(48px, 8vw, 96px) 0;
}

.louche-page-hero,
.louche-single-hero {
  position: relative;
  margin-bottom: clamp(28px, 5vw, 52px);
  padding-top: 18px;
}

.louche-page-hero::before,
.louche-single-hero::before {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  background: var(--louche-section-accent);
  border-radius: 99px;
  margin-bottom: 24px;
}

.louche-kicker {
  font-family: var(--louche-font-mark);
  font-size: 10px;
  letter-spacing: 2.3px;
  text-transform: uppercase;
  color: var(--louche-section-accent);
  margin: 0 0 12px;
}

.louche-page-title {
  font-family: var(--louche-font-display);
  font-weight: 300;
  font-size: clamp(3rem, 9vw, 6.8rem);
  letter-spacing: -0.045em;
  line-height: 0.9;
  margin: 0;
  color: var(--louche-ink);
}

.louche-entry-content {
  font-size: clamp(1rem, 1.2vw, 1.13rem);
  line-height: 1.82;
  color: #282828;
}

.louche-entry-content p { margin-block: 0 1.35em; }

.louche-entry-content h2,
.louche-entry-content h3 { margin-top: 1.6em; }

.louche-entry-content a {
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.louche-entry-content img,
.louche-single-image img {
  border-radius: var(--louche-radius);
  box-shadow: var(--louche-shadow);
}

.louche-page-intro {
  max-width: 760px;
  color: #444;
}


/* ────────────────────────────────────────────────────────────────────────
 * 9. Archives & post cards
 * ──────────────────────────────────────────────────────────────────────── */

.louche-work-index .louche-page-shell,
.louche-archive .louche-page-shell {
  max-width: 1180px;
}

.louche-query {
  margin-top: 44px;
}

.louche-archive-grid,
.louche-archive-grid > li,
.wp-block-post-template,
.wp-block-post-template > li {
  list-style: none;
  padding-left: 0;
}

.louche-archive-grid,
.wp-block-post-template {
  display: grid !important;
  grid-template-columns: 1fr;
  gap: clamp(18px, 2.2vw, 28px);
}

.louche-post-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    "image date"
    "image title"
    "image excerpt";
  column-gap: clamp(18px, 2.3vw, 34px);
  row-gap: 6px;
  align-items: stretch;
  min-height: clamp(230px, 24vw, 330px);
  padding: clamp(14px, 1.7vw, 22px);
  border: 1px solid rgba(26, 26, 26, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 14px 50px rgba(26, 26, 26, 0.07);
  transition:
    transform 0.25s ease,
    box-shadow 0.25s ease,
    border-color 0.25s ease;
}

.louche-post-card:hover {
  transform: translateY(-4px);
  border-color: var(--louche-section-accent);
  box-shadow: 0 22px 70px rgba(26, 26, 26, 0.12);
}

.louche-post-card-image {
  grid-area: image;
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  /*
   * <figure> carries a UA default of `margin: 1em 40px`. Relying on a core
   * block stylesheet to zero it made these cards overflow their column on
   * narrow viewports by exactly the leftover margin.
   */
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(26, 26, 26, 0.045);
}

.louche-post-card-image a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.louche-post-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  background: transparent;
  filter: saturate(0.92) contrast(0.99);
  transition: transform 0.4s var(--louche-ease-out);
}

.louche-post-card:hover .louche-post-card-image img {
  transform: scale(1.018);
}

.louche-post-card-date {
  grid-area: date;
  margin-top: 0;
  color: #777;
  font-size: 10px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.louche-post-card-title {
  grid-area: title;
  max-width: none;
  margin: 0.1em 0 0.05em;
  font-family: var(--louche-font-display);
  font-size: clamp(1.85rem, 3vw, 2.85rem);
  letter-spacing: -0.035em;
  line-height: 0.96;
}

.louche-post-card-title a {
  color: var(--louche-ink);
  text-decoration: none;
}

.louche-post-card-title a:hover {
  color: var(--louche-section-accent);
}

.louche-post-card-excerpt,
.louche-post-card-excerpt p {
  grid-area: excerpt;
  max-width: 76ch;
  color: #444;
  font-size: clamp(0.98rem, 1.05vw, 1.08rem);
  line-height: 1.58;
}

.louche-post-card-excerpt .wp-block-post-excerpt__more-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--louche-section-accent);
  font-size: 11px;
  letter-spacing: 1.7px;
  text-decoration: none;
  text-transform: uppercase;
}


.louche-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: clamp(34px, 5vw, 56px);
  font-family: var(--louche-font-mark);
  font-size: 11px;
  letter-spacing: 1.7px;
  text-transform: uppercase;
}

.louche-pagination a,
.louche-pagination .page-numbers {
  color: var(--louche-ink);
  text-decoration: none;
}

.louche-pagination a:hover,
.louche-pagination .current {
  color: var(--louche-section-accent);
}


/* ────────────────────────────────────────────────────────────────────────
 * 10. Single post
 * ──────────────────────────────────────────────────────────────────────── */

.louche-single-shell {
  max-width: 860px;
}

.louche-single-title {
  max-width: 820px;
}

.louche-post-terms,
.louche-post-terms a {
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: #777;
  text-decoration: none;
}

.louche-single-image {
  width: min(100%, 760px);
  margin: 0 auto clamp(34px, 5vw, 54px);
}

.louche-single-image img {
  width: 100%;
  max-height: 520px;
  object-fit: cover;
}

.louche-single-content {
  max-width: 760px;
  margin-inline: auto;
}


/* ────────────────────────────────────────────────────────────────────────
 * 11. 404
 * ──────────────────────────────────────────────────────────────────────── */

.louche-error-shell {
  text-align: center;
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}


/* ────────────────────────────────────────────────────────────────────────
 * 12. Buttons
 * ──────────────────────────────────────────────────────────────────────── */

.louche-button .wp-block-button__link {
  background: var(--louche-ink);
  border-radius: 999px;
  color: var(--louche-cream);
  font-size: 11px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  padding: 12px 22px;
}

.louche-button .wp-block-button__link:hover {
  background: var(--louche-section-accent);
}


/* ────────────────────────────────────────────────────────────────────────
 * 13. Plugin polish
 * ──────────────────────────────────────────────────────────────────────── */

.frm_forms input[type="text"],
.frm_forms input[type="email"],
.frm_forms input[type="url"],
.frm_forms input[type="tel"],
.frm_forms textarea,
.wp-block-search__input,
.search-field {
  border: 1px solid rgba(26, 26, 26, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.34);
  color: var(--louche-ink);
  font-family: var(--louche-font-body);
}

.relevanssi-live-search-results {
  border-color: rgba(26, 26, 26, 0.1);
  border-radius: var(--louche-radius);
  box-shadow: 0 14px 50px rgba(26, 26, 26, 0.07);
}


/* ────────────────────────────────────────────────────────────────────────
 * 14. Responsive
 * ──────────────────────────────────────────────────────────────────────── */

@media (max-width: 980px) {
  .louche-header-inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .louche-nav {
    justify-content: flex-start;
  }

  .louche-bento {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(5, 160px);
  }

  .louche-card-person  { grid-column: 1;     grid-row: 1 / 3; }
  .louche-card-work    { grid-column: 2;     grid-row: 1; }
  .louche-card-art     { grid-column: 2;     grid-row: 2; }
  .louche-card-music   { grid-column: 1;     grid-row: 3; }
  .louche-card-musings { grid-column: 2;     grid-row: 3; }
  .louche-card-hello   { grid-column: 1 / 3; grid-row: 4; }
  .louche-card-legal   { grid-column: 1 / 3; grid-row: 5; }

}

@media (max-width: 640px) {
  /* Stack the two label forms rather than overlaying them on small screens. */
  .louche-card-title-la {
    position: relative;
    inset: auto;
  }

  .louche-card-label h2 {
    min-height: 0;
  }

  .admin-bar .louche-header { top: 0; }

  .louche-header {
    position: relative;
    padding: 22px 20px 12px;
  }

  .louche-header-inner {
    gap: 10px;
  }

  .louche-brand {
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    gap: 10px;
  }

  .louche-logo {
    flex: 0 0 auto;
    min-width: 0;
    margin: -2px -3px;
    padding: 2px 3px;
    font-size: clamp(1.12rem, 5.6vw, 1.42rem);
  }

  .louche-logo-la {
    font-size: 0.72em;
    letter-spacing: 0.04em;
  }

  .louche-tagline {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    min-height: 1.25em;
    font-size: clamp(0.55rem, 2.55vw, 0.72rem);
    line-height: 1.15;
    transform: translateY(0.18em);
  }

  .louche-tagline-en,
  .louche-tagline-la {
    width: auto;
    max-width: 100%;
    white-space: normal;
  }

  .louche-tagline-en {
    display: inline;
  }

  .louche-tagline-en > span {
    display: inline;
    white-space: normal;
  }

  .louche-nav {
    width: 100%;
    flex-wrap: nowrap;
    gap: clamp(7px, 2.5vw, 12px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .louche-nav::-webkit-scrollbar {
    display: none;
  }

  .louche-nav a {
    font-size: clamp(0.44rem, 2.35vw, 0.62rem);
    letter-spacing: clamp(0.06em, 0.45vw, 0.14em);
    white-space: nowrap;
  }

  .louche-nav a.is-active {
    display: none;
  }

  .louche-main { padding: 0 20px 24px; }

  .louche-bento {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(7, 132px);
    gap: 9px;
  }

  .louche-card-person,
  .louche-card-work,
  .louche-card-art,
  .louche-card-music,
  .louche-card-musings,
  .louche-card-hello,
  .louche-card-legal {
    grid-column: 1;
    grid-row: auto;
  }

  .louche-card-label h2 { font-size: 29px; }

  .louche-footer { padding: 18px 20px 24px; }

  .louche-footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .louche-page-shell { padding: 44px 0; }

  .louche-page-title { font-size: clamp(2.7rem, 16vw, 4.6rem); }

  .louche-archive-grid,
  .wp-block-post-template {
    gap: 22px;
  }

  .louche-post-card {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "image"
      "date"
      "title"
      "excerpt";
    min-height: 0;
    padding: 14px;
  }

  .louche-post-card-image {
    height: clamp(190px, 52vw, 320px);
    min-height: 0;
  }

  .louche-post-card-title { font-size: clamp(2rem, 12vw, 3rem); }
}

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

  .louche-card { animation: none !important; }
}
