/* ==========================================================================
   Imamia Mission London UK — visual identity
   Palette drawn from manuscript illumination: deep greens with brass gold.
   ========================================================================== */

:root {
  /* Greens, dark to light */
  --ink:        #0A1F16;
  --deep:       #08301F;
  --emerald:    #0E5138;
  --jade:       #1A7A54;
  --sage:       #CFE3D8;
  --mist:       #E8EFE9;

  /* Accent */
  --brass:      #C9A227;
  --brass-lift: #DCB53A;

  /* Neutrals */
  --parchment:  #F6F4EC;
  --card:       #FFFFFF;
  --body:       #35433C;
  --muted:      #6A7A72;
  --line:       #DFE6E0;

  --radius:     14px;
  --radius-lg:  20px;
  --shell:      1180px;

  --shadow-sm: 0 2px 8px rgba(10,31,22,.06);
  --shadow-md: 0 10px 28px rgba(10,31,22,.10);
  --shadow-lg: 0 22px 50px rgba(10,31,22,.16);

  --font-display: 'Amiri', Georgia, 'Times New Roman', serif;
  --font-body:    'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

/* --- Reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--body);
  background: var(--parchment);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--emerald); }

/* Scoped to `body` so these win against Tailwind's preflight reset, which
   otherwise flattens headings to `font-size: inherit`. */
body h1, body h2, body h3, body h4 {
  font-family: var(--font-display);
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 .6em;
  font-weight: 700;
}

body h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
body h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); }
body h3 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); }

body p { margin: 0 0 1.1em; }

/* Headings that sit inside dark sections.
   A class selector outranks the plain `body h1` rule above, so headings inside
   any light-on-dark section correctly stay light instead of going near-black. */
body .section-deep h1, body .section-deep h2,
body .section-deep h3, body .section-deep h4 { color: var(--parchment); }
body .site-footer h3 { color: var(--parchment); }

/* Legacy pages set the colour on the section with Tailwind's .text-white and
   let headings inherit it. Because the base rule above sets colour explicitly,
   inheritance alone was not enough and titles came out dark on dark. */
.text-white h1, .text-white h2, .text-white h3, .text-white h4, .text-white p,
h1.text-white, h2.text-white, h3.text-white, h4.text-white { color: #fff; }

/* Same for sections painted with the darker greens. */
[class*="bg-green-6"] h1, [class*="bg-green-6"] h2, [class*="bg-green-6"] h3, [class*="bg-green-6"] h4,
[class*="bg-green-7"] h1, [class*="bg-green-7"] h2, [class*="bg-green-7"] h3, [class*="bg-green-7"] h4,
[class*="bg-green-8"] h1, [class*="bg-green-8"] h2, [class*="bg-green-8"] h3, [class*="bg-green-8"] h4,
[class*="bg-green-9"] h1, [class*="bg-green-9"] h2, [class*="bg-green-9"] h3, [class*="bg-green-9"] h4 {
  color: var(--parchment);
}

/* ...but a heading that explicitly asks for a green/dark colour keeps it,
   for example the white cards further down those pages. */
[class*="bg-white"] h1, [class*="bg-white"] h2, [class*="bg-white"] h3, [class*="bg-white"] h4,
[class*="bg-gray"] h1, [class*="bg-gray"] h2, [class*="bg-gray"] h3, [class*="bg-gray"] h4 {
  color: var(--ink);
}
h1[class*="text-green"], h2[class*="text-green"],
h3[class*="text-green"], h4[class*="text-green"] { color: var(--emerald); }

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.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;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--brass); color: var(--ink); padding: .75rem 1.25rem;
  font-weight: 700; border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- Header --------------------------------------------------------- */
.site-header {
  background: var(--deep);
  color: var(--parchment);
  position: sticky; top: 0; z-index: 100;
  border-bottom: 1px solid rgba(201,162,39,.28);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: .85rem;
  flex-wrap: nowrap;
}
.brand { flex: 0 0 auto; }

.brand {
  display: flex; align-items: center; gap: .75rem;
  color: var(--parchment); text-decoration: none;
}
.brand-mark { color: var(--brass); display: flex; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--font-display); font-size: 1.3rem; font-weight: 700;
  letter-spacing: .01em;
}
.brand-sub {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .22em;
  color: var(--brass);
}

.nav-desktop {
  display: none; gap: .1rem;
  flex-wrap: nowrap;          /* never wrap onto a second line */
  align-items: center;
  min-width: 0;
}

.nav-link {
  color: var(--sage); text-decoration: none;
  font-size: .82rem; font-weight: 500;
  padding: .45rem .55rem; border-radius: 8px;
  transition: color .18s, background .18s;
  white-space: nowrap;        /* each item stays on one line */
  flex: 0 0 auto;
}

/* Tighten further on mid-size screens so all nine items still fit on one row */
@media (min-width: 1024px) and (max-width: 1300px) {
  .nav-link { font-size: .76rem; padding: .4rem .4rem; letter-spacing: -0.01em; }
  .brand-name { font-size: 1.1rem; }
  .brand-sub  { font-size: .6rem; letter-spacing: .16em; }
}
.nav-link:hover { color: var(--parchment); background: rgba(255,255,255,.07); }

