/* ============================================================
   Learn About Mohammad — calm, content-first editorial style.
   Palette: muted sage green, cream/parchment, charcoal text,
   maroon + gold accents (used sparingly). WCAG AA contrast.
   ============================================================ */

:root {
  --sage: #5f7355;
  --sage-dark: #41502f;
  --sage-deep: #34431f;
  --cream: #f8f4ea;
  --cream-2: #f2ecdc;
  --parchment: #efe7d2;
  --sage-soft: #eef1e7;
  --parchment-line: #e0d6bd;
  --charcoal: #292824;
  --ink-soft: #54514a;
  --maroon: #7c2d33;
  --maroon-soft: #f3e3e1;
  --gold: #a9802f;
  --gold-soft: #f4ead0;
  --white: #fffdf7;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(41, 40, 36, 0.06), 0 8px 24px rgba(41, 40, 36, 0.06);
  --maxw: 1120px;
  --readw: 720px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Georgia, "Noto Serif", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial,
    "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--charcoal);
  background: var(--cream);
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  font-family: var(--serif);
  color: var(--sage-deep);
  line-height: 1.25;
  font-weight: 600;
  margin: 0 0 0.5em;
}

p {
  margin: 0 0 1.1em;
}

a {
  color: var(--maroon);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--sage-dark);
}

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

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

.term {
  border-bottom: 1px dotted var(--gold);
  cursor: help;
  font-style: italic;
}

/* ---- Skip link --------------------------------------------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--sage-deep);
  color: var(--white);
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus {
  left: 0;
}

/* ---- Header ------------------------------------------------- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--parchment-line);
  position: sticky;
  top: 0;
  z-index: 40;
}
.site-header__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: inherit;
}
.brand__mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  background: var(--sage);
  color: var(--white);
  border-radius: 50%;
  flex: none;
}
.brand__mark svg {
  width: 22px;
  height: 22px;
  display: block;
}
.brand__title {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--sage-deep);
  line-height: 1.1;
}
.brand__sub {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.2;
  margin-top: 2px;
}
.site-header__tools {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ---- Language switcher ------------------------------------- */
.langswitch {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.langswitch__label {
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.langswitch__select {
  font-family: var(--sans);
  font-size: 0.92rem;
  color: var(--charcoal);
  background: var(--cream);
  border: 1px solid var(--parchment-line);
  border-radius: 999px;
  padding: 0.4rem 1.8rem 0.4rem 0.8rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2341502f' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  cursor: pointer;
}
[dir="rtl"] .langswitch__select {
  padding: 0.4rem 0.8rem 0.4rem 1.8rem;
  background-position: left 0.7rem center;
}

/* ---- Primary nav ------------------------------------------- */
.mainnav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.mainnav__toggle {
  display: none;
  align-items: center;
  gap: 0.5rem;
  background: var(--cream);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--charcoal);
  margin: 0.5rem 0;
  cursor: pointer;
}
.mainnav__toggle-bar,
.mainnav__toggle-bar::before,
.mainnav__toggle-bar::after {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--sage-deep);
  position: relative;
}
.mainnav__toggle-bar::before,
.mainnav__toggle-bar::after {
  content: "";
  position: absolute;
  left: 0;
}
.mainnav__toggle-bar::before {
  top: -5px;
}
.mainnav__toggle-bar::after {
  top: 5px;
}
.mainnav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  border-top: 1px solid var(--parchment-line);
}
.mainnav__list a {
  display: block;
  padding: 0.7rem 0.85rem;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  border-bottom: 3px solid transparent;
}
.mainnav__list a:hover {
  color: var(--sage-deep);
}
.mainnav__list a[aria-current="page"] {
  color: var(--sage-deep);
  border-bottom-color: var(--gold);
  font-weight: 600;
}

/* ---- Layout ------------------------------------------------- */
.page {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}
.breadcrumb ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0.5rem 0 1rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.breadcrumb li + li::before {
  content: "\203a";
  margin-inline-end: 0.4rem;
  color: var(--gold);
}
.breadcrumb a {
  color: var(--ink-soft);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--sage-deep);
  text-decoration: underline;
}

.page-hero {
  background: linear-gradient(180deg, var(--white), var(--cream));
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius-lg);
  padding: 2rem 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}
.page-hero__eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--gold);
  margin: 0 0 0.6rem;
  font-weight: 600;
}
.page-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 0.6rem;
}
.page-hero__summary {
  max-width: var(--readw);
  font-size: 1.12rem;
  color: var(--ink-soft);
}
.page-hero__summary p {
  margin: 0;
}
.page-hero__note {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 2.5rem;
  align-items: start;
}
.layout__main {
  min-width: 0;
  max-width: var(--readw);
}
.layout__aside {
  position: sticky;
  top: 90px;
}

/* ---- Sections / typography --------------------------------- */
.content-section {
  margin-bottom: 2.25rem;
}
.content-section h2,
.qa-section h2,
.related h2 {
  font-size: 1.5rem;
  margin-top: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--parchment-line);
}
.content-section h3 {
  font-size: 1.2rem;
  margin-top: 1.6rem;
  color: var(--sage-dark);
}
.lam-list {
  margin: 0 0 1.2em;
  padding-inline-start: 1.25rem;
}
.lam-list li {
  margin-bottom: 0.4em;
}

