/* ==========================================================================
   موقع المدرسة القرآنية — ورقة أنماط واحدة، بلا مكتبات خارجية.
   The brand colours are injected from the database in base.html; everything
   below only derives from them.
   ========================================================================== */

@font-face {
  font-family: "Amiri";
  src: url("../fonts/Amiri-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Amiri";
  src: url("../fonts/Amiri-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

:root {
  /* Fallbacks: base.html overrides these with the values from the admin. */
  --brand: #A8D400;
  --brand-dark: #7CA000;
  --deep: #14300A;
  --cyan: #00C4E4;
  --gold: #F5C400;
  --orange: #F0A800;

  --ink: #17210f;
  --muted: #6a7360;
  --line: #e3e7dc;
  --bg: #f4f6f0;
  --white: #fff;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 48, 10, .05), 0 10px 26px rgba(20, 48, 10, .07);
  --head: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;
  --body: "Segoe UI", "Noto Naskh Arabic", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }

/* A grid or flex child refuses to shrink below its own content by default, so
   one long unbreakable line (a site description, a URL) widens its track and
   pushes the whole RTL page sideways — which shows up as a white strip down the
   edge on a phone. Every card sits in one of these rows. */
.news-grid > *, .news-grid--4 > *, .site-row > *, .site-grid > *, .app-row > *,
.app-grid > *, .social-row > *, .social-grid > *, .event-grid > *, .event-row > *,
.hero-side > *, .gallery-grid > *, .follow-grid > * { min-width: 0; }
.site-card, .site-tile, .site-text, .site-tile-body, .app-tile-body,
.event-info, .event-tile-body, .news-body, .hero-item-text { min-width: 0; }
.site-text small { max-width: 100%; }

html, body {
  margin: 0;
  padding: 0;
  /* Safety net: clip (not hidden) keeps the sticky menu working. */
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.75;
}

img { max-width: 100%; display: block; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { color: var(--deep); }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.35; margin: 0 0 .5rem; }
p { margin: 0 0 1rem; }
ul { margin: 0; padding: 0; list-style: none; }

.wrap { width: min(1180px, 100% - 1.6rem); margin-inline: auto; }
.main { padding: 1.2rem 0 3rem; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.star { color: var(--gold); }

.skip {
  position: absolute; inset-inline-start: -9999px; top: 0; background: var(--deep);
  color: #fff; padding: .6rem 1rem; z-index: 99;
}
.skip:focus { inset-inline-start: 0; }

/* ---------------- top bar ---------------- */
.topbar { background: var(--deep); color: #dfe9d2; font-size: .82rem; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 38px; flex-wrap: wrap; }
.topbar-date { display: flex; align-items: center; gap: .5rem; opacity: .92; }
.topbar-date .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(168, 212, 0, .25); }
.topbar-date .sep { opacity: .4; }
.topbar-links { display: flex; align-items: center; gap: .35rem; }
.tsocial {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  color: #dfe9d2; background: rgba(255, 255, 255, .09); transition: .18s;
}
.tsocial:hover { background: var(--sc, var(--brand)); color: #fff; transform: translateY(-1px); }
.tlink { color: #dfe9d2; padding: .1rem .6rem; border-inline-start: 1px solid rgba(255, 255, 255, .2); margin-inline-start: .4rem; }
.tlink:hover { color: var(--brand); }

/* ---------------- masthead ---------------- */
.masthead {
  background:
    radial-gradient(900px 200px at 100% -60%, rgba(0, 196, 228, .10), transparent 70%),
    var(--white);
  border-bottom: 1px solid var(--line);
}
.masthead-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.2rem; padding: .9rem 0; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .85rem; color: var(--deep); min-width: 0; }
.brand-logo { height: 66px; width: auto; flex: none; }
.brand-text strong { display: block; font-family: var(--head); font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.brand-text small { display: block; color: var(--muted); font-size: .84rem; }

.searchbox { display: flex; align-items: stretch; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; min-width: min(340px, 100%); }
.searchbox input { flex: 1; border: 0; background: transparent; padding: .6rem 1.1rem; font: inherit; font-size: .92rem; color: var(--ink); outline: none; }
.searchbox button { border: 0; background: var(--brand); color: var(--deep); padding: 0 1.1rem; cursor: pointer; display: grid; place-items: center; }
.searchbox button:hover { background: var(--brand-dark); color: #fff; }

/* ---------------- main nav ---------------- */
.mainnav { background: linear-gradient(180deg, var(--brand), var(--brand-dark)); box-shadow: 0 2px 10px rgba(20, 48, 10, .18); position: sticky; top: 0; z-index: 40; }
.mainnav-inner { display: flex; align-items: center; }
.nav-list { display: flex; flex-wrap: wrap; }
.nav-list > li { position: relative; }
.nav-list > li > a {
  display: flex; align-items: center; gap: .35rem; color: var(--deep); font-weight: 700;
  font-size: .95rem; padding: .72rem 1rem; border-inline-end: 1px solid rgba(20, 48, 10, .10);
}
.nav-list > li > a:hover, .nav-list > li > a.is-active { background: var(--deep); color: var(--brand); }
.nav-icon { font-size: .95rem; }
.caret { font-size: .7rem; opacity: .7; }
.submenu {
  position: absolute; inset-inline-start: 0; top: 100%; min-width: 210px; background: var(--white);
  border: 1px solid var(--line); border-top: 3px solid var(--brand); border-radius: 0 0 10px 10px;
  box-shadow: var(--shadow); padding: .35rem 0; display: none; z-index: 50;
}
.nav-list > li:hover .submenu, .nav-list > li:focus-within .submenu { display: block; }
.submenu a { display: block; padding: .45rem 1rem; color: var(--ink); font-size: .9rem; }
.submenu a:hover { background: var(--bg); color: var(--brand-dark); }

.nav-toggle { display: none; align-items: center; gap: .45rem; background: transparent; border: 0; font: inherit; font-weight: 700; color: var(--deep); padding: .7rem .2rem; cursor: pointer; }
.nav-toggle span { display: block; width: 18px; height: 2px; background: var(--deep); }

/* ---------------- ticker ---------------- */
.ticker { background: var(--deep); color: #eef4e4; }
.ticker-inner { display: flex; align-items: center; gap: .8rem; height: 40px; overflow: hidden; }
.ticker-label { flex: none; background: var(--orange); color: #2a1c00; font-weight: 700; font-size: .8rem; padding: .18rem .7rem; border-radius: 4px; }
.ticker-view { flex: 1; overflow: hidden; }
.ticker-track { display: flex; gap: 2.5rem; white-space: nowrap; width: max-content; animation: ticker 38s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { font-size: .88rem; }
.ticker-item::before { content: "◂"; color: var(--brand); margin-inline-end: .45rem; }
.ticker-item a { color: #eef4e4; }
.ticker-item a:hover { color: var(--brand); }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(50%); } }
@media (prefers-reduced-motion: reduce) { .ticker-track { animation: none; } }

/* ---------------- flash ---------------- */
.flash { margin: 1rem 0 0; padding: .8rem 1.1rem; border-radius: var(--radius); border: 1px solid; background: #eef7dc; border-color: #cfe39a; color: #40560f; }
.flash-error { background: #fdecea; border-color: #f2c6c2; color: #a3271e; }

/* ---------------- slider ---------------- */
.slider { position: relative; margin: 1.2rem 0; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--deep); }
.slide { margin: 0; display: none; position: relative; }
.slide.is-on { display: block; }
.slide img { width: 100%; height: clamp(220px, 38vw, 430px); object-fit: cover; }
.slide figcaption { position: absolute; inset-inline: 0; bottom: 0; padding: 2.4rem 1.6rem 1.3rem; color: #fff; background: linear-gradient(transparent, rgba(11, 26, 5, .88)); }
.slide figcaption h2 { font-size: clamp(1.2rem, 3vw, 2rem); margin: 0 0 .3rem; }
.slide figcaption p { margin: 0 0 .7rem; opacity: .9; }
.slider-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .85); color: var(--deep); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.slider-nav.prev { inset-inline-start: .8rem; }
.slider-nav.next { inset-inline-end: .8rem; }
.slider-nav:hover { background: var(--brand); }
.slider-dots { position: absolute; inset-inline: 0; bottom: .6rem; display: flex; justify-content: center; gap: .35rem; }
.slider-dots .dot { width: 9px; height: 9px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .5); cursor: pointer; padding: 0; }
.slider-dots .dot.on { background: var(--brand); width: 22px; border-radius: 999px; }

/* ---------------- hero ---------------- */
.hero-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 1rem; margin: 1.2rem 0 1.6rem; }
.hero-lead { display: block; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); color: inherit; }
.hero-media { position: relative; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--brand), var(--cyan)); }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-text { padding: 1rem 1.2rem 1.2rem; }
.hero-text h2 { font-size: clamp(1.15rem, 2.2vw, 1.65rem); margin: .5rem 0 .4rem; }
.hero-text p { color: var(--muted); margin: 0 0 .5rem; }
.hero-text time { font-size: .82rem; color: var(--muted); }
.hero-lead:hover h2 { color: var(--brand-dark); }

.hero-side { display: grid; gap: .7rem; align-content: start; }
.hero-item { display: flex; gap: .7rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .55rem; color: inherit; box-shadow: 0 1px 2px rgba(20, 48, 10, .04); }
.hero-item:hover { border-color: var(--brand); }
.hero-item-media { flex: none; width: 92px; height: 68px; border-radius: 8px; overflow: hidden; background: var(--bg); display: grid; place-items: center; }
.hero-item-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-item-text { display: flex; flex-direction: column; justify-content: center; gap: .25rem; min-width: 0; }
.hero-item-text strong { font-size: .95rem; font-weight: 600; line-height: 1.45; }
.hero-item-text time { font-size: .76rem; color: var(--muted); }

/* ---------------- layout ---------------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.4rem; align-items: start; }
.content { min-width: 0; }

/* ---------------- section head ---------------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.8rem 0 .9rem; border-bottom: 2px solid var(--line); }
.section-head h2 { display: flex; align-items: center; gap: .45rem; font-size: 1.22rem; margin: 0; padding: 0 0 .45rem; border-bottom: 3px solid var(--sec, var(--brand)); }
.section-head .sec-icon { font-size: 1rem; }
.section-head .more { font-size: .84rem; color: var(--muted); }
.section-head .more:hover { color: var(--brand-dark); }
.section-head .more span { color: var(--brand); }

/* ---------------- news cards ---------------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1rem; }
.news-grid--4 { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(20, 48, 10, .04); transition: .18s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: #d5dfc4; }
.news-thumb { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--bg); }
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-fallback { width: 100%; height: 100%; display: grid; place-items: center; font-family: var(--head); font-size: 2rem; color: rgba(255, 255, 255, .9); background: linear-gradient(135deg, var(--brand), var(--cyan)); }
.thumb-fallback.big { font-size: 4rem; }
.chip { position: absolute; inset-block-start: .5rem; inset-inline-start: .5rem; background: var(--chip, var(--brand)); color: #14300a; font-size: .72rem; font-weight: 700; padding: .12rem .55rem; border-radius: 4px; }
.chip-breaking { background: #e02020; color: #fff; inset-inline-start: auto; inset-inline-end: .5rem; }
.news-body { padding: .8rem .9rem 1rem; }
.news-body h3 { font-size: 1.02rem; margin: 0 0 .35rem; }
.news-body h3 a { color: var(--ink); }
.news-body h3 a:hover { color: var(--brand-dark); }
.news-body p { color: var(--muted); font-size: .88rem; margin: 0 0 .6rem; }
.news-meta { display: flex; justify-content: space-between; gap: .5rem; font-size: .76rem; color: var(--muted); border-top: 1px dashed var(--line); padding-top: .5rem; }

/* post (article / page / event detail) */
.post { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; box-shadow: var(--shadow); }
.post--wide { max-width: 900px; margin-inline: auto; }
.post-head h1 { font-size: clamp(1.4rem, 3vw, 2.1rem); margin: .5rem 0 .5rem; }
.post-head .chip { position: static; display: inline-block; }
.post-meta { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .82rem; color: var(--muted); border-block: 1px solid var(--line); padding: .5rem 0; margin-bottom: 1.1rem; }
.post-figure { margin: 0 0 1.1rem; }
.post-figure img { width: 100%; border-radius: 10px; }
.post-figure figcaption { font-size: .8rem; color: var(--muted); padding-top: .4rem; text-align: center; }
.post-summary { font-size: 1.05rem; font-weight: 600; color: #2f3d22; border-inline-start: 4px solid var(--brand); background: #f7fbec; padding: .8rem 1rem; border-radius: 8px; }
.post-body { font-size: 1.04rem; line-height: 2; }
.post-body h2, .post-body h3 { margin-top: 1.4rem; }
.post-body img { border-radius: 10px; margin: 1rem auto; }
.post-body blockquote { border-inline-start: 4px solid var(--gold); background: #fffbea; margin: 1rem 0; padding: .7rem 1rem; border-radius: 8px; }
.gallery { margin: 1.4rem 0; }
.gallery-title { font-size: 1.05rem; border-inline-start: 4px solid var(--brand); padding-inline-start: .6rem; margin-bottom: .8rem; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem; }
.gallery-grid figure { margin: 0; }
.gallery-grid img { width: 100%; height: 150px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); transition: .18s; }
.gallery-grid a:hover img { border-color: var(--brand); transform: translateY(-2px); }
.gallery-grid figcaption { font-size: .78rem; color: var(--muted); padding-top: .3rem; text-align: center; }

.post-source { font-size: .86rem; color: var(--muted); }
.tag-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; }
.tag { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .15rem .7rem; font-size: .8rem; color: var(--muted); }
.tag:hover { border-color: var(--brand); color: var(--brand-dark); }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; border-top: 1px solid var(--line); padding-top: .9rem; font-size: .85rem; }
.share a { background: var(--deep); color: #fff; padding: .25rem .8rem; border-radius: 999px; font-size: .8rem; }
.share a:hover { background: var(--brand); color: var(--deep); }

/* crumbs, page head, filters, pager */
.crumbs { font-size: .82rem; color: var(--muted); padding: .9rem 0 .3rem; }
.crumbs span { opacity: .5; margin: 0 .2rem; }
.page-head { margin: .4rem 0 1.1rem; }
.page-head h1 { font-size: clamp(1.4rem, 3vw, 2rem); border-inline-start: 5px solid var(--brand); padding-inline-start: .7rem; }
.lede { color: var(--muted); margin: 0; }
.filter-bar { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.2rem; }
.pill { background: var(--white); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .9rem; font-size: .86rem; color: var(--ink); }
.pill:hover { border-color: var(--chip, var(--brand)); }
.pill.on { background: var(--deep); color: #fff; border-color: var(--deep); }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1.6rem 0 0; }
.pager a { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: .4rem 1rem; font-size: .88rem; }
.pager a:hover { background: var(--brand); color: var(--deep); border-color: var(--brand); }
.pager-now { font-size: .84rem; color: var(--muted); }
.empty { background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); padding: 1.6rem; text-align: center; color: var(--muted); }

/* ---------------- sidebar ---------------- */
.sidebar { display: grid; gap: 1rem; align-content: start; position: sticky; top: 60px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: 0 1px 2px rgba(20, 48, 10, .04); }
.panel-head { font-size: 1.02rem; margin: -1rem -1rem .8rem; padding: .6rem 1rem; background: var(--deep); color: #fff; border-radius: var(--radius) var(--radius) 0 0; border-bottom: 3px solid var(--brand); }
.ranked li { display: flex; gap: .6rem; align-items: flex-start; padding: .5rem 0; border-bottom: 1px dashed var(--line); font-size: .9rem; }
.ranked li:last-child { border-bottom: 0; }
.rank { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 6px; background: var(--brand); color: var(--deep); font-weight: 700; font-size: .8rem; }
.ranked li:nth-child(1) .rank { background: var(--gold); }
.ranked li:nth-child(2) .rank { background: var(--orange); }
.ranked a { color: var(--ink); }
.ranked a:hover { color: var(--brand-dark); }
.cat-list li { border-bottom: 1px dashed var(--line); }
.cat-list li:last-child { border-bottom: 0; }
.cat-list a { display: flex; align-items: center; gap: .5rem; padding: .45rem 0; color: var(--ink); font-size: .9rem; }
.cat-list a:hover { color: var(--brand-dark); }
.cat-dot { width: 10px; height: 10px; border-radius: 3px; }
.follow-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; }
.follow { display: flex; align-items: center; gap: .4rem; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .5rem; font-size: .8rem; color: var(--ink); }
.follow:hover { background: var(--sc); border-color: var(--sc); color: #fff; }

/* ---------------- events ---------------- */
.event-row { display: grid; gap: .7rem; }
.event-card { display: flex; align-items: center; gap: .9rem; background: var(--white); border: 1px solid var(--line); border-inline-start: 4px solid var(--cyan); border-radius: var(--radius); padding: .7rem .9rem; color: inherit; }
.event-card:hover { box-shadow: var(--shadow); }
.event-date { flex: none; width: 58px; text-align: center; background: var(--deep); color: #fff; border-radius: 8px; padding: .35rem 0; line-height: 1.2; }
.event-date b { display: block; font-size: 1.3rem; font-family: var(--head); }
.event-date i { display: block; font-size: .68rem; font-style: normal; opacity: .85; }
.event-info { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.event-info strong { font-size: 1rem; }
.event-sum { font-size: .85rem; color: var(--muted); }
.event-meta { display: flex; flex-wrap: wrap; gap: .8rem; font-size: .78rem; color: var(--muted); }
.badge { flex: none; font-size: .74rem; font-weight: 700; padding: .15rem .6rem; border-radius: 999px; align-self: flex-start; }
.badge-live { background: #fdecea; color: #b3261e; }
.badge-soon { background: #eef7dc; color: #4a6410; }
.badge-past { background: #eceff0; color: var(--muted); }

.event-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
.event-tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: inherit; display: flex; flex-direction: column; }
.event-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.event-tile.is-past { opacity: .72; }
.event-tile-media { position: relative; aspect-ratio: 16 / 9; background: var(--bg); display: block; }
.event-tile-media img { width: 100%; height: 100%; object-fit: cover; }
.event-stamp { position: absolute; inset-block-start: .5rem; inset-inline-end: .5rem; background: rgba(20, 48, 10, .9); color: #fff; border-radius: 8px; padding: .25rem .5rem; text-align: center; line-height: 1.15; }
.event-stamp b { display: block; font-size: 1.05rem; font-family: var(--head); }
.event-stamp i { display: block; font-size: .65rem; font-style: normal; }
.event-tile-body { display: flex; flex-direction: column; gap: .35rem; padding: .8rem .9rem 1rem; }
.event-tile-body strong { font-size: 1rem; }
.event-tile-body .muted { font-size: .85rem; }
.event-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .7rem; margin: 0 0 1.2rem; }
.event-facts div { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
.event-facts span { display: block; font-size: .76rem; color: var(--muted); }

/* ---------------- apps ---------------- */
.app-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .8rem; }
.app-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem .7rem; text-align: center; color: inherit; display: grid; gap: .3rem; justify-items: center; }
.app-card:hover { border-color: var(--brand); box-shadow: var(--shadow); }
.app-card strong { font-size: .92rem; }
.app-card small { font-size: .74rem; color: var(--muted); }
.app-icon { width: 56px; height: 56px; border-radius: 14px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--cyan)); }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-icon .letter { font-family: var(--head); font-size: 1.5rem; color: #fff; }
.app-icon.lg { width: 72px; height: 72px; border-radius: 18px; }

.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }
.app-tile { display: flex; gap: .9rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.app-tile h3 { font-size: 1.05rem; margin: 0; }
.app-tile p { font-size: .88rem; color: var(--muted); margin: .35rem 0 .6rem; }
.app-tile-body { min-width: 0; }
.store-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.store { background: var(--deep); color: #fff; font-size: .78rem; padding: .22rem .7rem; border-radius: 999px; }
.store:hover { background: var(--brand); color: var(--deep); }

/* ---------------- websites ---------------- */
.site-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .8rem; }
.site-card { display: flex; align-items: center; gap: .7rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; color: inherit; }
.site-card:hover { border-color: var(--cyan); box-shadow: var(--shadow); }
.site-logo { flex: none; width: 44px; height: 44px; border-radius: 10px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(135deg, var(--cyan), var(--brand)); }
.site-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.site-logo .letter { font-family: var(--head); font-size: 1.25rem; color: #fff; }
.site-logo.lg { width: 56px; height: 56px; }
.site-text { display: flex; flex-direction: column; min-width: 0; }
.site-text strong { font-size: .95rem; }
.site-text small { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.site-tile { display: flex; gap: .8rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; color: inherit; }
.site-tile:hover { border-color: var(--cyan); box-shadow: var(--shadow); }
.site-tile-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.site-tile-body .muted { font-size: .85rem; }
.domain { font-size: .76rem; color: var(--cyan); direction: ltr; text-align: right; }

/* ---------------- social ---------------- */
.social-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; }
.social-card { display: grid; justify-items: center; gap: .25rem; background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--sc); border-radius: var(--radius); padding: 1rem .6rem; color: var(--sc); text-align: center; }
.social-card strong { color: var(--ink); font-size: .9rem; }
.social-card small { color: var(--muted); font-size: .76rem; }
.social-card:hover { background: var(--sc); color: #fff; }
.social-card:hover strong, .social-card:hover small { color: #fff; }

.social-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.social-tile { display: grid; justify-items: center; gap: .3rem; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1rem; text-align: center; color: var(--ink); }
.social-tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--sc); }
.social-mark { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--sc); color: #fff; }
.social-tile strong { font-size: 1rem; }
.social-tile small { color: var(--muted); font-size: .78rem; }
.followers { font-size: .8rem; color: var(--brand-dark); font-weight: 700; }
.follow-btn { margin-top: .4rem; font-size: .8rem; border: 1px solid var(--sc); color: var(--sc); border-radius: 999px; padding: .15rem .9rem; }
.social-tile:hover .follow-btn { background: var(--sc); color: #fff; }

/* ---------------- forms ---------------- */
.contact-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.form .field { margin-bottom: .9rem; }
.form label { display: block; font-size: .86rem; font-weight: 600; margin-bottom: .25rem; }
.form label b { color: #b3261e; }
.form input, .form textarea {
  width: 100%; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: .94rem; background: var(--bg); color: var(--ink);
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--brand); background: #fff; }
.form .err { color: #b3261e; font-size: .8rem; margin: .25rem 0 0; }
.contact-list li { display: flex; gap: .5rem; padding: .35rem 0; font-size: .9rem; }
.contact-list span { flex: none; }
.map iframe { width: 100%; border: 0; border-radius: 10px; margin-top: .8rem; }

.btn { display: inline-block; background: var(--deep); color: #fff; border: 0; border-radius: 10px; padding: .55rem 1.3rem; font: inherit; font-weight: 700; font-size: .92rem; cursor: pointer; }
.btn:hover { background: var(--brand); color: var(--deep); }
.btn-lg { padding: .7rem 1.7rem; font-size: 1rem; }
.btn-gold { background: var(--gold); color: #3a2c00; }
.btn-gold:hover { background: var(--orange); color: #3a2c00; }

/* ---------------- footer ---------------- */
.footer { background: var(--deep); color: #cfdcbe; margin-top: 3rem; border-top: 4px solid var(--brand); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: 1.6rem; padding: 2.2rem 0 1.6rem; }
.footer h3 { color: #fff; font-size: 1.1rem; margin: .5rem 0 .4rem; }
.footer h4 { color: var(--brand); font-size: .98rem; margin: 0 0 .7rem; padding-bottom: .4rem; border-bottom: 1px solid rgba(255, 255, 255, .12); }
.footer p { font-size: .88rem; opacity: .85; }
.footer a { color: #cfdcbe; }
.footer a:hover { color: var(--brand); }
.footer-logo { height: 70px; width: auto; }
.footer-col ul li { padding: .22rem 0; font-size: .88rem; }
.footer-col ul li::marker { content: ""; }
.footer-social { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.footer-social a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .08); }
.footer-social a:hover { background: var(--sc); color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); font-size: .82rem; padding: .8rem 0; opacity: .8; text-align: center; }

.to-top { position: fixed; inset-inline-end: 1rem; bottom: 1rem; width: 42px; height: 42px; border: 0; border-radius: 50%; background: var(--brand); color: var(--deep); font-size: .9rem; cursor: pointer; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s; z-index: 30; }
.to-top.show { opacity: 1; pointer-events: auto; }

/* ---------------- responsive ---------------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .contact-layout { grid-template-columns: 1fr; }
}

/* ---------------- phones ----------------
   The header used to eat a third of the screen before any news appeared:
   two-line top bar, stacked logo, full-width search, then the menu. Below it
   is one compact strip, and article cards become rows so several fit at once. */
@media (max-width: 720px) {
  .topbar-inner { min-height: 34px; font-size: .76rem; flex-wrap: nowrap; }
  .topbar-date .greg, .topbar-date .sep { display: none; }
  .topbar-links { gap: .25rem; }
  .tsocial { width: 24px; height: 24px; }
  .tlink { padding-inline: .45rem; }

  .masthead-inner { padding: .5rem 0 .6rem; gap: .5rem; }
  .brand { flex: 1 1 100%; gap: .55rem; }
  .brand-logo { height: 48px; }
  .brand-text strong { font-size: 1.02rem; }
  .brand-text small { display: none; }
  .searchbox { flex: 1 1 100%; min-width: 0; }
  .searchbox input { padding: .42rem .9rem; font-size: .86rem; }
  .searchbox button { padding: 0 .9rem; }

  .nav-toggle { display: flex; padding: .55rem .2rem; }
  .nav-list { display: none; width: 100%; flex-direction: column; background: var(--deep); border-radius: 0 0 10px 10px; }
  .nav-list.open { display: flex; }
  .nav-list > li > a { color: #eef4e4; border-inline-end: 0; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .submenu { position: static; display: block; box-shadow: none; border: 0; background: transparent; padding: 0; }
  .submenu a { color: #b9c9a5; padding-inline-start: 2rem; }

  .ticker-inner { height: 34px; }
  .ticker-item { font-size: .8rem; }

  .slider { margin: .8rem 0; }
  .hero-grid { margin: .8rem 0 1.2rem; gap: .7rem; }
  .hero-text { padding: .8rem .9rem 1rem; }
  .section-head { margin: 1.3rem 0 .7rem; }
  .section-head h2 { font-size: 1.08rem; }

  .post { padding: 1rem; border-radius: 10px; }
  .post-body { font-size: 1rem; line-height: 1.95; }
  .post-summary { font-size: .98rem; padding: .7rem .8rem; }
  .share a { padding: .22rem .65rem; font-size: .76rem; }
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .5rem; }
  .gallery-grid img { height: 110px; }

  .footer-grid { grid-template-columns: 1fr; gap: 1.1rem; padding: 1.6rem 0 1.2rem; }
  .footer-logo { height: 56px; }
}

@media (max-width: 560px) {
  /* News as rows: a phone screen shows four of these instead of one card. */
  .news-grid, .news-grid--4 { grid-template-columns: 1fr; gap: .55rem; }
  .news-card { display: flex; align-items: stretch; min-height: 94px; }
  .news-thumb { flex: 0 0 116px; aspect-ratio: auto; }
  .news-thumb img { height: 100%; }
  .news-thumb .thumb-fallback { font-size: 1.5rem; }
  .news-body { padding: .55rem .7rem; display: flex; flex-direction: column; justify-content: center; gap: .2rem; }
  .news-body h3 { font-size: .94rem; margin: 0; }
  .news-body p { display: none; }
  .news-meta { border-top: 0; padding-top: 0; font-size: .72rem; }
  .chip { font-size: .66rem; padding: .1rem .4rem; }

  .event-card { flex-wrap: wrap; padding: .6rem .7rem; }
  .event-date { width: 48px; }
  .event-info strong { font-size: .95rem; }
  .event-sum { display: none; }
  .badge { order: 3; }

  .app-row { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .site-row, .social-row { grid-template-columns: 1fr 1fr; }
  .social-card { padding: .7rem .4rem; }
  .pill { font-size: .8rem; padding: .2rem .7rem; }
  .page-head h1 { font-size: 1.35rem; }
}
