/*
Theme Name: Meridian
Theme URI: https://example.ca
Author: —
Description: Clinical, restrained storefront theme for regulated botanical retail. Built for WooCommerce. Copy and layout observe Cannabis Act promotion restrictions: no lifestyle imagery, no testimonials, no health claims.
Version: 0.1.0
Requires at least: 6.4
Tested up to: 6.7
Requires PHP: 8.1
License: GPL v2 or later
Text Domain: meridian
*/

/* ==========================================================================
   Design tokens — ported from the Next.js mockup
   ========================================================================== */

:root {
  --paper:       #fbfaf8;
  --paper-2:     #f4f2ee;
  --ink:         #16181a;
  --muted:       #6e7276;
  --line:        #e4e1db;
  --line-strong: #d3cfc7;
  --accent:      #1e3b31;
  --accent-soft: #eef1ed;

  --font-sans:  "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-serif: "Newsreader", ui-serif, Georgia, serif;

  --wrap: 72rem;
  --gutter: 1.5rem;
}

@media (min-width: 640px) {
  :root { --gutter: 2.5rem; }
}

/* ==========================================================================
   Base
   ========================================================================== */

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

::selection { background: var(--accent); color: var(--paper); }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
}

p { margin: 0 0 1rem; }

/* ==========================================================================
   Utilities
   ========================================================================== */

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-size: 0.6875rem;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
}

.muted  { color: var(--muted); }
.accent { color: var(--accent); }
.rule   { border-top: 1px solid var(--line); }
.tabular { font-variant-numeric: tabular-nums; }

.btn {
  display: inline-block;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  padding: 1rem 2rem;
  font-family: inherit;
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}
.btn:hover { background: var(--accent); color: var(--paper); }
.btn:disabled { background: var(--line-strong); cursor: not-allowed; }

.link-rule {
  display: inline-block;
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 0.5rem;
  transition: border-color 0.2s, color 0.2s;
}
.link-rule:hover { border-color: var(--accent); color: var(--accent); }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.rise { animation: riseIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  height: 5rem;
}

.brand { display: flex; flex-direction: column; line-height: 1; }
.brand__name { font-family: var(--font-serif); font-size: 1.25rem; letter-spacing: -0.02em; }
.brand__tag  { margin-top: 0.375rem; font-size: 0.5625rem; letter-spacing: 0.16em;
               text-transform: uppercase; font-weight: 500; color: var(--muted); }

.nav { display: none; }
.nav ul { display: flex; gap: 2.25rem; align-items: center; list-style: none; margin: 0; padding: 0; }
.nav a { color: var(--muted); transition: color 0.2s; }
.nav a:hover, .nav a.is-active { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 1.25rem; }
.cart-link .count { margin-left: 0.375rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.nav-toggle { background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); font-family: inherit; }

.nav-mobile { border-top: 1px solid var(--line); padding: 1.25rem 0; }
.nav-mobile ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.nav-mobile a { color: var(--muted); }

@media (min-width: 768px) {
  .nav { display: flex; }
  .nav-toggle, .nav-mobile { display: none; }
}

/* ==========================================================================
   Page furniture
   ========================================================================== */

.page-head { border-bottom: 1px solid var(--line); }
.page-head .wrap { padding-block: 5rem; }
.page-head h1 { font-size: clamp(2.5rem, 6vw, 3.75rem); margin-top: 1.5rem; }
.page-head .intro { margin-top: 2rem; max-width: 42rem; font-size: 0.875rem; color: var(--muted); }

.section { padding-block: 5rem; }

.notice-band { border-top: 1px solid var(--line); background: var(--paper-2); }
.notice-band .wrap { padding-block: 3.5rem; }
.notice-band p { margin-top: 1rem; max-width: 42rem; font-size: 0.875rem; color: var(--muted); }

/* ==========================================================================
   Landing page
   ========================================================================== */