/* ---- Callouts ---------------------------------------------- */
.callout {
  background: var(--gold-soft);
  border-inline-start: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
}
.callout__label {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
}
.callout__body p:last-child {
  margin-bottom: 0;
}
.callout--term {
  background: var(--sage-soft, #eef1e7);
  border-inline-start-color: var(--sage);
}
.callout--term .callout__label {
  color: var(--sage-dark);
}
.callout--note {
  background: var(--maroon-soft);
  border-inline-start-color: var(--maroon);
}
.callout--note .callout__label {
  color: var(--maroon);
}

/* ---- Tables ------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
}
.lam-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
  background: var(--white);
}
.lam-table caption {
  text-align: start;
  padding: 0.6rem 0.8rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  background: var(--cream);
}
.lam-table th,
.lam-table td {
  padding: 0.6rem 0.85rem;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--parchment-line);
}
.lam-table thead th {
  background: var(--sage-deep);
  color: var(--white);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: none;
}
.lam-table tbody tr:nth-child(even) {
  background: var(--cream);
}
.lam-table tbody tr:last-child td {
  border-bottom: none;
}

/* ---- Definition lists -------------------------------------- */
.deflist {
  margin: 1rem 0 1.5rem;
}
.deflist__row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--parchment-line);
}
.deflist dt {
  font-weight: 600;
  color: var(--sage-dark);
}
.deflist dd {
  margin: 0;
}

/* ---- Table of contents ------------------------------------- */
.toc {
  background: var(--white);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 2rem;
}
.toc__title {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 700;
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 1.5rem;
}
.toc li {
  margin-bottom: 0.3rem;
  break-inside: avoid;
}
.toc a {
  color: var(--sage-dark);
  text-decoration: none;
  font-size: 0.92rem;
}
.toc a:hover {
  text-decoration: underline;
}

/* ---- Key facts (aside) ------------------------------------- */
.keyfacts {
  background: var(--parchment);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.4rem;
}
.keyfacts__title {
  margin: 0 0 0.75rem;
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--sage-deep);
  font-weight: 600;
}
.keyfacts dl {
  margin: 0;
}
.keyfacts__row {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--parchment-line);
}
.keyfacts__row:last-child {
  border-bottom: none;
}
.keyfacts dt {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin-bottom: 0.15rem;
}
.keyfacts dd {
  margin: 0;
  font-weight: 600;
  color: var(--charcoal);
}

/* ---- Q&A --------------------------------------------------- */
.qa-section {
  margin-top: 2.5rem;
}
.qa {
  border-top: 1px solid var(--parchment-line);
  padding: 1.25rem 0;
}
.qa__q {
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
  color: var(--sage-deep);
}
.qa__a p {
  margin: 0;
  color: var(--ink-soft);
}

/* ---- Related ----------------------------------------------- */
.related {
  margin-top: 2.5rem;
}
.related__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}
.related__list a {
  display: block;
  background: var(--white);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  text-decoration: none;
  height: 100%;
  transition: border-color 0.15s, transform 0.15s;
}
.related__list a:hover {
  border-color: var(--sage);
  transform: translateY(-2px);
}
.related__t {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  color: var(--sage-deep);
  margin-bottom: 0.2rem;
}
.related__d {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* ---- Home grid (cards rendered via blocks) ----------------- */
.cardgrid {
  list-style: none;
  margin: 1rem 0 1.5rem;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
}
.cardgrid a {
  display: block;
  background: var(--white);
  border: 1px solid var(--parchment-line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  text-decoration: none;
  height: 100%;
}
.cardgrid a:hover {
  border-color: var(--sage);
}
.cardgrid__t {
  display: block;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--sage-deep);
  margin-bottom: 0.25rem;
}
.cardgrid__d {
  display: block;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

/* ---- Footer ------------------------------------------------- */
.site-footer {
  background: var(--sage-deep);
  color: var(--cream);
  margin-top: 3rem;
}
.site-footer__inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 1.25rem;
}
.footer-nav {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0;
  margin: 0 0 1.5rem;
}
.footer-nav a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.95rem;
  opacity: 0.9;
}
.footer-nav a:hover {
  opacity: 1;
  text-decoration: underline;
}
.site-footer__note {
  font-size: 0.88rem;
  opacity: 0.85;
  max-width: 70ch;
  margin: 0 0 0.5rem;
}
.site-footer__rev {
  font-size: 0.8rem;
  opacity: 0.7;
  margin: 0;
}
.site-footer a {
  color: var(--gold-soft);
}

/* ---- Back to top ------------------------------------------- */
.to-top {
  position: fixed;
  inset-inline-end: 1.25rem;
  bottom: 1.25rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--sage-deep);
  color: var(--white);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  z-index: 30;
}
.to-top[hidden] {
  display: none;
}

/* ---- RTL tweaks -------------------------------------------- */
[dir="rtl"] body {
  font-size: 19px;
}
[dir="rtl"] .page-hero,
[dir="rtl"] .article {
  text-align: right;
}

/* ---- Responsive -------------------------------------------- */
@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .layout__aside {
    position: static;
    order: -1;
  }
  .toc ul {
    columns: 1;
  }
  .deflist__row {
    grid-template-columns: 1fr;
    gap: 0.1rem;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 17px;
  }
  .mainnav__toggle {
    display: inline-flex;
  }
  .mainnav__list {
    display: none;
    flex-direction: column;
    padding-bottom: 0.5rem;
  }
  .mainnav__list.is-open {
    display: flex;
  }
  .mainnav__list a {
    border-bottom: none;
    padding: 0.6rem 0.25rem;
  }
  .mainnav__list a[aria-current="page"] {
    border-bottom: none;
    border-inline-start: 3px solid var(--gold);
    padding-inline-start: 0.6rem;
  }
  .page-hero {
    padding: 1.5rem 1.25rem;
  }
  .brand__sub {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