.nav-link.is-active {
  color: var(--ink); background: var(--brass); font-weight: 600;
}

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid rgba(255,255,255,.25);
  color: var(--parchment); border-radius: 10px;
  width: 44px; height: 44px; cursor: pointer;
}
.nav-toggle:hover { background: rgba(255,255,255,.08); }

@media (min-width: 1024px) {
  .nav-desktop { display: flex; }
  .nav-toggle  { display: none; }
}

/* --- Mobile menu ---------------------------------------------------- */
.nav-overlay {
  position: fixed; inset: 0; z-index: 150;
  background: linear-gradient(160deg, var(--deep), var(--ink));
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.nav-overlay[hidden] { display: none; }

.nav-close {
  position: absolute; top: 1.1rem; right: 1.1rem;
  background: transparent; border: 0; color: var(--parchment); cursor: pointer;
  width: 46px; height: 46px;
}

.nav-overlay-links {
  display: flex; flex-direction: column; align-items: center;
  gap: .35rem; width: 100%; max-width: 340px;
}
.nav-overlay-links a {
  font-family: var(--font-display); font-size: 1.5rem;
  color: var(--parchment); text-decoration: none;
  padding: .45rem 1rem; border-radius: 10px; width: 100%; text-align: center;
}
.nav-overlay-links a:hover { background: rgba(255,255,255,.08); }
.nav-overlay-links a.is-active { color: var(--brass); }

/* --- Ticker --------------------------------------------------------- */
.ticker {
  background: var(--emerald);
  color: var(--parchment);
  overflow: hidden;
  padding-block: .6rem;
  border-bottom: 1px solid rgba(201,162,39,.25);
}
.ticker-track {
  display: inline-flex; align-items: center; gap: 1.5rem;
  white-space: nowrap;
  animation: ticker-scroll 48s linear infinite;
}
.ticker:hover .ticker-track,
.ticker:focus-within .ticker-track { animation-play-state: paused; }

.ticker-item { font-size: .87rem; }
.ticker-item i { color: var(--brass); margin-right: .35rem; }
.ticker-item a { color: var(--brass); font-weight: 600; }
.ticker-dot { color: var(--brass); opacity: .7; font-size: .75rem; }
.ticker-sep { color: var(--sage); opacity: .5; margin-inline: .3rem; }
.ticker-item a i { margin-right: .2rem; }

@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* --- Sections ------------------------------------------------------- */
.section { padding-block: clamp(3rem, 7vw, 5.5rem); }
.section-tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section-alt { background: var(--mist); }
.section-deep { background: var(--deep); color: var(--sage); }
.section-deep h1, .section-deep h2, .section-deep h3 { color: var(--parchment); }

.eyebrow {
  display: inline-block;
  font-size: .74rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .2em;
  color: var(--brass);
  margin-bottom: .7rem;
}

.section-head { max-width: 720px; margin-bottom: 2.5rem; }
.section-head.centred { margin-inline: auto; text-align: center; }
.section-head p { color: var(--muted); font-size: 1.05rem; margin-bottom: 0; }

/* Girih divider — the recurring signature motif */
.divider {
  display: flex; align-items: center; gap: 1rem;
  margin-block: 2.5rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brass), transparent);
  opacity: .55;
}
.divider svg { color: var(--brass); flex: none; }

/* --- Buttons -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  white-space: nowrap;        /* button text never breaks onto two lines */
  padding: .8rem 1.6rem; border-radius: 999px;
  font-family: var(--font-body); font-size: .95rem; font-weight: 600;
  text-decoration: none; cursor: pointer; border: 2px solid transparent;
  transition: background .2s, color .2s, border-color .2s, transform .1s;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brass); color: var(--ink); }
.btn-primary:hover { background: var(--brass-lift); }

