/* MA Tools website.
   Brand colours (owner, 2026-10-27): burnt brown, with the gold and cream of his logo.
   Contrast measured (WCAG AA 4.5:1 for text): brown on white 11.70:1, cream on brown 7.82:1,
   gold on brown 5.59:1, brown on gold 5.59:1 (4.82:1 on the hover gold). Header and footer are a darker brown. Gold on white is only 2.09:1,
   so gold is never text on white: it is a button colour, an underline or a mark.
   Logical properties (inline-start/end) so the same sheet works right-to-left. */
:root {
  --deep: #5C2A12;         /* burnt brown: headings, secondary buttons, links */
  --bar: #24110A;          /* darkest brown: header and footer (owner, 2026-10-27); cream 12.11:1, gold 8.66:1 */
  --deep-hover: #6E3317;   /* white 9.77:1, cream 6.54:1 */
  --gold: #E1A95F;         /* main buttons (brown text on it), accents */
  --gold-hover: #D69B4C;
  --telegram: #197DB3;      /* Telegram buttons (owner, 2026-10-28). Telegram's own #229ED9 is only 3.02:1
                              with white text; this darker shade of it is 4.54:1 */
  --telegram-hover: #166FA0; /* 5.50:1 */
  --cream: #E3D1B4;        /* text on brown, box borders */
  --text: #2B1E17;          /* 16.14:1 on white */
  --muted: #6B5A4E;        /* 6.57:1 on white, 5.75:1 on the cream boxes */
  --bg: #ffffff;
  --box: #F6EFE3;          /* light cream boxes: cards, questions, bands */
  --box-border: #E3D1B4;
  --radius: 10px;
  --heading-font: Barlow, "Segoe UI Semibold", system-ui, -apple-system, Roboto, sans-serif;
}

/* Headings: Barlow SemiBold, served from this site (SIL Open Font License, fonts/Barlow-OFL.txt).
   Latin only; the Arabic pages will need their own font. */
@font-face {
  font-family: Barlow;
  src: url("/assets/fonts/barlow-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  font: 1rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex; flex-direction: column; min-height: 100vh;   /* footer at the bottom of short pages */
}
img { max-width: 100%; height: auto; }
a { color: var(--deep); text-underline-offset: 3px; text-decoration-color: var(--gold); text-decoration-thickness: 2px; }
a:hover { color: var(--deep-hover); }
:focus-visible { outline: 3px solid var(--deep); outline-offset: 2px; }
h1, h2, h3 { color: var(--deep); font-family: var(--heading-font); font-weight: 600; line-height: 1.2; }
h1 { font-size: clamp(2rem, 4.5vw, 2.75rem); margin: 0 0 .75rem; }
h2 { font-size: 1.6rem; margin: 2.5rem 0 1rem; }
h3 { font-size: 1.25rem; margin: 1.5rem 0 .5rem; }
p, li { max-width: 75ch; }
code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; }
[id] { scroll-margin-top: 16px; }

.wrap { max-width: 1100px; margin-inline: auto; padding-inline: 16px; }
.small { font-size: .85rem; color: var(--muted); }
.lead { font-size: 1.2rem; color: var(--muted); max-width: 60ch; }

