/*
 * OHRA responsive fixes (phones, tablets, small laptops).
 *
 * The quick CSS items from the October 2026 formatting review. Kept in one file
 * and loaded last (after ohra-blocks.css) so each rule can reuse the selector it
 * corrects at equal specificity and win on source order, rather than escalating
 * specificity or adding !important. Where the original rule is already
 * !important, the override has to be too; those are marked.
 *
 * Breakpoints match the existing ones:
 *   1024px  the header switches to the menu button
 *    781px  WordPress columns stack
 *    640px  tables switch to stacked rows
 *
 * To roll back, remove the ohra-responsive enqueue in functions.php.
 */

/* ------------------------------------------------------------------ */
/* Labels and small text: raised to a readable minimum, every width.   */
/* ------------------------------------------------------------------ */

.ohra-eyebrow,
.ohra-eyebrow-gold,
.ohra-stat-label { font-size: 13px; }

body .ohra-pill,
body .ohra-alert-card .ohra-alert-card-lead { font-size: 13px !important; }  /* originals are !important */

.ohra-chip .m { font-size: 11px; }
.ohra-chip .y,
.ohra-row .ohra-chip .y,
.ohra-row-media .ohra-chip .y { font-size: 11px; }

body .ohra-site-footer-inner .wp-block-column > h3 { font-size: 13px !important; }  /* original is !important */

/* Quick-link cards (the things people ask for most): the whole card is the
   tap target, not just the 27px-high title link. */
