/* Falaj. One shape runs the page: the round mouth of a falaj's wells, seen from above.
   Colours are the oasis's own: plaster, palm green, water, and the sand of a dry channel. */
:root {
  --bg: #f6f6f3;
  --surface: #eaeae4;
  --paper: #ffffff;
  --ink: #101210;
  --muted: #595f58;
  --accent: #1c5a38;
  --accent-deep: #164a2d;
  --accent-ink: #ffffff;
  --water: #bfe4d6;
  --dry: #e4d9c4;
  --step-small: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-body: clamp(1.0625rem, 1rem + 0.25vw, 1.1875rem);
  --step-lead: clamp(1.25rem, 1.1rem + 0.7vw, 1.625rem);
  --step-head: clamp(2rem, 1.3rem + 3.2vw, 4rem);
  --step-title: clamp(2rem, 1.4rem + 1.6vw, 2.75rem);
  --step-dense: 1rem;
  --edge: clamp(16px, 2.2vw, 32px);
  --gap: clamp(110px, 14vw, 200px);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: "Switzer", "Helvetica Neue", Arial, sans-serif; font-size: 100%; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { margin: 0; font-size: var(--step-body); line-height: 1.5; letter-spacing: -0.005em; }
h1, h2, h3, p, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.2em; }
h1, h2 { font-weight: 600; letter-spacing: -0.04em; line-height: 0.95; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.86em; letter-spacing: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
[id] { scroll-margin-top: 24px; }

.btn { display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 500; padding: 12px 28px; min-height: 56px; cursor: pointer; transition: background-color 150ms var(--ease), transform 120ms var(--ease); }
.btn:hover { background: var(--accent-deep); text-decoration: none; }
.btn:active { transform: scale(0.98); }
.btn.quiet { background: var(--surface); color: var(--ink); }
.btn.quiet:hover { background: #dfdfd7; }
.btn.ink { background: var(--ink); color: var(--paper); }
.btn.ink:hover { background: #2a2d2a; }
.btn[aria-disabled="true"] { background: var(--muted); cursor: progress; }
form[aria-busy="true"] .btn[aria-disabled="true"]::before { content: ""; width: 12px; height: 12px; margin-right: 12px; border-radius: 50%; background: currentColor; animation: well 800ms var(--ease) infinite alternate; }
@keyframes well { from { transform: scale(0.45); } to { transform: scale(1); } }

/* ---------- first screen */
.hero { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 12px; min-height: 100svh; }
.card { background: var(--paper); display: flex; flex-direction: column; align-items: center; text-align: center; padding: 28px; min-height: calc(100svh - 24px); }
.wells { display: flex; justify-content: space-between; width: 100%; }
.well { display: block; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); transition: transform 180ms var(--ease); }
.well:hover { transform: scale(1.14); }
.well.dry { background: var(--dry); }
.well.idle { background: var(--surface); }
.mark { display: flex; align-items: baseline; justify-content: center; gap: 22px; font-weight: 600; letter-spacing: -0.04em; line-height: 1; font-size: 68px; }
.mark [lang="ar"] { font-family: "Noto Kufi Arabic", "Segoe UI", Tahoma, sans-serif; font-size: 58px; letter-spacing: 0; }
.card .mark { margin-top: auto; }
.card h1 { font-size: clamp(40px, 3.6vw, 56px); margin-top: 44px; }
.card .say { max-width: 36ch; margin-top: 26px; }
.address { display: flex; align-items: center; gap: 10px; margin-top: 34px; max-width: 100%; background: var(--surface); border-radius: 999px; padding: 6px 6px 6px 26px; }
.address code { font-size: var(--step-dense); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.address .btn { min-height: 48px; padding: 10px 24px; flex: none; }
.ways { display: flex; gap: 34px; justify-content: center; margin-top: auto; padding-top: 44px; font-size: var(--step-dense); font-weight: 500; }
.source { position: sticky; top: 12px; height: calc(100svh - 24px); overflow: hidden; }
.source .shot { position: absolute; left: 7%; top: 50%; width: 128svh; height: 128svh; transform: translateY(-50%); border-radius: 50%; object-fit: cover; object-position: 50% 62%; }
.source .later { opacity: 0; transition: opacity 1600ms ease; }
.source.turned .later { opacity: 1; }
.source figcaption { position: absolute; left: 0; bottom: 0; max-width: 14ch; font-size: var(--step-small); color: var(--muted); line-height: 1.35; }

/* ---------- try a tool */
.try { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 88svh; margin-top: var(--gap); }
.plate-wrap { padding: 0 40px; display: flex; align-items: center; }
.plate { width: 100%; aspect-ratio: 1; background: var(--water); padding: clamp(24px, 3vw, 44px); display: flex; flex-direction: column; }
.plate.dry { background: var(--dry); }
.plate .count { font-size: var(--step-head); font-weight: 600; letter-spacing: -0.04em; line-height: 0.95; }
.plate .count.words { font-size: var(--step-title); line-height: 1.02; max-width: 16ch; }
.plate ol { margin-top: 28px; display: grid; gap: 12px; }
.plate .codes li { display: grid; grid-template-columns: 6.2em 1fr; }
.plate .codes b { font-weight: 500; }
.plate .pairs li { display: grid; grid-template-columns: 9.5em 1fr; gap: 0 12px; }
.plate .pairs li > span:first-child { color: var(--muted); }
.plate .note { margin-top: 22px; font-size: var(--step-dense); line-height: 1.5; max-width: 52ch; }
.plate .proof { margin-top: auto; padding-top: 24px; font-size: var(--step-dense); line-height: 1.45; }
.plate .proof a { text-decoration: underline; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.ask { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 0 var(--edge) 0 24px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px 28px; color: var(--muted); }
.tabs [aria-current] { color: var(--ink); font-weight: 500; }
.ask h2 { font-size: var(--step-title); }
.ask .what { max-width: 34ch; margin-top: 48px; }
.ask .nofield { max-width: 34ch; margin-top: 36px; color: var(--muted); }
.ask label { display: block; margin-top: 36px; font-size: var(--step-small); color: var(--muted); }
.ask input[name]:not([type="hidden"]) { display: block; width: 100%; max-width: 30ch; margin-top: 8px; min-height: 56px; border: 0; border-radius: 0; background: var(--surface); padding: 12px 18px; font: inherit; font-size: var(--step-lead); color: var(--ink); }
.cells { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.cells .btn { min-height: 72px; width: 100%; }
.call summary { list-style: none; }
.call summary::-webkit-details-marker { display: none; }
.call[open] { grid-column: 1 / -1; }
.call pre { margin: 8px 0 0; padding: 16px 18px; background: var(--paper); overflow-x: auto; font-size: 14px; line-height: 1.5; }
.wait { margin-top: 14px; font-size: var(--step-small); color: var(--muted); }

/* ---------- the ten tools */
.tools { display: grid; grid-template-columns: min(620px, 46vw) minmax(0, 1fr); gap: 64px; padding: 0 var(--edge); margin-top: var(--gap); align-items: start; }
.col { container-type: inline-size; }
.col h2 { font-size: 40cqw; line-height: 0.8; margin-left: -0.05em; }
.bars { margin-top: 20px; display: grid; gap: 6px; }
.bars details { background: var(--surface); }
.bars summary { list-style: none; display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 12px 18px; font-size: var(--step-dense); font-weight: 500; cursor: pointer; transition: background-color 150ms var(--ease); }
.bars summary:hover { background: #dfdfd7; }
.bars summary::-webkit-details-marker { display: none; }
.bars summary span { color: var(--muted); font-weight: 400; margin-left: 14px; margin-right: auto; }
.bars summary::after { content: "+"; font-size: 22px; font-weight: 400; margin-left: 12px; }
.bars details[open] summary::after { content: "\2212"; }
.bars .panel { padding: 4px 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; font-size: var(--step-dense); }
.bars .row { display: flex; justify-content: space-between; gap: 24px; }
.bars .row span:first-child { flex: none; }
.bars .row span:last-child { color: var(--muted); text-align: right; }
.bars .about { margin-top: -8px; max-width: 60ch; }
.bars pre { margin: 6px 0 0; padding: 14px 16px; background: var(--paper); overflow-x: auto; font-size: 14px; line-height: 1.5; }
.every { margin-top: 22px; font-size: var(--step-dense); max-width: 62ch; }
.round { margin: 0; }
.round img { display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; object-fit: cover; }
.round figcaption { margin-top: 14px; font-size: var(--step-small); color: var(--muted); max-width: 44ch; }
.tools .round { position: sticky; top: 24px; }
.tools .round img { object-position: 32% 100%; }

/* ---------- how it works: one request, four fields */
.how { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: var(--gap); }
.field { position: relative; min-height: 84svh; padding: 28px; }
.f1 { background: var(--paper); }
.f2 { background: var(--water); }
.f3 { background: var(--surface); }
.f4 { background: var(--accent); color: var(--accent-ink); }
.field h2 { font-size: var(--step-lead); letter-spacing: -0.03em; line-height: 1.05; }
.clause { position: absolute; left: 28px; right: 28px; bottom: 28px; max-width: 12ch; font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.03em; line-height: 1.1; }
.req { position: absolute; top: 30%; left: 50%; width: min(260px, calc(100% - 40px)); transform: translateX(-50%); background: var(--paper); color: var(--ink); padding: 18px; display: grid; gap: 10px; font-size: var(--step-dense); line-height: 1.35; transition: transform 150ms var(--ease); }
.f1 .req { background: var(--surface); }
.field:hover .req { transform: translate(-50%, -6px); }
.req-name { font-weight: 600; letter-spacing: -0.02em; }
.req-row { display: grid; gap: 1px; }
.req-row span:first-child { font-size: var(--step-small); color: var(--muted); }
.req-row span:last-child { overflow-wrap: anywhere; }

/* ---------- how to add it */
.add { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 64px; padding: 0 var(--edge); margin-top: var(--gap); align-items: start; }
.add-say h2 { font-size: var(--step-title); max-width: 9ch; }
.add-say p { margin-top: 28px; max-width: 34ch; }
.add-say .round { margin-top: 48px; max-width: 340px; }
.add-say .round img { object-position: 50% 80%; }
.clients { display: grid; grid-template-columns: minmax(0, 1fr); gap: 40px; }
.clients h3 { font-size: var(--step-lead); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }
.clients .where { margin-top: 4px; color: var(--muted); }
.cmd { display: flex; align-items: stretch; gap: 8px; margin-top: 14px; }
.cmd pre { flex: 1; min-width: 0; margin: 0; padding: 18px; background: var(--surface); overflow-x: auto; font-size: 14px; line-height: 1.5; }
.cmd .btn { flex: none; }

/* ---------- is it running */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 var(--edge); margin-top: var(--gap); }
.tile { min-width: 0; background: var(--surface); aspect-ratio: 3 / 2; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; gap: 16px; }
.tile b { font-size: var(--step-lead); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; overflow-wrap: break-word; }
.tile.head { grid-column: span 2; aspect-ratio: auto; background: var(--accent); color: var(--accent-ink); }
.tile.head h2 { font-size: var(--step-title); }
.tile.head p { display: block; max-width: 40ch; font-size: var(--step-body); }
.tile p { font-size: var(--step-dense); display: flex; align-items: flex-start; gap: 10px; line-height: 1.4; }
.tile p i { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; background: var(--accent); flex: none; }
.tile.dry { background: var(--dry); }
.tile.dry p i, .tile.warn p i { background: var(--ink); }
.tile.idle p i { background: var(--muted); }

/* ---------- the last calls */
.log { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: 64px; padding: 0 var(--edge); margin-top: var(--gap); align-items: start; }
.log h2 { font-size: var(--step-title); max-width: 8ch; }
.log-say p { margin-top: 28px; max-width: 32ch; }
.log table { width: 100%; border-collapse: collapse; font-size: var(--step-dense); }
.log th { text-align: left; font-weight: 400; font-size: var(--step-small); color: var(--muted); padding: 0 14px 12px; }
.log td { padding: 14px; vertical-align: top; }
.log tbody tr:nth-child(odd) { background: var(--surface); }
.log .asked { overflow-wrap: anywhere; color: var(--muted); max-width: 36ch; }
.log .none { font-size: var(--step-lead); max-width: 20ch; }

/* ---------- the day's share */
.share { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto 1fr; gap: 0 48px; min-height: 88svh; padding: 0 var(--edge); margin-top: var(--gap); }
.share h2 { font-size: var(--step-title); grid-column: 1; }
.picks { grid-column: 1; justify-self: start; align-self: start; display: inline-flex; flex-wrap: wrap; gap: 4px; margin-top: 28px; padding: 6px; background: var(--surface); border-radius: 34px; }
.picks label { padding: 12px 20px; border-radius: 999px; font-size: var(--step-dense); cursor: pointer; transition: background-color 150ms var(--ease); }
#share-pages:checked ~ .picks label[for="share-pages"], #share-reads:checked ~ .picks label[for="share-reads"], #share-calls:checked ~ .picks label[for="share-calls"] { background: var(--ink); color: var(--paper); }
#share-pages:focus-visible ~ .picks label[for="share-pages"], #share-reads:focus-visible ~ .picks label[for="share-reads"], #share-calls:focus-visible ~ .picks label[for="share-calls"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.share .round { grid-column: 2; grid-row: 1 / 3; width: clamp(200px, 24vw, 340px); }
.figs { grid-column: 1 / -1; align-self: end; margin-top: 48px; }
.fig { display: none; grid-template-columns: 1fr minmax(0, 30ch); gap: 48px; align-items: end; }
#share-pages:checked ~ .figs .fig-pages, #share-reads:checked ~ .figs .fig-reads, #share-calls:checked ~ .figs .fig-calls { display: grid; }
.big { font-size: clamp(140px, 19vw, 320px); font-weight: 600; letter-spacing: -0.05em; line-height: 0.8; margin-left: -0.04em; }
.big .unit { font-size: 0.22em; letter-spacing: -0.02em; }
.why { font-size: var(--step-body); }

/* ---------- the close */
.foot { background: var(--accent); color: var(--accent-ink); margin-top: var(--gap); padding: clamp(28px, 4vw, 56px) var(--edge) 40px; }
.foot :focus-visible { outline-color: var(--accent-ink); }
.foot .line { display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(6px, 1.2vw, 18px); }
.foot .line i { aspect-ratio: 1; border-radius: 50%; background: var(--water); }
.foot .line i.dry { background: var(--dry); }
.foot .line i.idle { background: var(--accent-deep); }
.foot .mark { justify-content: flex-start; margin-top: 56px; font-size: clamp(56px, 8vw, 120px); }
.foot .mark [lang="ar"] { font-size: 0.85em; }
.foot .cols { display: grid; grid-template-columns: 2fr 2fr 5fr; gap: 32px; margin-top: 56px; font-size: var(--step-dense); }
.foot li + li { margin-top: 8px; }
.foot .about p + p { margin-top: 14px; }
.foot .about a, .foot .credits a { text-decoration: underline; text-underline-offset: 0.2em; }
.foot .credits { margin-top: 48px; font-size: var(--step-small); line-height: 1.6; max-width: 74ch; }

/* ---------- things that rise as they come into view (only when scripts run) */
.js .rise { opacity: 0; transform: translateY(24px); transition: opacity 600ms var(--ease), transform 600ms var(--ease); }
.js .rise.in { opacity: 1; transform: none; }
.js .rise:nth-child(2) { transition-delay: 70ms; }
.js .rise:nth-child(3) { transition-delay: 140ms; }
.js .rise:nth-child(4) { transition-delay: 210ms; }
.js .rise:nth-child(n + 5) { transition-delay: 260ms; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .rise { opacity: 1; transform: none; transition: none; }
  .source .later { transition: none; }
  .btn, .well, .req { transition: none; }
  form[aria-busy="true"] .btn[aria-disabled="true"]::before { animation: none; }
}

@media (max-width: 900px) {
  .how { grid-template-columns: 1fr 1fr; }
  .field { min-height: 60svh; }
  .foot .cols { grid-template-columns: 1fr 1fr; }
  .foot .about { grid-column: 1 / -1; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { aspect-ratio: auto; min-height: 150px; }
  .tile p i { display: none; }
  .log { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .log h2 { max-width: none; }
}

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 0; min-height: 0; }
  .source { position: relative; top: 0; height: auto; order: -1; overflow: visible; aspect-ratio: 1; }
  .source .shot { left: 0; top: 0; width: 100%; height: 100%; transform: none; }
  .source figcaption { display: none; }
  .card { margin-top: -24px; min-height: 0; padding: 20px 20px 24px; position: relative; }
  .well { width: 26px; height: 26px; }
  .card .mark { margin-top: 30px; }
  .mark { font-size: 44px; gap: 14px; }
  .mark [lang="ar"] { font-size: 38px; }
  .card h1 { font-size: 8vw; margin-top: 24px; }
  .card .say { margin-top: 16px; }
  .address { margin-top: 22px; padding: 0; width: 100%; flex-direction: column; background: none; border-radius: 0; gap: 8px; }
  .address code { display: block; width: 100%; background: var(--surface); border-radius: 999px; padding: 15px 22px; font-size: 13px; }
  .address .btn { width: 100%; min-height: 52px; }
  .ways { flex-wrap: wrap; gap: 10px 22px; padding-top: 26px; }
  .try { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .plate-wrap { padding: 0 16px; }
  .plate { aspect-ratio: auto; min-height: calc(100vw - 32px); }
  .plate .pairs li { grid-template-columns: 1fr; }
  .ask { padding: 0 16px; margin-top: 20px; gap: 24px; }
  .tabs { gap: 8px 18px; }
  .ask .what { margin-top: 16px; }
  .ask .nofield, .ask label { margin-top: 20px; }
  .ask input[name]:not([type="hidden"]) { max-width: none; }
  .cells { grid-template-columns: minmax(0, 1fr); }
  .cells .btn { min-height: 60px; }
  .tools { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .tools .round { position: static; order: -1; }
  .bars summary { flex-wrap: wrap; }
  .bars summary span { flex-basis: 100%; order: 3; margin-left: 0; }
  .how { grid-template-columns: 1fr; }
  .field { min-height: 0; padding: 20px 20px 36px; display: flex; flex-direction: column; }
  .field h2 { margin-bottom: 18px; }
  .clause { position: static; order: 1; max-width: none; }
  .req { position: static; order: 2; transform: none; margin-top: 32px; }
  .field:hover .req { transform: none; }
  .add { grid-template-columns: minmax(0, 1fr); gap: 36px; }
  .add-say .round { display: none; }
  .cmd { flex-direction: column; }
  .cmd .btn { min-height: 48px; }
  .board { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .tile { padding: 16px; min-height: 0; gap: 6px; }
  .tile.head { grid-column: auto; padding: 20px 16px 24px; gap: 16px; }
  .tile b { font-size: var(--step-body); }
  .tile p i { display: none; }
  .log { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .log th:nth-child(3), .log td:nth-child(3), .log th:nth-child(4), .log td:nth-child(4) { display: none; }
  .log th, .log td { padding-left: 10px; padding-right: 10px; }
  .share { grid-template-columns: minmax(0, 1fr); min-height: 84svh; }
  .share .round { display: none; }
  .picks { flex-direction: column; border-radius: 28px; width: 100%; }
  .fig { grid-template-columns: 1fr; gap: 20px; }
  .big { font-size: 30vw; }
  .big .unit { display: block; font-size: var(--step-lead); letter-spacing: -0.01em; line-height: 1.4; margin-top: 10px; }
  .foot .cols { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
}
