/* ============================================================
   Irons Sharpen Irons — design system
   Palette: pine, gold, cream, ink
   Type: Newsreader (display serif), IBM Plex Sans, IBM Plex Mono
============================================================ */

:root {
  --pine-900: #0a2a20;
  --pine-800: #0e3b2e;
  --pine-700: #15503e;
  --pine-600: #1d6a52;
  --pine-50:  #e9efe9;

  --gold-600: #a07d2c;
  --gold-500: #c9a24b;
  --gold-400: #d9b768;
  --gold-100: #efe2bd;

  --cream-50: #faf6ec;
  --cream-100: #f4efe3;
  --cream-200: #ece5d2;
  --cream-300: #ddd3b9;

  --ink-900: #14130f;
  --ink-700: #2c2a24;
  --ink-500: #5b574c;
  --ink-400: #837e6f;
  --ink-300: #b8b2a1;

  --bg: var(--cream-100);
  --fg: var(--ink-900);
  --accent: var(--gold-500);
  --pine: var(--pine-800);

  --serif: "Newsreader", "Source Serif Pro", "Iowan Old Style", Georgia, serif;
  --sans:  "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 1240px;
  --gutter: clamp(20px, 4vw, 56px);

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ----- Theme variants (driven by Tweaks) ----- */
body[data-theme="pine"] {
  --bg: var(--pine-800);
  --fg: var(--cream-100);
  --accent: var(--gold-500);
  --surface: var(--pine-900);
  --surface-2: var(--pine-700);
  --rule: rgba(244, 239, 227, 0.16);
}
body[data-theme="cream"] {
  --bg: var(--cream-100);
  --fg: var(--ink-900);
  --accent: var(--pine-800);
  --surface: var(--cream-50);
  --surface-2: var(--cream-200);
  --rule: rgba(20, 19, 15, 0.12);
}
body[data-theme="ivory"] {
  --bg: #f8f4e9;
  --fg: var(--pine-900);
  --accent: var(--gold-600);
  --surface: #fbf8ee;
  --surface-2: #efe9d6;
  --rule: rgba(10, 42, 32, 0.14);
}

/* Density */
body[data-density="airy"]   { --section-y: 140px; --stack: 32px; }
body[data-density="default"]{ --section-y: 104px; --stack: 24px; }
body[data-density="dense"]  { --section-y: 72px;  --stack: 18px; }
body { --section-y: 104px; --stack: 24px; }

/* ===== Type ===== */
.eyebrow {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--accent);
  opacity: 0.7;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(44px, 6.4vw, 96px); }
h2 { font-size: clamp(32px, 4.2vw, 60px); line-height: 1.08; }
h3 { font-size: clamp(22px, 2vw, 30px); line-height: 1.2; }
h4 { font-size: 19px; line-height: 1.25; font-weight: 500; }

p { margin: 0; text-wrap: pretty; }
.lede { font-size: 20px; line-height: 1.55; color: var(--ink-700); max-width: 60ch; }
body[data-theme="pine"] .lede { color: rgba(244, 239, 227, 0.78); }

a { color: inherit; text-decoration: none; }

em.italic { font-family: var(--serif); font-style: italic; }

/* ===== Layout ===== */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
section { padding: var(--section-y) 0; position: relative; }
.rule { height: 1px; background: var(--rule, rgba(20,19,15,0.12)); width: 100%; }

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--rule, rgba(20,19,15,0.08));
}
.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 32px;
  padding: 18px var(--gutter);
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.01em;
}
.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand-name { display: flex; flex-direction: column; line-height: 1; gap: 3px; white-space: nowrap; }
.brand-name b { font-weight: 500; white-space: nowrap; }
.brand-name span {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-500);
  white-space: nowrap;
}
body[data-theme="pine"] .brand-name span { color: var(--gold-400); }

nav.primary {
  display: flex; gap: 26px; justify-self: center;
  font-size: 14px; font-weight: 500;
}
@media (max-width: 1100px) {
  nav.primary { gap: 18px; font-size: 13px; }
  .header-cta .btn-ghost { display: none; }
}
@media (max-width: 980px) {
  .brand-name span { display: none; }
}
nav.primary a {
  position: relative;
  padding: 6px 0;
  color: var(--fg);
  opacity: 0.8;
  transition: opacity .2s;
}
nav.primary a:hover { opacity: 1; }
nav.primary a.active { opacity: 1; }
nav.primary a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--accent);
}

.header-cta { display: flex; gap: 10px; align-items: center; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.005em;
  padding: 13px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s, color .2s, border-color .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(3px); }

.btn-primary {
  background: var(--gold-500);
  color: var(--pine-900);
  border-color: var(--gold-500);
}
.btn-primary:hover { background: var(--gold-400); border-color: var(--gold-400); }

.btn-pine {
  background: var(--pine-800);
  color: var(--cream-100);
  border-color: var(--pine-800);
}
.btn-pine:hover { background: var(--pine-700); border-color: var(--pine-700); }

.btn-outline {
  background: transparent;
  color: var(--fg);
  border-color: color-mix(in srgb, var(--fg) 30%, transparent);
}
.btn-outline:hover { border-color: var(--fg); }