.skip {
  position: absolute; inset-inline-start: 8px; top: -100px; z-index: 10;
  background: var(--gold); color: var(--deep); padding: 8px 12px; border-radius: var(--radius); font-weight: 600;
}
.skip:focus { top: 8px; color: var(--deep); }
.preview-banner { margin: 0; max-width: none; background: #fff4cc; color: #5c4500; text-align: center; padding: 8px 16px; font-size: .9rem; }

/* Header and navigation: the links wrap onto a second line on a phone, no menu button needed. */
.site-header { background: var(--bar); border-bottom: 3px solid var(--gold); }
.site-header :focus-visible, .site-footer :focus-visible { outline-color: var(--gold); }   /* visible on brown */
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-block: 12px;
}
.brand img { display: block; height: 60px; width: auto; }
.site-nav ul, .site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.site-nav a {
  display: block; padding: 10px 12px; border-radius: 8px;
  color: var(--cream); font-weight: 500; text-decoration: none;
}
.site-nav a:hover { background: var(--deep); color: #fff; }
.site-nav a[aria-current] {
  color: var(--gold); text-decoration: underline; text-decoration-thickness: 3px;
  text-decoration-color: var(--gold); text-underline-offset: 8px;
}

main { flex: 1 0 auto; width: 100%; padding-block: 32px 48px; }

/* Buttons: at least 44 px high (the small one 36 px, with space around it). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
  padding: 10px 20px; border: 2px solid var(--gold); border-radius: var(--radius);
  background: var(--gold); color: var(--deep); font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--gold-hover); border-color: var(--gold-hover); color: var(--deep); }
.btn-outline { background: #fff; color: var(--deep); border-color: var(--deep); }
.btn-outline:hover { background: var(--box); color: var(--deep-hover); border-color: var(--deep-hover); }
.btn-small { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn-small:hover { background: var(--deep-hover); border-color: var(--deep-hover); color: #fff; }
.btn-telegram { background: var(--telegram); border-color: var(--telegram); color: #fff; }
.btn-telegram:hover { background: var(--telegram-hover); border-color: var(--telegram-hover); color: #fff; }
.btn-small { min-height: 36px; padding: 4px 14px; font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero { display: grid; gap: 32px; align-items: center; }
.hero figure { margin: 0; }
@media (min-width: 900px) { .hero { grid-template-columns: 1fr 1fr; } }

/* Gray boxes */
.card, details, .band { background: var(--box); border: 1px solid var(--box-border); border-radius: var(--radius); }
.cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { padding: 20px; }
.card h2, .card h3 { margin: 12px 0 8px; }
.card p { margin: 0 0 8px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-block: 12px 4px; }
.card-head h3 { margin: 0; }
.group { margin: 0; font-size: .85rem; font-weight: 600; color: var(--muted); }
.icon { display: block; width: 40px; height: 40px; }
.band { padding: 24px; margin-block: 40px; }
.band h2 { margin-top: 0; }
.note { border-inline-start: 4px solid var(--gold); background: var(--box); padding: 12px 16px; }
.steps { padding-inline-start: 1.5rem; }
.steps li { margin-block: .4rem; }
figure { margin: 24px 0; }

/* Home: the four tools as rows, each one a link to its section on the Tools page */
.rows { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--box-border); }
.rows li { max-width: none; border-bottom: 1px solid var(--box-border); }
.rows a {
  display: grid; gap: 2px 24px; padding: 14px 8px; text-decoration: none; color: var(--text);
}
.rows a:hover { background: var(--box); }
.rows strong { color: var(--deep); font-size: 1.1rem; }
.rows strong::after { content: " \2192"; color: var(--gold-hover); }
.rows span { color: var(--muted); }
@media (min-width: 760px) { .rows a { grid-template-columns: 220px 1fr; align-items: baseline; } }