.ohra-quick-card { position: relative; }
.ohra-quick-card h3 a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.ohra-quick-card h3 a:focus-visible { outline: none; }
.ohra-quick-card:has(h3 a:focus-visible) { outline: 2px solid var(--ohra-accent, #453A8C); outline-offset: 2px; }

/* ------------------------------------------------------------------ */
/* Header and menu, 1024px and below.                                  */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) {

  /* The closed panel sits just off-screen, but its shadow spilled back in as a
     grey band down the right edge of every page. Shadow only when open. */
  .ohra-nav-panel { box-shadow: none; }
  .ohra-nav.is-open .ohra-nav-panel { box-shadow: -18px 0 44px rgba(20,16,43,0.18); }

  /* The open panel covered the menu button, so there was no visible way to
     close it. Lift the button above the panel, top right, where it shows as X. */
  .ohra-nav.is-open .ohra-nav-toggle {
    position: fixed; top: 16px; right: 16px; z-index: 1001;
    background: var(--ohra-stone, #EFEADC);
  }

  /* Larger menu links. */
  .ohra-nav-menu > li > a { font-size: 17px; }
  .ohra-nav-menu .sub-menu a { font-size: 16px; }

  /* Menu button sat in the middle of the header between the logo and Join Us.
     Push it right so it sits beside the button it belongs with. */
  .ohra-header-main .ohra-nav { margin-left: auto; }
}

/* The header's 24px side padding only started at 900px, so between 901px and
   the 1200px content width the logo and Join Us sat flush to the screen edges. */
@media (max-width: 1279px) {
  body .ohra-header-main,
  body .ohra-notice-bar { padding-inline: 24px; }
}

/* ------------------------------------------------------------------ */
/* Phones: 781px and below.                                            */
/* ------------------------------------------------------------------ */

@media (max-width: 781px) {

  /* --- One side gutter (24px, from the section groups) --- */

  /* Two-column layouts added 10px + 10px of their own padding once stacked,
     pushing those sections to 44px while their neighbours sat at 24px. */
  body .wp-block-columns:has(> .wp-block-column:nth-child(2):last-child):not([class*='ohra-']),
  body .wp-block-columns:has(> .wp-block-column:nth-child(2):last-child):not([class*='ohra-']) > .wp-block-column {
    padding-inline: 0;
  }

  /* Single event, news and project pages: the inner wrapper repeated the
     section's padding. */
  .ohra-story-wrap { padding-inline: 0; }

  /* Footer columns were 10px from the screen edge. */
  body .ohra-site-footer-inner .wp-block-columns > .wp-block-column { padding-inline: 24px; }

  /* --- Forms --- */

  /* The form card's 38px padding left fields 211px wide. */
  .ohra-form-card { padding: 28px 20px 30px; }

  /* --- Centring short, standalone blocks --- */

  /* Home hero. The fixed 46px override here is gone: the heading is now a
     clamp that has already reached its floor by this width, so a second size
     declaration would only fight it. Centring is still wanted. */
  body .ohra-home-hero { align-items: center; text-align: center; }
  body .ohra-home-hero p { text-align: center; }
  .ohra-home-hero .wp-block-buttons { justify-content: center; }

  /* Stats band: a centred 2 x 2 grid instead of one left-aligned column. */
  .ohra-stat-band .wp-block-columns {
    display: grid !important;  /* core sets display: flex with !important */
    grid-template-columns: 1fr 1fr; gap: 28px 16px;
  }
  .ohra-stat-band .wp-block-column { text-align: center; }
  .ohra-stat-band .wp-block-column p { text-align: center; }

  /* Closing call-to-action panels. */
  .ohra-cta-band { text-align: center; }
  .ohra-cta-band h2,
  .ohra-cta-band p { text-align: center; }
  .ohra-cta-band .wp-block-buttons { justify-content: center; }

  /* Section-level single-button rows: See all news, Archived AGM papers, etc. */
  .main-content > .wp-block-group > .wp-block-buttons { justify-content: center; }

  /* Footer: one centred column. */
  .ohra-site-footer-inner,
  .ohra-site-footer-inner p,
  .ohra-site-footer-inner h3 { text-align: center; }
  .ohra-site-footer-inner .wp-block-column > p { margin-inline: auto; }
  .ohra-site-footer-inner .ohra-social { justify-content: center; }
  .ohra-site-footer-inner .wp-block-gallery { max-width: 300px; margin-inline: auto; }
  .ohra-site-footer-inner .ohra-contact-item > a,
  .ohra-site-footer-inner .ohra-contact-item > .ohra-contact-static { justify-content: center; text-align: left; }
  body .ohra-footer-policy { justify-content: center; text-align: center; }

  /* Footer links were 20px tall; 44px is the minimum comfortable tap target. */
  .ohra-site-footer-inner .wp-block-list li { margin: 0; }
  .ohra-site-footer-inner .wp-block-list a { display: inline-block; padding: 12px 0; }

  /* --- Buttons at the end of single pages --- */

  /* The second button wrapped with a 10px left margin, so the pair looked
     misaligned. Stack them full width. */
  .ohra-story-wrap .ohra-btn,
  body .ohra-story-back .ohra-btn + .ohra-btn {
    display: flex; justify-content: center; width: 100%;
    margin: 0 0 10px; box-sizing: border-box;
  }

  /* Back-to-top overlapped body text and the sponsor logo. The sticky header
     already gives a route back up on phones. */
  .ohra-to-top { display: none; }
}

/* ------------------------------------------------------------------ */
/* Tables: stacked rows on narrow screens.                             */
/* ------------------------------------------------------------------ */

/* Phone numbers never break mid-number, at any width. */
.ohra-table a[href^='tel:'] { white-space: nowrap; }

@media (max-width: 640px) {

  /* Each row becomes a small card: the first cell as its title, the rest
     underneath with their column name (data-label, set by inc/tables.php)
     shown above the value. The header row is kept for screen readers. */
  figure.ohra-table table,
  figure.ohra-table tbody,
  figure.ohra-table tr,
  figure.ohra-table td,
  figure.ohra-table tbody th { display: block; width: 100%; box-sizing: border-box; }

  figure.ohra-table table { min-width: 0; table-layout: auto; }

  figure.ohra-table thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
  }

  figure.ohra-table tr { padding: 14px 16px; border-bottom: 1px solid var(--ohra-line-soft, #EAE4D6); }
  figure.ohra-table tr:last-child { border-bottom: 0; }

  figure.ohra-table td { padding: 0; border: 0; }
  figure.ohra-table tbody tr > * + * { margin-top: 8px; }
  figure.ohra-table td:first-child,
  figure.ohra-table tbody td:first-child,
  figure.ohra-table tbody th { padding: 0; text-align: left; border: 0; width: 100%; font-weight: 600; color: var(--ohra-ink, #322A69); }

  figure.ohra-table td[data-label]:not(:first-child)::before {
    content: attr(data-label);
    display: block; margin-bottom: 2px;
    font: 700 13px/1.4 var(--ohra-font-body, Inter, sans-serif);
    letter-spacing: .06em; text-transform: uppercase;
    color: var(--ohra-muted, #7A7499);
  }
}

/* ================================================================== */
/* Template changes (second pass of the review).                       */
/* ================================================================== */

/* --- Mobile menu: Home link and Join us button (markup in inc/nav.php) --- */
@media (min-width: 1025px) {
  .ohra-nav-mobile-only { display: none !important; }
}
@media (max-width: 1024px) {
  .ohra-nav-panel-cta { padding: 24px 8px 8px; }
  .ohra-nav-panel-cta .ohra-nav-join {
    display: block; text-align: center; text-decoration: none;
    padding: 15px 20px; border-radius: 999px;
    font: 600 15px/1.2 var(--ohra-font-body, Inter, sans-serif);
    letter-spacing: .12em; text-transform: uppercase;
    background: var(--ohra-ink, #322A69); color: #FFFFFF;
  }
  .ohra-nav-panel-cta .ohra-nav-join:hover,
  .ohra-nav-panel-cta .ohra-nav-join:focus-visible { background: var(--ohra-accent, #453A8C); color: #FFFFFF; }
  .ohra-nav-scrim { background: rgba(20,16,43,0.55); }
}

/* --- One card style: the image inset in the card, as on the row listings --- */
body .ohra-card .ohra-card-media { margin: 22px 22px 0; border-radius: 12px; overflow: hidden; }
body .ohra-card .ohra-card-media img { border-radius: 0; }

/* --- Meeting and minutes rows without an image: date above the text on phones --- */
@media (max-width: 600px) {
  body .ohra-row:not(.ohra-row-has-media) { flex-direction: column; gap: 12px; }
  body .ohra-row:not(.ohra-row-has-media) > .ohra-chip {
    flex: none; width: auto; display: inline-flex; align-items: baseline; gap: 6px;
    padding: 6px 12px; border-radius: 8px;
  }
  body .ohra-row:not(.ohra-row-has-media) > .ohra-chip .m,
  body .ohra-row:not(.ohra-row-has-media) > .ohra-chip .d,
  body .ohra-row:not(.ohra-row-has-media) > .ohra-chip .y { display: inline; }
  body .ohra-row:not(.ohra-row-has-media) > .ohra-chip .d { font-size: 20px; }
}

/* --- Request a copy on Documents: same secondary style as on Meetings (.ohra-btn) --- */
body .ohra-doc-row .wp-block-buttons .wp-block-button .wp-block-button__link {
  background: var(--ohra-lilac, #EDEAF7); color: var(--ohra-ink, #322A69);
  border: 1px solid #D8D2EC; padding: 12px 22px;
  font: 600 13px/1.2 var(--ohra-font-body, Inter, sans-serif);
  letter-spacing: .06em; text-transform: uppercase;
}
body .ohra-doc-row .wp-block-buttons .wp-block-button .wp-block-button__link:hover,
body .ohra-doc-row .wp-block-buttons .wp-block-button .wp-block-button__link:focus {
  background: var(--ohra-ink, #322A69); border-color: var(--ohra-ink, #322A69); color: #FFFFFF;
}

/* --- Home alerts: four cards as 2 x 2 rather than 3 + 1 --- */
@media (min-width: 768px) {
  body .ohra-alert-cards:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, 1fr); }
}

/* --- About: history as a timeline, a dot on each year joined by a line --- */
body .ohra-timeline-row { position: relative; padding-left: 32px; border-bottom: 0; }
body .ohra-timeline-row::before {
  content: ''; position: absolute; left: 0; top: 21px;
  width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box;
  background: var(--ohra-paper, #FBF9F3); border: 3px solid var(--ohra-accent, #453A8C);
}
body .ohra-timeline-row::after {
  content: ''; position: absolute; left: 6px; top: 35px; width: 2px;
  bottom: calc(-1 * var(--wp--style--block-gap, 24px) - 21px);
  background: var(--ohra-line, #DCD5C3);
}
body .ohra-timeline-row:not(:has(~ .ohra-timeline-row))::after { display: none; }
/* ---- Ninja Forms ----
 * Restored with the plugin. These were removed when the forms were taken out;
 * without them the form fields and submit button fall back to browser defaults.
 */
/* Form checkboxes: box beside its label, not above it (Ninja Forms wraps them). */
/* Ninja Forms' own stylesheet loads after this one, so these carry one more class than its .label-above .field-wrap rule. */
.nf-form-cont .label-above .checkbox-wrap,
.nf-form-cont .checkbox-wrap { flex-flow: row nowrap; align-items: flex-start; gap: 12px; }
.nf-form-cont .checkbox-wrap .nf-field-label { flex: 1 1 auto; width: auto; margin: 0; }
.nf-form-cont .checkbox-wrap input[type='checkbox'] { width: 22px; height: 22px; margin: 2px 0 0; }
  /* 16px stops iPhones zooming into the field on tap. */
  .nf-form-cont input:not([type='checkbox']):not([type='radio']):not([type='submit']),
  .nf-form-cont select,
  .nf-form-cont textarea { font-size: 16px; }
  /* Two-column rows (first/last name, postcode/household) stack. */
  .nf-form-cont .nf-field-container.one-half,
  .nf-form-cont .nf-field-container.one-half.first {
    float: none; width: 100%; margin-left: 0; clear: both;
  }
  .nf-form-cont .submit-wrap input[type='submit'],
  .nf-form-cont .submit-wrap button { width: 100%; }