.btn-ghost {
  background: transparent;
  color: var(--fg);
  padding: 13px 6px;
}
.btn-ghost:hover { color: var(--accent); }

.btn-sm { padding: 9px 16px; font-size: 13px; }

/* ===== Footer ===== */
.site-footer {
  background: var(--pine-900);
  color: var(--cream-100);
  padding: 80px 0 36px;
  margin-top: 0;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 56px;
  align-items: start;
}
.footer-grid h5 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin: 0 0 18px;
  font-weight: 500;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: 14px; }
.footer-grid a { opacity: 0.78; }
.footer-grid a:hover { opacity: 1; color: var(--gold-400); }
.footer-mark { display: flex; gap: 14px; align-items: flex-start; }
.footer-mark img { width: 56px; height: 56px; }
.footer-mark p { font-size: 14px; opacity: 0.72; max-width: 32ch; line-height: 1.5; margin-top: 8px; }
.footer-bottom {
  margin-top: 60px; padding-top: 24px;
  border-top: 1px solid rgba(244,239,227,0.12);
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.12em;
  text-transform: uppercase; opacity: 0.6;
}

/* ===== Reusable bits ===== */
.tag-row { display: flex; gap: 10px; flex-wrap: wrap; }
.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 6px 12px;
  border: 1px solid var(--rule, rgba(20,19,15,0.18));
  border-radius: 999px;
  color: var(--ink-500);
}
body[data-theme="pine"] .tag { color: var(--gold-100); border-color: rgba(244,239,227,0.22); }

.placeholder {
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(20,19,15,0.04) 12px 13px),
    var(--surface-2, #ece5d2);
  border: 1px solid var(--rule, rgba(20,19,15,0.12));
  display: grid;
  place-items: center;
  color: var(--ink-500);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  border-radius: var(--r-md);
  position: relative;
  overflow: hidden;
}
.placeholder::after {
  content: ""; position: absolute; inset: 14px;
  border: 1px dashed rgba(20,19,15,0.18);
  border-radius: 4px;
  pointer-events: none;
}
body[data-theme="pine"] .placeholder {
  background:
    repeating-linear-gradient(135deg, transparent 0 12px, rgba(244,239,227,0.04) 12px 13px),
    var(--pine-700);
  color: var(--gold-100);
  border-color: rgba(244,239,227,0.16);
}
body[data-theme="pine"] .placeholder::after { border-color: rgba(244,239,227,0.18); }
.placeholder span { position: relative; z-index: 2; padding: 10px 16px; }

/* Animated stripe */
.stripe-fill {
  background: repeating-linear-gradient(
    -45deg,
    var(--gold-500) 0 8px,
    var(--gold-400) 8px 16px
  );
}

/* Number / stat */
.stat {
  display: grid; gap: 6px;
}
.stat .num {
  font-family: var(--serif);
  font-size: clamp(48px, 5.6vw, 84px);
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat .num sup {
  font-size: 0.4em;
  vertical-align: top;
  margin-left: 4px;
  font-family: var(--mono);
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.stat .label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-500);
}
body[data-theme="pine"] .stat .label { color: var(--gold-100); opacity: 0.7; }

/* Card */
.card {
  background: var(--surface, var(--cream-50));
  border: 1px solid var(--rule, rgba(20,19,15,0.10));
  border-radius: var(--r-lg);
  padding: 28px;
  display: grid;
  gap: 18px;
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 18px 40px -28px rgba(20,19,15,0.25);
}

/* Form */
.field { display: grid; gap: 6px; }
.field label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.field input, .field textarea, .field select {
  font-family: var(--sans);
  font-size: 15px;
  padding: 13px 14px;
  border: 1px solid var(--rule, rgba(20,19,15,0.18));
  border-radius: var(--r-md);
  background: var(--surface, var(--cream-50));
  color: var(--fg);
  outline: none;
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent); }

/* Section header pattern */
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 56px;
  max-width: 720px;
}
.section-head.split {
  grid-template-columns: 1fr 1fr;
  max-width: none;
  align-items: end;
  gap: 56px;
}
.section-head.split .right { justify-self: end; max-width: 44ch; color: var(--ink-500); }
body[data-theme="pine"] .section-head.split .right { color: rgba(244,239,227,0.7); }

