/* The Husainy Trust website: shared styles.
   Most styling sits on each element; this file adds the
   mobile menu, focus states and small-screen adjustments. */

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: #FFFFFF; }
img { max-width: 100%; height: auto; }
a { color: #0B3328; }
a:hover { color: #0F5C46; }
:focus-visible { outline: 3px solid #E3C98E; outline-offset: 3px; border-radius: 6px; }
/* Text fields: a quiet green border instead of the gold focus box */
input:focus, input:focus-visible, select:focus, select:focus-visible, textarea:focus, textarea:focus-visible { outline: none; border-color: #0B3328 !important; box-shadow: 0 0 0 3px rgba(11, 51, 40, 0.12); }
#member-search:focus, #member-search:focus-visible { box-shadow: none; }
label:has(#member-search:focus) { border-color: #0B3328 !important; box-shadow: 0 0 0 3px rgba(11, 51, 40, 0.12); }
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary span[aria-hidden="true"] { display: inline-block; transform: rotate(45deg); }
.skip-link { position: absolute; left: -9999px; top: 8px; background: #0B3328; color: #FFFFFF; padding: 10px 16px; border-radius: 999px; z-index: 100; }
.skip-link:focus { left: 16px; }

/* ---------- Header stays at the top while scrolling ---------- */
header > a[href*="get-involved"] { white-space: nowrap; flex: 0 0 auto; }
header { position: sticky !important; top: 0; z-index: 40; background: rgba(255, 255, 255, 0.94); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); padding-bottom: 12px !important; }
[id] { scroll-margin-top: 104px; }

/* Subcommittee cards: a lone last card fills the row */
ul[style*="minmax(min(280px, 100%), 1fr)"] > li:last-child:nth-child(odd) { grid-column: 1 / -1; }

/* ---------- Mobile menu button (hidden on large screens) ---------- */
.menu-toggle { display: none; font: inherit; font-size: 15px; color: #0B3328; background: #FFFFFF; border: 1px solid #C9D3CE; border-radius: 999px; padding: 10px 16px; min-height: 44px; align-items: center; gap: 10px; cursor: pointer; }
.menu-bars, .menu-bars::before, .menu-bars::after { display: block; width: 18px; height: 2px; background: #0B3328; border-radius: 2px; position: relative; content: ''; }
.menu-bars::before { position: absolute; top: -6px; }
.menu-bars::after { position: absolute; top: 6px; }

@media (max-width: 1080px) {
  header { flex-wrap: nowrap !important; gap: 8px !important; }
  header > div { flex: 1 1 auto !important; min-width: 0; }
  header > div > a:first-child { min-width: 0; }
  header > div > a:first-child span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header > div { padding: 8px 8px 8px 10px !important; flex-wrap: nowrap !important; }
  header > a[href*="get-involved"] { height: 52px !important; padding: 0 22px !important; }
  .menu-toggle { display: inline-flex; margin-left: auto; }
  header nav[aria-label="Main"] { display: none !important; }
  header nav[aria-label="Main"].is-open {
    display: flex !important; flex-direction: column; gap: 0 !important;
    position: absolute; z-index: 50; top: calc(100% + 8px); left: 16px; right: 16px;
    background: #FFFFFF; border: 1px solid #C9D3CE; border-radius: 28px; padding: 10px 22px !important;
    box-shadow: 0 20px 40px rgba(11, 51, 40, 0.14);
  }
  header nav[aria-label="Main"].is-open a { padding: 14px 4px !important; border-bottom: 1px solid #ECEAE5 !important; font-size: 17px; }
  header nav[aria-label="Main"].is-open a:last-child { border-bottom: 0 !important; }
}

@media (max-width: 440px) {
  .menu-toggle .menu-label { display: none; }
  .menu-toggle { padding: 10px 11px; min-height: 40px; }
  header { padding-left: 10px !important; padding-right: 10px !important; gap: 6px !important; }
  header > div > a:first-child { gap: 6px !important; }
  header > div > a:first-child span:first-child { width: 30px !important; height: 30px !important; }
  header > div > a:first-child span:first-child img { width: 26px !important; height: 25px !important; }
  header > div > a:first-child span:last-child { font-size: 13.5px !important; letter-spacing: -0.03em !important; }
  header > a[href*="get-involved"] { padding: 0 12px !important; font-size: 13px !important; height: 46px !important; }
  header > div { padding-right: 6px !important; }
}

/* ---------- Small screens ---------- */
@media (max-width: 760px) {
  body > div, #app > div { font-size: 16px !important; }
  header > div span[style*="font-size: 17px"] { font-size: 15px !important; }
  header > a[href*="get-involved"] { height: 48px !important; padding: 0 18px !important; font-size: 14px !important; }

  /* Large dark panels and white sections: lighter padding */
  [style*="border-radius: 40px"] { border-radius: 28px !important; }
  [style*="padding: 96px 48px"], [style*="padding: 104px 48px"], [style*="padding: 112px 48px"],
  [style*="padding: 88px 48px"], [style*="padding: 112px 48px 96px"], [style*="padding: 104px 48px 88px"] {
    padding: 56px 22px !important;
  }
  [style*="padding: 48px; box-sizing"] { padding: 22px !important; }
  section[style*="padding: 120px 24px"], section[style*="padding: 112px 24px"], section[style*="padding: 104px 24px"],
  section[style*="padding: 88px 24px"], section[style*="padding: 72px 24px"], section[style*="padding: 104px 24px 120px"] {
    padding-top: 64px !important; padding-bottom: 64px !important; padding-left: 20px !important; padding-right: 20px !important;
  }
  [style*="padding: 56px; box-sizing"] { padding: 28px 22px !important; }
  [style*="min-height: 640px"], [style*="min-height: 620px"] { min-height: 540px !important; }
  [style*="flex: 0 1 420px; min-width: 260px"] { min-width: 0 !important; }
  [style*="flex: 0 0 240px"], [style*="flex: 0 0 200px"] { flex-basis: 100% !important; max-width: 260px; }
  [style*="font-size: 52px"] { font-size: 44px !important; }
  table { font-size: 14px; min-width: 0 !important; }
  table th, table td { padding: 10px 8px !important; }
  label[style*="flex: 1 1 360px"] { flex-basis: 100% !important; min-width: 0; }
  /* Photo placeholders behind hero text: hide their caption so it never overlaps */
  [role="img"][style*="position: absolute"] { font-size: 0 !important; }
  /* Founder portrait: keep it portrait-sized */
  .founder-portrait { max-width: 320px; flex-basis: auto !important; width: 100%; min-width: 0 !important; }
  /* Filter buttons fit on one line */
  [role="group"] button { padding: 8px 12px !important; min-height: 40px !important; font-size: 13px !important; }
  [role="group"] { gap: 2px !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none !important; }
}

/* Narrow phones: keep "The Husainy Trust" and "Get Involved" on one line each (placed last so it wins over the 760px rules) */
@media (max-width: 440px) {
  header > a[href*="get-involved"] { padding: 0 13px !important; font-size: 13px !important; height: 46px !important; }
  header > div > a:first-child span:last-child { font-size: 14px !important; letter-spacing: -0.02em !important; overflow: visible !important; text-overflow: clip !important; }
  header > div { padding-left: 8px !important; }
  header > div > a:first-child span:first-child { flex: 0 0 30px !important; }
  header > div > a:first-child span:first-child img { flex: 0 0 auto; }
}

/* Home "How we serve": four equal cards; titles and figures line up */
@media (min-width: 1101px) { .serve-grid .serve-title { min-height: 2.5em; } }
@media (max-width: 1100px) { .serve-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 600px)  { .serve-grid { grid-template-columns: minmax(0, 1fr) !important; } }

/* YouTube click-to-play */
.yt-facade { position: relative; display: block; width: 100%; height: 100%; padding: 0; border: 0; background: #1E4A3D; cursor: pointer; }
.yt-facade img { display: block; width: 100%; height: 100%; object-fit: cover; }
.yt-play { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(11,51,40,0.85); box-shadow: 0 0 0 3px #E3C98E; transition: transform .15s ease, background .15s ease; }
.yt-play::after { content: ""; position: absolute; left: 31px; top: 23px; border-style: solid; border-width: 15px 0 15px 24px; border-color: transparent transparent transparent #FFFFFF; }
.yt-facade:hover .yt-play, .yt-facade:focus-visible .yt-play { transform: translate(-50%, -50%) scale(1.08); background: #0B3328; }
.yt-facade:focus-visible { outline: 3px solid #E3C98E; outline-offset: -3px; }
.yt-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(5,20,16,0.88); }
.yt-modal.is-open { display: flex; }
.yt-modal-box { position: relative; width: min(1100px, 100%); }
.yt-modal-frame { aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: #000; }
.yt-modal-close { position: absolute; right: 0; top: -52px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255,255,255,0.5); background: transparent; color: #FFFFFF; font-size: 26px; line-height: 1; cursor: pointer; }
.yt-thumb { position: relative; display: block; line-height: 0; }
.yt-thumb img { display: block; }
.yt-play-sm { width: 40px; height: 40px; box-shadow: 0 0 0 2px #E3C98E; }
.yt-play-sm::after { left: 16px; top: 12px; border-width: 8px 0 8px 13px; }
[data-yt-list] a:hover .yt-play-sm { background: #0B3328; transform: translate(-50%, -50%) scale(1.08); }

/* Founder page: Qur'an spine — centred, never stretched */
@media (max-width: 760px) {
  .quran-spine { flex: 1 1 100% !important; min-height: 0 !important; padding: 24px !important; }
  .quran-spine img { max-width: 200px !important; }
}


/* Home quote panel: tighter on phones */
@media (max-width: 760px) {
  .quote-panel { padding-top: 40px !important; }
  .quote-panel > div { padding: 44px 24px !important; border-radius: 28px !important; }
}

/* Shared enquiry form */
.enq-modal { font-family: Geist, system-ui, sans-serif; font-size: 17px; line-height: 1.5; letter-spacing: -0.01em; position: fixed; inset: 0; z-index: 1000; display: none; align-items: flex-start; justify-content: center; padding: 24px 16px; overflow-y: auto; background: rgba(5,20,16,0.72); }
.enq-modal.is-open { display: flex; }
.enq-box { position: relative; width: min(640px, 100%); background: #FFFFFF; color: #0B3328; border-radius: 28px; padding: 36px; box-sizing: border-box; margin: auto 0; }
.enq-box h2 { margin: 0 40px 6px 0; font-weight: 400; font-size: 30px; letter-spacing: -0.03em; line-height: 1.15; }
.enq-intro { margin: 0 0 20px; color: #3C5A4F; font-size: 16px; }
.enq-box form { display: flex; flex-direction: column; gap: 14px; }
.enq-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); gap: 14px; }
.enq-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
.enq-submit { align-self: flex-start; font: inherit; font-size: 15px; font-weight: 500; background: #0B3328; color: #FFFFFF; border: 0; border-radius: 999px; padding: 14px 28px; cursor: pointer; }
.enq-alt { margin: 4px 0 0; font-size: 14px; color: #557367; }
.enq-close { position: absolute; right: 18px; top: 18px; width: 40px; height: 40px; border-radius: 50%; border: 1px solid #C9D3CE; background: #FFFFFF; color: #0B3328; font-size: 22px; line-height: 1; cursor: pointer; }
@media (max-width: 600px) { .enq-box { padding: 26px 20px; border-radius: 22px; } .enq-box h2 { font-size: 24px; } }
