/*
Theme Name: Institute
Theme URI: https://israelinstitute.regent.edu
Author: Israel Institute, Robertson School of Government
Description: WordPress theme for the Israel Institute at Regent University. Built on the Regent brand system with a gold accent reserved for Institute moments.
Version: 0.1.1
Requires at least: 6.4
Requires PHP: 8.1
License: Proprietary
Text Domain: israel-institute
*/

/* ============================================================
   1. TOKENS
   Brand colors are re-declared by inc/customizer.php in wp_head,
   so Customizer values override these defaults at runtime.
   ============================================================ */

:root {
  --regent-blue: #002F6C;
  --regent-green: #00833F;
  --regent-gold: #C4B684;
  --white: #FFFFFF;

  /* Derived ramp. These are computed from the three brand colors
     above, so a Customizer change carries through to hover states,
     the footer, and the pull-quote glyph instead of leaving them
     on the old hue. color-mix also keeps the Customizer's live
     preview working, which a PHP-computed value would not.
     Fallbacks below for anything predating color-mix. */
  --blue-900:  color-mix(in srgb, var(--regent-blue) 72%, #000);
  --blue-700:  color-mix(in srgb, var(--regent-blue) 82%, #fff);
  --blue-100:  color-mix(in srgb, var(--regent-blue) 14%, #fff);
  --blue-50:   color-mix(in srgb, var(--regent-blue) 7%,  #fff);

  --green-800: color-mix(in srgb, var(--regent-green) 78%, #000);
  --green-100: color-mix(in srgb, var(--regent-green) 16%, #fff);

  --gold-700:  color-mix(in srgb, var(--regent-gold) 76%, #000);
  --gold-500:  var(--regent-gold);
  --gold-200:  color-mix(in srgb, var(--regent-gold) 45%, #fff);

  --ink: #1A2330;
  --neutral-800: #33404F;
  --neutral-600: #5A6675;
  --neutral-400: #9099A6;
  --neutral-300: #C2C9D2;
  --neutral-200: #E2E6EC;
  --neutral-100: #F1F3F6;
  --paper: #FBFBF9;

  --surface: var(--white);
  --border: var(--neutral-200);
  --border-strong: var(--neutral-300);
  --fg2: var(--neutral-600);
  --link: var(--blue-700);

  /* Error red. FIXED, not Customizer-exposed: tied to the
     light-ground forms rule. 7.87:1 on paper, 8.15:1 on white,
     1.59:1 on navy. Forms never sit on navy grounds. */
  --error: #9B1C1C;
  --error-bg: #FDF2F2;

  --serif-display: "Libre Caslon Display", "Adobe Caslon Pro", "Libre Caslon Text", Georgia, serif;
  --serif-text: "Libre Caslon Text", "Adobe Caslon Pro", Georgia, serif;
  --sans: "Source Sans 3", "Source Sans Pro", -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;

  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;

  --wide: min(1200px, 100%);
  --editorial: min(1000px, 100%);
  --measure: min(720px, 100%);
}

/* Fallback: static ramp for browsers without color-mix support.
   These match the Regent defaults; they will not track Customizer
   changes, but nothing renders unstyled. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {
  :root {
    --blue-900: #00204A;
    --blue-700: #0A3F86;
    --blue-100: #DCE6F2;
    --blue-50:  #EEF3F9;
    --green-800: #00632F;
    --green-100: #D6ECDD;
    --gold-700: #9A8A4F;
    --gold-200: #EAE3CE;
  }
}

/* ============================================================
   2. GLOBALS
   ============================================================ */

html, body { margin: 0; padding: 0; background: var(--paper); }
* { box-sizing: border-box; }

body {
  font-family: var(--sans);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--blue-900); text-decoration: underline; }

button {
  font: inherit; color: inherit; background: none; border: 0;
  margin: 0; padding: 0; text-align: inherit; cursor: pointer;
}

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

.wide      { width: var(--wide);      margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.editorial { width: var(--editorial); margin: 0 auto; padding-left: 24px; padding-right: 24px; }
.measure   { width: var(--measure);   margin: 0 auto; padding-left: 24px; padding-right: 24px; }

.eyebrow {
  font-size: 15px; letter-spacing: 0.17em; text-transform: uppercase;
  font-weight: 600; color: var(--regent-green);
}
.eyebrow-gold { color: var(--regent-gold); }  /* navy grounds only */

/* ============================================================
   3. ACCESSIBILITY
   Dual-tone focus ring: 2px white inside a 4px navy ring.
   Clears 3:1 on both paper and navy from one rule.
   ============================================================ */

:focus-visible {
  outline: 2px solid #FFFFFF;
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--regent-blue);
  border-radius: 3px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 60;
  background: var(--regent-blue); color: #FFFFFF;
  padding: 14px 22px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; font-size: 14px;
}
.skip-link:focus { left: 12px; top: 12px; color: #FFFFFF; text-decoration: none; }

.screen-reader-text {
  border: 0; clip-path: inset(50%); height: 1px; overflow: hidden;
  position: absolute; white-space: nowrap; width: 1px;
}

/* ============================================================
   4. HEADER / LOCKUP / NAV
   ============================================================ */

.utility { background: var(--blue-900); color: #C7D3E4; font-size: 14px; }
.utility a { color: #C7D3E4; }
.utility-inner {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 20px; flex-wrap: wrap; padding-top: 9px; padding-bottom: 9px;
}

.masthead {
  background: var(--white); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.masthead-inner {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px;
}

/* Lockup never wraps; shield and wordmark scale together. */
.lockup {
  display: flex; align-items: center; gap: clamp(12px, 3vw, 20px);
  flex-wrap: nowrap; min-width: 0; padding: 4px 0;
}
.lockup:hover { text-decoration: none; }
.lockup img { height: clamp(42px, 9vw, 58px); width: auto; display: block; flex: 0 0 auto; }
.lockup-text { border-left: 1px solid var(--border-strong); padding-left: clamp(12px, 3vw, 20px); min-width: 0; }
.lockup-name {
  font-family: var(--serif-display); font-size: clamp(21px, 4.6vw, 31px);
  line-height: 1; color: var(--regent-blue);
}
.lockup-sub {
  font-size: clamp(10.5px, 1.8vw, 12.5px); letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--neutral-600); margin-top: 8px;
}

.nav-wide { display: flex; align-items: center; gap: 2px; margin-left: auto; min-width: 0; }
.nav-wide a {
  display: block; position: relative; padding: 15px 10px;
  font-size: 14.5px; letter-spacing: 0.09em; text-transform: uppercase;
  font-weight: 600; color: var(--neutral-800);
}
.nav-wide a:hover { color: var(--regent-blue); text-decoration: none; }
.nav-wide a[aria-current="page"] { color: var(--regent-blue); }
.nav-wide a[aria-current="page"]::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0;
  height: 3px; background: var(--regent-green);
}

.btn-give {
  background: var(--regent-green); color: #fff; padding: 12px 22px;
  border-radius: var(--radius-md); font-size: 14.5px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap;
}
.btn-give:hover { background: var(--green-800); color: #fff; text-decoration: none; }

.menu-toggle {
  margin-left: auto; border: 1px solid var(--border-strong);
  border-radius: var(--radius-md); padding: 11px 16px;
  display: none; align-items: center; gap: 10px; min-height: 46px;
}
.menu-toggle span.bars { display: flex; flex-direction: column; gap: 4px; }
.menu-toggle span.bars i { width: 20px; height: 2px; background: var(--regent-blue); display: block; }
.menu-toggle span.label {
  font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; color: var(--regent-blue);
}

.menu-panel { border-top: 1px solid var(--border); background: var(--white); padding: 8px 24px 20px; display: none; }
.menu-panel.is-open { display: block; }
.menu-panel a {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--border);
  min-height: 48px; font-size: 16px; letter-spacing: 0.08em;
  text-transform: uppercase; font-weight: 600; color: var(--neutral-800);
}
.menu-panel a[aria-current="page"] { color: var(--regent-blue); }
.menu-panel .btn-give {
  display: block; margin-top: 16px; text-align: center; padding: 15px;
  font-size: 15px; border-bottom: 0;
}

/* Nav collapse threshold is 1000px, separate from the 700px block below.
   Seven items plus Give stop fitting well before 700. */
@media (max-width: 1000px) {
  .nav-wide { display: none; }
  .menu-toggle { display: flex; }
}

/* ============================================================
   5. PROSE
   Authoritative spacing. Margins collapse to the larger value,
   so each element declares its own top margin and a 26px bottom.
   ============================================================ */

.prose { max-width: 720px; font-size: 18.5px; line-height: 1.78; color: var(--neutral-800); }
.prose > * { margin: 0 0 26px; }
.prose h2 {
  font-family: var(--serif-display); font-size: 32px; line-height: 1.15;
  color: var(--regent-blue); margin: 44px 0 26px; font-weight: 400;
}
.prose h3 {
  font-family: var(--serif-display); font-size: 24px; line-height: 1.2;
  color: var(--regent-blue); margin: 34px 0 26px; font-weight: 400;
}
.prose > *:first-child { margin-top: 0; }
.prose a { text-decoration: underline; }  /* never color alone */
.prose strong { font-weight: 700; }
.prose em { font-style: italic; }
.prose ul, .prose ol { padding-left: 24px; }
.prose li { margin-bottom: 10px; }
.prose blockquote {
  border-left: 3px solid var(--regent-green); padding: 4px 0 4px 22px;
  font-family: var(--serif-text); font-size: 21px; line-height: 1.5; color: var(--ink);
}
.prose table { width: 100%; border-collapse: collapse; font-size: 16.5px; }
.prose th {
  background: var(--blue-50); text-align: left; font-weight: 700;
  padding: 12px 14px; border-bottom: 1px solid var(--border-strong);
}
.prose td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.prose hr { border: 0; border-top: 1px solid var(--border); margin: 44px 0; }
.prose figure { margin: 34px 0 26px; }
.prose figcaption { font-size: 15px; color: var(--fg2); margin-top: 10px; }

/* The designed pull quote — gold rules and glyph, Ink text.
   Distinct from .prose blockquote, which editors control. */
.pullquote { border-top: 2px solid var(--regent-gold); border-bottom: 2px solid var(--regent-gold); padding: 28px 0; margin: 12px 0 32px; }
.pullquote .glyph { font-family: var(--serif-display); font-size: 52px; color: var(--gold-700); line-height: 0.5; }
.pullquote p { font-family: var(--serif-text); font-size: clamp(21px, 3vw, 25px); line-height: 1.45; color: var(--ink); margin: 16px 0 0; }

/* ============================================================
   6. FORMS  —  light grounds only. On navy, put the form in a
   white card rather than on the band itself.
   ============================================================ */

.field { margin-bottom: 20px; }
.field label { display: block; font-weight: 600; font-size: 15.5px; margin-bottom: 7px; }
.field .req { color: var(--error); font-weight: 700; }
.field input[type="text"], .field input[type="email"], .field select, .field textarea {
  width: 100%; padding: 13px 14px; font: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md);
  background: var(--white); color: var(--ink);
}
.field.has-error input, .field.has-error select, .field.has-error textarea {
  border: 2px solid var(--error);
}
.field-error { color: var(--error); font-size: 15px; margin-top: 7px; font-weight: 600; }
.field-error::before { content: "Error: "; font-weight: 700; }

.form-errors {
  border: 2px solid var(--error); background: var(--error-bg);
  border-radius: var(--radius-md); padding: 18px 20px; margin-bottom: 26px;
}
.form-errors h2 { font-size: 17px; margin: 0 0 10px; color: var(--error); }
.form-errors a { color: var(--error); text-decoration: underline; }

.form-success {
  border: 2px solid var(--green-800); background: var(--green-100);
  border-radius: var(--radius-md); padding: 18px 20px;
}

.btn {
  background: var(--regent-green); color: #fff; padding: 14px 26px;
  border-radius: var(--radius-md); font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; font-size: 14.5px; display: inline-block;
}
.btn:hover { background: var(--green-800); color: #fff; text-decoration: none; }
.btn[disabled], .btn.is-busy { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--regent-blue); }
.btn-secondary:hover { background: var(--blue-900); }

/* ============================================================
   7. EMPTY STATES + NOTICES
   ============================================================ */

.empty-state {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--white); padding: 40px 28px; text-align: center;
}
.empty-state p { font-family: var(--serif-text); font-size: 20px; color: var(--ink); margin: 0 0 16px; }

.notice { border-radius: var(--radius-md); padding: 16px 20px; margin-bottom: 26px; border-left: 3px solid var(--regent-blue); background: var(--blue-50); }
.notice .notice-label { font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; font-size: 13.5px; }
/* Urgent survives grayscale: bold label plus a 3px rule, not color alone. */
.notice.is-urgent { border-left: 3px solid var(--error); background: var(--error-bg); }
.notice.is-urgent .notice-label { color: var(--error); }

/* ============================================================
   8. CARDS / GRIDS
   Intrinsic sizing does the reflow; no query needed.
   ============================================================ */

.grid { display: grid; gap: 28px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.card { position: relative; background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.card-title { font-family: var(--serif-display); font-size: 23px; line-height: 1.2; color: var(--regent-blue); }
/* Stretched link: one hit area, one accessible name, one focus stop. */
.card-title a::after { content: ""; position: absolute; inset: 0; }
.card-meta { font-size: 15px; color: var(--fg2); margin-top: 8px; }

.event-row { display: flex; flex-wrap: wrap; gap: 22px; align-items: center; padding: 24px 0; border-bottom: 1px solid var(--border); }
.event-date { flex: 0 0 92px; text-align: center; border-right: 1px solid var(--border); padding-right: 22px; }
.event-date .m { font-size: 14px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--regent-green); font-weight: 700; }
.event-date .d { font-family: var(--serif-display); font-size: 34px; line-height: 1; color: var(--regent-blue); }

/* ============================================================
   9. FOOTER
   ============================================================ */

.site-footer { background: var(--blue-900); color: #C7D3E4; margin-top: 80px; }
.site-footer a { color: #C7D3E4; }
.site-footer h2 { font-size: 14px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--regent-gold); font-weight: 700; margin: 0 0 14px; }
.footer-cols { display: grid; gap: 40px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); padding-top: 64px; padding-bottom: 48px; }
.footer-base { border-top: 1px solid rgba(255,255,255,0.14); }
.footer-base-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-top: 18px; padding-bottom: 18px; font-size: 14px; color: #A9BBD4; }

/* ============================================================
   10. THE SINGLE MEDIA BLOCK
   Four behaviors intrinsic CSS cannot express.
   ============================================================ */

@media (max-width: 700px) {
  [data-stack] { flex-direction: column; align-items: stretch; }
  [data-stack] [data-stack-lead] {
    flex: 1 1 auto; text-align: left; border-right: 0;
    border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 12px;
    display: flex; align-items: baseline; gap: 12px;
  }
  [data-fullwidth] { width: 100%; text-align: center; }
  [data-keyline] { padding: 28px 20px; }
}

/* ============================================================
   11. SPECIFICITY FIXES
   Descendant selectors like `.nav-wide a` (0,1,1) outrank a bare
   component class like `.btn-give` (0,1,0), so the button was
   inheriting nav link color and padding instead of its own.
   Same problem in the footer. Fixed by matching specificity
   rather than reaching for !important.
   ============================================================ */

/* Lockup: these are <span>s, so display:block is required for the
   two lines to stack — and margin-top does nothing on an inline
   element, which is why the sub-line sat on the same line. */
.lockup-name,
.lockup-sub { display: block; }

/* Give button, everywhere it appears. */
.nav-wide a.btn-give,
.menu-panel a.btn-give,
.site-footer a.btn-give,
a.btn-give {
	background: var(--regent-green);
	color: #FFFFFF;
	padding: 12px 22px;
	border-radius: var(--radius-md);
	font-size: 14.5px;
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	display: inline-block;
}

.nav-wide a.btn-give:hover,
.menu-panel a.btn-give:hover,
.site-footer a.btn-give:hover,
a.btn-give:hover {
	background: var(--green-800);
	color: #FFFFFF;
	text-decoration: none;
}

/* The wide-nav underline rule targets `.nav-wide a[aria-current]`,
   which must never apply to the Give button. */
.nav-wide a.btn-give::after { content: none; }

/* Mobile panel: full width, no row divider. */
.menu-panel a.btn-give {
	display: block;
	width: 100%;
	text-align: center;
	padding: 15px;
	font-size: 15px;
	border-bottom: 0;
	margin-top: 16px;
}

/* Same class of problem for the standard buttons inside regions
   that style bare anchors. */
.site-footer a.btn,
.empty-state a.btn,
.prose a.btn {
	color: #FFFFFF;
	text-decoration: none;
	display: inline-block;
}
.site-footer a.btn-secondary,
.empty-state a.btn-secondary,
.prose a.btn-secondary { background: var(--regent-blue); }
