/* ============================================================
   base.css — reset, typography, layout, bento grid, utilities
   Editorial Luxury Bento: warm ivory, thin keylines, paper grain.
   ============================================================ */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-variant-numeric: tabular-nums;
  position: relative;
  min-height: 100vh;
}
/* Subtle paper grain over the ivory ground */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(155,106,47,0.05), transparent 60%),
    radial-gradient(100% 60% at 50% 120%, rgba(31,77,69,0.04), transparent 60%);
}
body::after {
  content: "";
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.09  0 0 0 0 0.07  0 0 0 0.04 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}
body > * { position: relative; z-index: 1; }

img, svg, video { display: block; max-width: 100%; height: auto; }
img { font-style: italic; background: var(--surface-sunk); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: var(--focus); outline-offset: var(--focus-offset); border-radius: 2px; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: 12px; top: 12px; z-index: 200;
  background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 600;
  transform: translateY(-150%); transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translateY(0); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0;
  line-height: var(--lh-tight);
  letter-spacing: var(--track-tight);
  font-weight: 500;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); line-height: var(--lh-snug); }
h3 { font-size: var(--fs-h3); line-height: 1.3; }
h1 em, h2 em { font-style: italic; color: var(--accent-ink); font-weight: 400; }
p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }
.lead { font-size: 1.18rem; color: var(--text-muted); line-height: 1.55; }
.prose p { margin-bottom: 1.1em; }
.prose { max-width: 68ch; }
.measure { max-width: 760px; }

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-cap);
  text-transform: uppercase;
  letter-spacing: var(--track-cap);
  color: var(--accent-ink);
  font-weight: 600;
  display: inline-flex; align-items: center; gap: 8px;
}
.eyebrow::before {
  content: ""; display: inline-block; width: 22px; height: 1px;
  background: linear-gradient(to right, transparent, var(--accent));
}
.eyebrow.bare::before { display: none; }
.eyebrow.green { color: var(--green-ink); }
.eyebrow.green::before { background: linear-gradient(to right, transparent, var(--green)); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.ink { color: var(--ink); }

a.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
  transition: color var(--dur) var(--ease);
}
a.link:hover { color: var(--accent-bright); }

/* ---------- Layout ---------- */
.container { width: var(--maxw); margin-inline: auto; padding-inline: 16px; }
.container.narrow { width: var(--maxw-narrow); }
.section { padding-block: var(--s-8); }
.section.tight { padding-block: var(--s-7); }
.section + .section { padding-top: 0; }
.section-head { max-width: 62ch; margin-bottom: var(--s-6); }
.section-head .eyebrow { display: inline-flex; margin-bottom: 12px; }
.section-head h2 { margin-bottom: 12px; }
.section-head p { color: var(--text-muted); font-size: 1.05rem; }
.section-head.deco h2 { padding-bottom: 14px; border-bottom: 1px solid var(--border); position: relative; }
.section-head.deco h2::after {
  content: ""; position: absolute; left: 0; bottom: -3px; height: 1px; width: 38%;
  background: linear-gradient(to right, var(--accent), transparent);
}

/* ---------- Bento grid ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  grid-auto-rows: minmax(120px, auto);
  gap: var(--gap);
}
.bento.tight { gap: var(--gap-tight); }
.bento > * { grid-column: span 12; }

/* Mobile-first: everything stacks full-width.
   Tablet (>=720px): introduce spans. Desktop (>=1024px): full bento. */
@media (min-width: 720px) {
  .bento > .b-span-3  { grid-column: span 3; }
  .bento > .b-span-4  { grid-column: span 4; }
  .bento > .b-span-5  { grid-column: span 5; }
  .bento > .b-span-6  { grid-column: span 6; }
  .bento > .b-span-7  { grid-column: span 7; }
  .bento > .b-span-8  { grid-column: span 8; }
  .bento > .b-span-9  { grid-column: span 9; }
  .bento > .b-span-12 { grid-column: span 12; }
  .bento > .b-row-2 { grid-row: span 2; }
  .bento > .b-row-3 { grid-row: span 3; }
}
@media (min-width: 1024px) {
  .bento > .b-lg-3  { grid-column: span 3; }
  .bento > .b-lg-4  { grid-column: span 4; }
  .bento > .b-lg-5  { grid-column: span 5; }
  .bento > .b-lg-6  { grid-column: span 6; }
  .bento > .b-lg-7  { grid-column: span 7; }
  .bento > .b-lg-8  { grid-column: span 8; }
  .bento > .b-lg-9  { grid-column: span 9; }
  .bento > .b-lg-12 { grid-column: span 12; }
}

/* ---------- Card / tile base ---------- */
.tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
  overflow: hidden;
}
.tile.sunk { background: var(--surface-sunk); }
.tile.tint { background: var(--surface-2); }
.tile.flat { box-shadow: none; }
.tile.dark { background: var(--ink); color: var(--bg); border-color: transparent; }
.tile.dark h2, .tile.dark h3 { color: var(--bg); }
.tile.green { background: var(--green); color: var(--on-green); border-color: transparent; }
.tile.green h2, .tile.green h3 { color: var(--on-green); }
.tile.gold { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.tile.gold h2, .tile.gold h3 { color: var(--on-accent); }
.tile.pad-6 { padding: var(--s-6); }
.tile.pad-4 { padding: var(--s-4); }
.tile.raised:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); border-color: var(--accent-line); }
.tile .tile-img { margin: calc(var(--s-5) * -1) calc(var(--s-5) * -1) 0; width: calc(100% + var(--s-5) * 2); }
.tile.pad-6 .tile-img { margin: calc(var(--s-6) * -1) calc(var(--s-6) * -1) 0; width: calc(100% + var(--s-6) * 2); }
.tile .tile-img img { width: 100%; height: 100%; object-fit: cover; }
.tile .tile-img { height: 200px; }
.tile.tall .tile-img { height: 280px; }
.tile.xtall .tile-img { height: 360px; }

/* ---------- Pills / chips ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: var(--r-pill);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  font-size: var(--fs-sm); font-weight: 600; color: var(--ink);
}
.pill.gold { border-color: var(--accent-line); background: var(--accent-tint); color: var(--accent-ink); }
.pill.green { border-color: var(--green-line); background: var(--green-tint); color: var(--green-ink); }
.pill.ghost { background: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: var(--fs-sm); color: var(--text); font-weight: 500;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 600; line-height: 1;
  border: 1px solid transparent;
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { background: #2c2c2c; }
.btn-gold { background: var(--accent); color: var(--on-accent); }
.btn-gold:hover { background: var(--accent-bright); box-shadow: 0 6px 18px rgba(155,106,47,0.22); }
.btn-green { background: var(--green); color: var(--on-green); }
.btn-green:hover { background: #2a5f55; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border-strong); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-ink); }
.btn-block { display: flex; width: 100%; }

/* ---------- Helpers ---------- */
.stack > * + * { margin-top: var(--s-4); }
.stack-3 > * + * { margin-top: var(--s-3); }
.stack-6 > * + * { margin-top: var(--s-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--rule); border: 0; margin-block: var(--s-6); }
.deco-rule { display: flex; align-items: center; gap: 14px; margin-block: var(--s-6); color: var(--accent-line); }
.deco-rule::before, .deco-rule::after { content: ""; height: 1px; flex: 1; background: linear-gradient(to right, transparent, var(--accent-line), transparent); }
.deco-rule .diamond { width: 7px; height: 7px; background: var(--accent); transform: rotate(45deg); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
}