.btn-solid { background: var(--emerald); color: #fff; }
.btn-solid:hover { background: var(--jade); }

.btn-ghost { border-color: currentColor; color: var(--emerald); background: transparent; }
.btn-ghost:hover { background: var(--emerald); color: #fff; border-color: var(--emerald); }

.btn-on-dark { border-color: var(--sage); color: var(--parchment); background: transparent; }
.btn-on-dark:hover { background: var(--parchment); color: var(--ink); }

.btn-sm { padding: .45rem 1rem; font-size: .84rem; }
.btn-danger { background: #A32B2B; color: #fff; }
.btn-danger:hover { background: #8C2222; }

/* --- Cards ---------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.6rem;
  transition: box-shadow .22s, transform .22s, border-color .22s;
}
.card-link { text-decoration: none; color: inherit; display: block; }
.card-link:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
  border-color: rgba(201,162,39,.55);
}

.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* --- Forms ---------------------------------------------------------- */
.form-field { margin-bottom: 1.15rem; }

.form-label {
  display: block; font-size: .82rem; font-weight: 600;
  color: var(--ink); margin-bottom: .4rem;
  letter-spacing: .02em;
}
.form-label .req { color: #A32B2B; }

.form-input, .form-select, .form-textarea {
  width: 100%; padding: .8rem .95rem;
  font-family: var(--font-body); font-size: 1rem; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line);
  border-radius: 10px;
  transition: border-color .18s, box-shadow .18s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--jade);
  box-shadow: 0 0 0 3px rgba(26,122,84,.15);
}
.form-textarea { resize: vertical; min-height: 150px; }

/* Fields the user is shown but cannot change */
.form-input:disabled, .form-select:disabled, .form-textarea:disabled,
.form-input[readonly] {
  background: var(--mist);
  color: var(--muted);
  border-color: var(--line);
  cursor: not-allowed;
  opacity: 1;              /* stop Safari washing it out further */
}
.form-hint { font-size: .82rem; color: var(--muted); margin-top: .3rem; }

/* --- Alerts --------------------------------------------------------- */
.alert {
  padding: .9rem 1.1rem; border-radius: 10px;
  margin-bottom: 1.5rem; font-size: .93rem;
  border: 1px solid transparent;
  display: flex; gap: .6rem; align-items: flex-start;
}
.alert i { margin-top: .2rem; }
.alert-success { background: #E7F5EC; border-color: #A9D8BC; color: #17603A; }
.alert-error   { background: #FBEAEA; border-color: #E5B4B4; color: #8C2222; }
.alert-info    { background: #EAF1F7; border-color: #B7CDE0; color: #24506F; }
.alert-warn    { background: #FDF4E0; border-color: #E8CE8E; color: #7A5B10; }

/* --- Tables --------------------------------------------------------- */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff;
  box-shadow: var(--shadow-sm);
}
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table thead th {
  background: var(--emerald); color: #fff;
  text-align: left; padding: .8rem 1rem;
  font-weight: 600; font-size: .8rem;
  text-transform: uppercase; letter-spacing: .06em;
  white-space: nowrap;
}
.table tbody td { padding: .8rem 1rem; border-top: 1px solid var(--line); vertical-align: top; }
.table tbody tr:nth-child(even) { background: #FAFBFA; }
.table tbody tr:hover { background: var(--mist); }
.table .empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }

/* --- Footer --------------------------------------------------------- */
.site-footer { background: var(--deep); color: var(--sage); margin-top: 4rem; }

.footer-rule {
  height: 4px;
  background: repeating-linear-gradient(
    90deg, var(--brass) 0 14px, transparent 14px 28px
  );
  opacity: .5;
}

.footer-grid {
  display: grid; gap: 2.25rem;
  grid-template-columns: 1fr;
  padding-block: 3.25rem;
}
@media (min-width: 640px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1.2fr; } }

.footer-heading {
  font-size: 1.05rem; color: var(--parchment);
  margin-bottom: 1rem; letter-spacing: .01em;
}
.footer-text { font-size: .9rem; color: var(--sage); opacity: .85; }
.footer-charity { font-size: .8rem; }
.footer-charity a { color: var(--brass); text-decoration: none; }
.footer-charity a:hover { text-decoration: underline; }

.footer-list, .footer-contact { list-style: none; margin: 0; padding: 0; }
.footer-list li { margin-bottom: .55rem; }
.footer-list a {
  color: var(--sage); text-decoration: none; font-size: .92rem;
  transition: color .18s;
}
.footer-list a:hover { color: var(--brass); }

.footer-contact li {
  display: flex; gap: .6rem; align-items: flex-start;
  margin-bottom: .7rem; font-size: .9rem;
}
.footer-contact i { color: var(--brass); margin-top: .28rem; flex: none; }
.footer-contact a { color: var(--sage); text-decoration: none; }
.footer-contact a:hover { color: var(--brass); }

.footer-social { display: flex; gap: .6rem; margin-top: 1.1rem; }
.footer-social a {
  width: 40px; height: 40px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(207,227,216,.35); color: var(--sage);
  text-decoration: none; transition: background .2s, color .2s, border-color .2s;
}
.footer-social a:hover { background: var(--brass); color: var(--ink); border-color: var(--brass); }

.footer-base { border-top: 1px solid rgba(255,255,255,.1); }
.footer-base-inner {
  display: flex; flex-wrap: wrap; gap: .75rem;
  justify-content: space-between; align-items: center;
  padding-block: 1.1rem; font-size: .82rem; opacity: .8;
}
.footer-admin { color: var(--sage); text-decoration: none; }
.footer-admin:hover { color: var(--brass); }

/* --- Back to top ---------------------------------------------------- */
.to-top {
  position: fixed; right: 1.1rem; bottom: 1.1rem; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--emerald); color: #fff; border: 0;
  box-shadow: var(--shadow-md); cursor: pointer;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s, background .2s;
}
.to-top.is-visible { opacity: 1; visibility: visible; }
.to-top:hover { background: var(--jade); }

/* --- Reveal on scroll ----------------------------------------------- */
.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity .7s ease-out, transform .7s ease-out;
}
.reveal.is-visible { opacity: 1; transform: none; }

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