.areas { display: grid; gap: 0 32px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.areas h3 { margin-top: .75rem; }
.areas p { margin-top: 0; }

/* Tools page: one section per tool, text on one side and the video on the other, pictures below */
.tool { margin-block: 56px; padding-top: 32px; border-top: 1px solid var(--box-border); }
.tool-main { display: grid; gap: 24px; align-items: start; }
@media (min-width: 900px) { .tool-main { grid-template-columns: 1fr 1fr; } }
.tool-main figure { margin: 0; }
.tool-title { display: flex; align-items: center; gap: 16px; }
.tool-title .icon { width: 64px; height: 64px; flex: none; }
.tool-title h2 { margin: 0; font-size: clamp(1.75rem, 4vw, 2.25rem); }
.features { padding-inline-start: 1.25rem; }
.features li { margin-block: .3rem; }
.features li::marker { color: var(--gold); }
.shots { display: grid; gap: 16px; margin-top: 24px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.shots figure { margin: 0; }

/* Download card */
.download-card { max-width: 760px; }
.file-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 16px 0; }
.file-facts dt { font-weight: 600; }
.file-facts dd { margin: 0; }

/* Buy page */
.buy { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.price { margin: 8px 0 16px; font: 600 2.75rem/1 var(--heading-font); color: var(--deep); }
.price span { font: 400 1rem system-ui, sans-serif; color: var(--muted); }

/* Videos: a YouTube player loads only when Play is pressed (site.js) */
.video-box iframe, .yt { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--radius); }
.yt {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: var(--deep); color: var(--cream); text-decoration: none; font-weight: 600;
}
.yt:hover { background: var(--deep-hover); color: #fff; }
.yt-play {
  width: 72px; height: 72px; border-radius: 50%; background: var(--gold);
  display: grid; place-items: center;
}
.yt-play::before { content: ""; border-style: solid; border-width: 12px 0 12px 20px; border-color: transparent transparent transparent var(--deep); margin-inline-start: 6px; }
.video-box figcaption { margin-top: 8px; color: var(--muted); font-size: .9rem; }
.video-box, .slot.video { max-width: 860px; }
.video-box video { display: block; width: 100%; height: auto; border-radius: var(--radius); background: var(--deep); }
/* Pictures: small even tiles (two side by side on a phone); a click shows the picture large. */
.shots { grid-template-columns: repeat(auto-fill, minmax(140px, 260px)); align-items: start; }
.tool-main .shots { margin-top: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }   /* beside the text, where a tool has no video */
.shot a.zoom {
  display: block; padding: 6px; cursor: zoom-in;
  background: var(--box); border: 1px solid var(--box-border); border-radius: var(--radius);
}
.shot a.zoom:hover { border-color: var(--deep); }
.shot img { display: block; width: 100%; height: 160px; object-fit: contain; }
.zoom-box { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 96vh; overflow: visible; }
.zoom-box::backdrop { background: rgba(43, 20, 9, .92); }
.zoom-box img { display: block; max-width: 96vw; max-height: 86vh; width: auto; height: auto; border-radius: var(--radius); background: #fff; }
.zoom-box p { margin: 8px auto 0; max-width: 70ch; color: #fff; text-align: center; font-size: .95rem; }
.zoom-close {
  position: absolute; top: 8px; inset-inline-end: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: #fff; color: var(--text); font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.shot figcaption { margin-top: 6px; color: var(--muted); font-size: .85rem; }

details { padding: 12px 16px; margin-block: 8px; }
summary { cursor: pointer; font-weight: 600; color: var(--deep); }
details[open] summary { margin-bottom: 8px; }
details p { margin: 0 0 8px; }

.legal { max-width: 75ch; }
.legal h2 { font-size: 1.3rem; }
.legal h3 { font-size: 1.05rem; color: var(--text); }
blockquote { margin: 16px 0; padding: 12px 16px; border-inline-start: 4px solid var(--deep); background: var(--box); }

.site-footer { background: var(--bar); border-top: 3px solid var(--gold); padding-block: 24px; font-size: .9rem; color: var(--cream); }
.site-footer a { display: inline-block; padding-block: 8px; padding-inline-end: 16px; color: var(--cream); text-decoration-color: var(--gold); }
.site-footer a:hover { color: #fff; }
.site-footer .small { color: var(--cream); }
.site-footer p { margin: 8px 0; }

/* Preview build only: where an image, a video or a missing detail goes. */
.slot {
  display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 20px;
  border: 2px dashed #8a94a3; border-radius: var(--radius); color: #374151;
  background: repeating-linear-gradient(45deg, #f7f8fa, #f7f8fa 12px, #eef1f4 12px, #eef1f4 24px);
}
.slot.wide, .slot.video { aspect-ratio: 16 / 9; }
.slot.free { min-height: 220px; }
.slot.video { border-color: var(--deep); }
.slot.pending { margin-block: 16px; border-color: #b7791f; background: #fff8e6; color: #5c4500; }
.slot p { margin: 0; }
.slot code { background: rgba(255, 255, 255, .85); padding: 1px 4px; border-radius: 4px; }
.slot-tag { font: 600 .8rem/1.2 ui-monospace, Consolas, monospace; }
.slot .ok { color: var(--gold); font-weight: 600; }