.hero { border-bottom: 1px solid var(--line); }
.hero .wrap { padding-block: 6rem; }
.hero h1 { max-width: 48rem; margin-top: 2rem; font-size: clamp(3rem, 8vw, 4.5rem); line-height: 1.02; }
.hero__intro { max-width: 36rem; margin-top: 2.5rem; line-height: 1.7; }
.hero__links { display: flex; flex-wrap: wrap; gap: 2rem; margin-top: 3rem; }

@media (min-width: 640px) { .hero .wrap { padding-block: 9rem; } }

.standards { border-bottom: 1px solid var(--line); background: var(--paper-2); }
.standards .wrap { display: grid; gap: 3rem; padding-block: 4rem; }
.standards p.muted { margin-top: 1rem; font-size: 0.875rem; line-height: 1.7; }
@media (min-width: 640px) { .standards .wrap { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.catalogue-row { border-bottom: 1px solid var(--line); }
.catalogue-row .wrap { padding-block: 6rem; }
.catalogue-row__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.5rem; }
.catalogue-row__head > div { max-width: 32rem; }
.catalogue-row__head h2 { margin-top: 1.25rem; font-size: clamp(2.25rem, 5vw, 3rem); }
.catalogue-row__empty { margin-top: 3rem; font-size: 0.875rem; }

.closing .wrap { padding-block: 6rem; }
.closing .wrap > * { max-width: 42rem; }
.closing h2 { margin-top: 1.25rem; font-size: clamp(1.875rem, 4vw, 2.25rem); line-height: 1.2; }
.closing p.muted { margin-top: 2rem; font-size: 0.875rem; line-height: 1.7; }
.closing .link-rule { margin-top: 2.5rem; }

/* ==========================================================================
   Product grid + card
   ========================================================================== */

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 1.5rem;
  row-gap: 4rem;
  list-style: none;
  margin: 3.5rem 0 0;
  padding: 0;
}

@media (min-width: 1024px) {
  .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .product-grid.is-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.card__media {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--paper-2);
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }

/* Placeholder standing in for photography, matching the mockup. */

.card__format {
  position: absolute; left: 1.25rem; top: 1.25rem;
  color: rgba(255,255,255,0.45);
}

.card__flag {
  position: absolute; left: 1.25rem; bottom: 1.25rem;
  background: var(--paper); color: var(--ink);
  padding: 0.5rem 0.75rem;
}

.card__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-top: 1.25rem;
}
.card__title { font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.35; letter-spacing: -0.02em; }
.card:hover .card__title { color: var(--accent); }
.card__price { font-size: 0.875rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.card__meta { margin-top: 0.375rem; font-size: 0.75rem; color: var(--muted); }

/* ==========================================================================
   Single product
   ========================================================================== */

.product-layout { display: grid; gap: 3.5rem; padding-block: 3rem; }

@media (min-width: 1024px) {
  .product-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5rem; }
}