/* Diamond ornament — borrowed from logo */
.diamond-rule {
  display: flex; align-items: center; gap: 14px;
  color: var(--accent);
  font-size: 0;
}
.diamond-rule::before, .diamond-rule::after {
  content: ""; flex: 1; height: 1px; background: var(--accent); opacity: 0.5;
}
.diamond-rule i {
  display: inline-block; width: 8px; height: 8px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* Page intro hero (sub-pages) */
.page-hero {
  padding: 88px 0 64px;
  border-bottom: 1px solid var(--rule, rgba(20,19,15,0.10));
}
.page-hero .crumbs {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 18px;
}
body[data-theme="pine"] .page-hero .crumbs { color: var(--gold-400); }

/* Helpers */
.flex { display: flex; }
.grid { display: grid; }
.gap-sm { gap: 12px; }
.gap-md { gap: 20px; }
.gap-lg { gap: 32px; }
.center { text-align: center; }
.fg-mute { color: var(--ink-500); }
body[data-theme="pine"] .fg-mute { color: rgba(244,239,227,0.72); }

/* Utility for sticky donate strip */
.donate-strip {
  background: var(--pine-800);
  color: var(--cream-100);
  padding: 18px var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid rgba(244,239,227,0.1);
  border-bottom: 1px solid rgba(244,239,227,0.1);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.donate-strip strong {
  font-family: var(--serif);
  font-size: 18px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--gold-400);
  font-weight: 400;
}

/* Marquee ticker */
.ticker {
  border-top: 1px solid var(--rule, rgba(20,19,15,0.10));
  border-bottom: 1px solid var(--rule, rgba(20,19,15,0.10));
  padding: 18px 0;
  overflow: hidden;
  background: var(--surface, var(--cream-50));
  font-family: var(--serif);
  font-size: 26px;
  font-style: italic;
  color: var(--ink-700);
}
body[data-theme="pine"] .ticker { color: var(--cream-100); background: var(--pine-900); }
.ticker-track {
  display: flex; gap: 60px;
  animation: ticker 38s linear infinite;
  width: max-content;
}
.ticker-track span { display: inline-flex; align-items: center; gap: 60px; }
.ticker-track i {
  display: inline-block; width: 8px; height: 8px;
  background: var(--accent); transform: rotate(45deg);
  font-style: normal;
}
@keyframes ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Mobile */
@media (max-width: 880px) {
  nav.primary { display: none; }
  .header-cta { display: none; }
  .hamburger { display: flex !important; }
  .header-inner { grid-template-columns: 1fr auto; }

  .mobile-nav {
    display: flex; flex-direction: column; gap: 0;
    background: var(--cream-100, #faf7ef);
    border-top: 1px solid var(--rule, rgba(20,19,15,0.12));
    padding: 8px 20px 16px;
  }
  .mobile-nav a {
    padding: 14px 0;
    border-bottom: 1px solid var(--rule, rgba(20,19,15,0.08));
    font-family: var(--serif); font-size: 20px;
    color: var(--ink-900); text-decoration: none;
  }
  .mobile-nav a.active { color: var(--accent); }
  .mobile-nav a:last-of-type { border-bottom: none; }

  /* Show mobile hero image */
  .mobile-hero-img { display: block !important; }

  /* Nav z-index fix */
  .site-header { position: sticky; top: 0; z-index: 100; }
  .mobile-nav { position: relative; z-index: 99; background: var(--cream-100, #faf7ef); }

  /* Stack all two-column grids */
  .mobile-stack {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }

  /* Un-sticky all sticky columns */
  .mobile-stack > aside,
  .mobile-stack > div { position: static !important; }

  /* Hide hero image collage */
  .mobile-hide { display: none !important; }

  /* Program card image strip */
  .mobile-program-img {
    height: 260px !important;
    border-right: none !important;
    border-bottom: 1px solid var(--rule, rgba(20,19,15,0.10)) !important;
  }
  .mobile-program-img img {
    width: 100% !important; height: 100% !important; object-fit: cover !important;
  }

  /* Programs page article image */
  article.mobile-stack > div:first-child {
    aspect-ratio: 3/2 !important;
    height: auto !important;
    position: static !important;
  }
  article.mobile-stack > div:first-child img {
    width: 100% !important; height: 100% !important; object-fit: cover !important;
  }

  /* Events image */
  .mobile-stack div[style*="border-radius"][style*="overflow"] {
    aspect-ratio: 16/9 !important;
    width: 100% !important;
  }

  /* Three-col grids */
  .cards-3 { grid-template-columns: 1fr !important; }

  /* Newsletter card: fix padding and iframe on mobile */
  .mobile-stack[style*="padding: \"64px\""],
  .mobile-stack[style*="padding"] {
    padding: 28px !important;
  }
  .mobile-stack div[style*="height: 260"] {
    height: 320px !important;
  }

  /* Footer */
  .footer-grid { grid-template-columns: 1fr !important; gap: 32px !important; }
  .footer-bottom { flex-direction: column !important; gap: 8px !important; text-align: center !important; }
  .section-head.split { grid-template-columns: 1fr !important; }
  .section-head.split .right { justify-self: start !important; }

  /* Typography */
  h1 { font-size: clamp(36px, 10vw, 56px) !important; }
  h2 { font-size: clamp(28px, 7vw, 44px) !important; }
  .lede { font-size: 17px !important; }
  .wrap { padding-left: 20px !important; padding-right: 20px !important; }
  section { padding-top: 52px !important; padding-bottom: 52px !important; }
  .page-hero { padding-top: 40px !important; padding-bottom: 28px !important; }

  /* Newsletter iframe */
  .newsletter-iframe-wrap { height: 380px !important; min-height: 380px !important; }
  .newsletter-iframe-wrap iframe { height: 100% !important; }

  /* Zeffy donate iframe */
  .zeffy-donate-iframe { height: 820px !important; }

  /* Remove old selector */
  iframe[title="Donate via Zeffy"] { height: 820px !important; }
}