.product-summary h1 { font-size: clamp(2rem, 4vw, 3rem); margin-top: 1.25rem; }
.product-summary .price { margin-top: 1.5rem; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.product-summary .description { margin-top: 2rem; max-width: 28rem; font-size: 0.875rem; color: var(--muted); }

.spec-table { margin-top: 3.5rem; border-top: 1px solid var(--line); }
.spec-row {
  display: flex; justify-content: space-between; gap: 1.5rem;
  border-bottom: 1px solid var(--line); padding-block: 1rem;
}
.spec-row dt { color: var(--muted); }
.spec-row dd { margin: 0; font-size: 0.875rem; font-variant-numeric: tabular-nums; }

.product-notice { margin-top: 2.5rem; background: var(--accent-soft); padding: 1.5rem; }
.product-notice p { margin: 0.75rem 0 0; font-size: 0.75rem; line-height: 1.7; color: rgba(22,24,26,0.7); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { margin-top: 8rem; border-top: 1px solid var(--line); }
.site-footer .wrap { padding-block: 4rem; }

.footer-cols { display: grid; gap: 3rem; }
@media (min-width: 640px) { .footer-cols { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .footer-cols { grid-template-columns: repeat(3, 1fr); } }

.footer-cols ul { list-style: none; margin: 1.25rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.footer-cols a { font-size: 0.875rem; color: rgba(22,24,26,0.8); }

.footer-legal { margin-top: 4rem; border-top: 1px solid var(--line); padding-top: 2rem; }
.footer-legal p { max-width: 48rem; font-size: 0.75rem; line-height: 1.7; color: var(--muted); }

/* ==========================================================================
   WooCommerce structural overrides
   Achieved with CSS rather than template overrides so they survive Woo updates.
   ========================================================================== */

.woocommerce-notices-wrapper:empty { display: none; }

/* Single product: Woo already outputs images and .summary as siblings inside
   div.product, so a grid here gives the two-column layout with no override. */
.single-product div.product {
  display: grid;
  gap: 3.5rem;
  padding-block: 3rem;
}

@media (min-width: 1024px) {
  .single-product div.product {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5rem;
    align-items: start;
  }
}

/* Anything after the summary (related products, notices) spans both columns. */
.single-product div.product > .related,
.single-product div.product > .up-sells,
.single-product div.product > .woocommerce-tabs { grid-column: 1 / -1; }

.single-product div.product .summary { margin: 0; }

/* Woo floats these at width:48% — the grid already handles the columns. */
.woocommerce.single-product div.product div.images,
.woocommerce.single-product div.product div.summary { float: none; width: auto; margin-bottom: 0; }
.single-product .woocommerce-product-gallery { position: relative; }

/* Products with no photography yet fall back to the mockup's gradient panels.
   The tint is chosen per section on Products → Categories. */
.woocommerce-product-gallery__image--placeholder { aspect-ratio: 4 / 5; width: 100%; }
.woocommerce div.product div.images .woocommerce-product-gallery__image--placeholder img { display: none; }

.card__media--placeholder,
.woocommerce-product-gallery__image--placeholder { background: linear-gradient(155deg, var(--tint-a, #3c4a4e), var(--tint-b, #171d1f)); }

.tint-pine     { --tint-a: #2f4238; --tint-b: #141a16; }
.tint-slate    { --tint-a: #3e4552; --tint-b: #171a20; }
.tint-umber    { --tint-a: #57503f; --tint-b: #201d17; }
.tint-clay     { --tint-a: #5a443d; --tint-b: #211814; }
.tint-graphite { --tint-a: #3c4a4e; --tint-b: #171d1f; }

/* Quantity + add-to-cart row */
.single-product form.cart {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.single-product form.cart .quantity { display: flex; align-items: center; border: 1px solid var(--line-strong); }
.single-product form.cart .quantity input {
  width: 3.5rem; border: 0; background: transparent; text-align: center;
  font-family: inherit; font-size: 0.875rem; padding: 1rem 0;
}

.single-product form.cart button[type="submit"] {
  flex: 1;
  background: var(--ink); color: var(--paper); border: 0;
  padding: 1rem 2rem; cursor: pointer;
  font-family: inherit; font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.16em; text-transform: uppercase;
  transition: background-color 0.2s;
}
.single-product form.cart button[type="submit"]:hover { background: var(--accent); }

.product-grid { list-style: none; }

/* Order confirmation: offline payment instructions (Meridian Site plugin) */
.payment-instructions { margin: 2.5rem 0; padding: 1.5rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--accent-soft); }
.payment-instructions h2 { margin-bottom: 1rem; font-size: 1.5rem; }
.payment-instructions p { max-width: 40rem; font-size: 0.9375rem; }
.payment-details { margin: 1rem 0 0; padding: 1rem; background: var(--paper); border: 1px solid var(--line); font-size: 0.8125rem; white-space: pre-wrap; word-break: break-all; }

/* Page content written in the editor */
.entry > * + * { margin-top: 1rem; }
.entry h2 { margin-top: 3rem; font-size: 1.875rem; }
.entry h3 { margin-top: 2rem; font-size: 1.25rem; }
.entry h2 + h3 { margin-top: 1.25rem; }
.entry p { margin-bottom: 0; line-height: 1.7; color: var(--muted); }
.entry .wp-block-table { margin-inline: 0; }
.entry table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.entry th, .entry td { padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; }
.entry thead th { border-bottom: 2px solid var(--line-strong); font-weight: 600; }
