/* The rules both hosts share (C12): the base, the type styles, the icons and the buttons, moved from site.css unchanged
   so that the public site (site.css) and the staff panel (admin.css) draw them from one place. Role tokens only
   (DESIGN.md §0.1), logical properties only (§0.2). Loaded after tokens.css and fonts.css, before the host's own sheet. */

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
/* Component display rules must never defeat the hidden attribute (alerts and panels toggle with it). */
[hidden] { display: none !important; }
html { font-family: var(--q-font-family-base); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--q-surface-page);
  color: var(--q-text-primary);
  font-family: var(--q-font-family-base);
  font-size: var(--q-type-body-size);
  font-weight: var(--q-type-body-weight);
  line-height: var(--q-type-body-line-height);
}
img, svg { max-inline-size: 100%; }
h1, h2, h3, h4, h5, p, ul, ol, figure { margin: 0; }
:is(h1, h2, h3, h4, h5) { text-wrap: balance; }
a { color: var(--q-text-link); text-underline-offset: 0.2em; }
a:hover { color: var(--q-text-link-hover); }
/* Browser surfaces carry the palette too (§13). */
::selection { background: var(--q-selection-bg); color: var(--q-selection-text); }
html { scrollbar-color: var(--q-border-strong) var(--q-surface-sunken); caret-color: var(--q-focus-ring); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: var(--q-focus-width) solid var(--q-focus-ring); outline-offset: var(--q-focus-offset); }
.q-on-inverse :focus-visible, .q-on-inverse:focus-visible { outline-color: var(--q-focus-ring-on-inverse); }
.q-vh { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* The icon sprite is a source of <use> references, never drawn itself. */
.q-sprite { display: none; }

/* Type styles: size, weight, line-height and tracking all from typography.* (Arabic values swap in under :lang(ar)). */
.t-display { font-family: var(--q-type-display-family); font-size: var(--q-type-display-size); font-weight: var(--q-type-display-weight); line-height: var(--q-type-display-line-height); letter-spacing: var(--q-type-display-letter-spacing); }
.t-h1 { font-family: var(--q-type-h1-family); font-size: var(--q-type-h1-size); font-weight: var(--q-type-h1-weight); line-height: var(--q-type-h1-line-height); letter-spacing: var(--q-type-h1-letter-spacing); }
.t-h2 { font-family: var(--q-type-h2-family); font-size: var(--q-type-h2-size); font-weight: var(--q-type-h2-weight); line-height: var(--q-type-h2-line-height); letter-spacing: var(--q-type-h2-letter-spacing); }
.t-h3 { font-family: var(--q-type-h3-family); font-size: var(--q-type-h3-size); font-weight: var(--q-type-h3-weight); line-height: var(--q-type-h3-line-height); letter-spacing: var(--q-type-h3-letter-spacing); }
.t-h4 { font-family: var(--q-type-h4-family); font-size: var(--q-type-h4-size); font-weight: var(--q-type-h4-weight); line-height: var(--q-type-h4-line-height); letter-spacing: var(--q-type-h4-letter-spacing); }
.t-h5 { font-family: var(--q-type-h5-family); font-size: var(--q-type-h5-size); font-weight: var(--q-type-h5-weight); line-height: var(--q-type-h5-line-height); letter-spacing: var(--q-type-h5-letter-spacing); }
.t-lead { font-family: var(--q-type-lead-family); font-size: var(--q-type-lead-size); font-weight: var(--q-type-lead-weight); line-height: var(--q-type-lead-line-height); letter-spacing: var(--q-type-lead-letter-spacing); }
.t-body { font-family: var(--q-type-body-family); font-size: var(--q-type-body-size); font-weight: var(--q-type-body-weight); line-height: var(--q-type-body-line-height); letter-spacing: var(--q-type-body-letter-spacing); }
.t-small { font-family: var(--q-type-small-family); font-size: var(--q-type-small-size); font-weight: var(--q-type-small-weight); line-height: var(--q-type-small-line-height); letter-spacing: var(--q-type-small-letter-spacing); }
.t-caption { font-family: var(--q-type-caption-family); font-size: var(--q-type-caption-size); font-weight: var(--q-type-caption-weight); line-height: var(--q-type-caption-line-height); letter-spacing: var(--q-type-caption-letter-spacing); }
.t-label { font-family: var(--q-type-label-family); font-size: var(--q-type-label-size); font-weight: var(--q-type-label-weight); line-height: var(--q-type-label-line-height); letter-spacing: var(--q-type-label-letter-spacing); }
:lang(tr) .t-label, :lang(en) .t-label { text-transform: uppercase; }
.t-display, .t-h1, .t-h2, .t-h3, .t-h4, .t-h5 { color: var(--q-text-heading); }
/* Changa is never set in italic: never let the browser fake one. */
.t-display, .t-h1, .t-h2, .t-h3 { font-synthesis: none; }
/* The Latin brand name set in live type ("QATANA"): the wordmark's face, never the wordmark itself (A9). */
.q-brandname { font-family: var(--q-font-family-display); font-weight: var(--q-font-weight-semibold); font-synthesis: none; letter-spacing: var(--q-font-letter-spacing-none); }

.wrap { max-inline-size: var(--q-layout-container-max); margin-inline: auto; padding-inline: var(--q-space-gutter); }
.sec { padding-block: var(--q-space-section); }
.muted { color: var(--q-text-muted); }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* ============================================================
   ICONS: 24px grid, stroke = borderWidth.strong, square caps, miter joins (S2, G3)
   ============================================================ */
.q-icon { inline-size: var(--q-size-icon); block-size: var(--q-size-icon); flex: none; fill: none; stroke: currentColor; stroke-width: var(--q-border-width-strong); stroke-linecap: square; stroke-linejoin: miter; }
.q-icon--sm { inline-size: var(--q-size-icon-sm); block-size: var(--q-size-icon-sm); }
.q-icon--lg { inline-size: var(--q-size-icon-lg); block-size: var(--q-size-icon-lg); }
.q-icon--flip:dir(rtl) { transform: scaleX(-1); }
/* Brand marks: filled, never stroked, only in colours the platform allows (D8). */
.q-icon--brand { fill: currentColor; stroke: none; }
.q-btn--whatsapp .q-icon--brand, .q-fab .q-icon--brand { color: var(--q-whatsapp-glyph); }

/* Theme toggle (A10; shared by both hosts): a bare 36px icon button, no tile behind it (rule 13). It needs script, so
   without it it is gone. */
.theme-toggle { display: grid; place-items: center; inline-size: var(--q-size-control-md); block-size: var(--q-size-control-md); padding: 0; border: 0; background: none;
  color: var(--q-text-secondary); cursor: pointer; transition: color var(--q-motion-duration-fast) var(--q-motion-easing-standard); }
.theme-toggle:hover { color: var(--q-text-heading); }
.theme-toggle .to-light, .is-dark .theme-toggle .to-dark { display: none; }
.is-dark .theme-toggle .to-light { display: block; }
:root:not(.js) .theme-toggle { display: none; }

/* ============================================================
   BUTTONS (DESIGN.md §10.2)
   ============================================================ */
.q-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--q-space-2);
  min-block-size: var(--q-size-control-md); padding-inline: var(--q-space-5); padding-block: var(--q-space-1);
  border: var(--q-border-width-strong) solid transparent; border-radius: var(--q-radius-base);
  font-size: var(--q-type-small-size); font-weight: var(--q-font-weight-medium); line-height: 1.3;
  text-decoration: none; cursor: pointer; text-align: center; text-wrap: balance;
  transition: background-color var(--q-motion-duration-fast) var(--q-motion-easing-standard),
              border-color var(--q-motion-duration-fast) var(--q-motion-easing-standard),
              color var(--q-motion-duration-fast) var(--q-motion-easing-standard),
              box-shadow var(--q-motion-duration-fast) var(--q-motion-easing-standard);
}
.q-btn--sm { min-block-size: var(--q-size-control-sm); padding-inline: var(--q-space-4); font-size: var(--q-type-caption-size); }
.q-btn--lg { min-block-size: var(--q-size-control-lg); padding-inline: var(--q-space-6); font-size: var(--q-type-small-size); font-weight: var(--q-font-weight-medium); }
.q-btn--block { display: flex; inline-size: 100%; }
.q-btn:active { transform: translateY(var(--q-border-width-hairline)); }

.q-btn--primary { background: var(--q-action-primary-bg); color: var(--q-action-primary-text); }
.q-btn--primary:hover { background: var(--q-action-primary-bg-hover); color: var(--q-action-primary-text); }
.q-btn--primary:active { background: var(--q-action-primary-bg-active); }

.q-btn--secondary { background: transparent; border-color: var(--q-action-secondary-border); color: var(--q-action-secondary-text); }
.q-btn--secondary:hover { background: var(--q-action-secondary-bg-hover); color: var(--q-action-secondary-text); }
.q-btn--secondary:active { background: var(--q-action-secondary-bg-active); }

.q-btn--whatsapp { background: var(--q-whatsapp-bg); color: var(--q-whatsapp-text); }
.q-btn--whatsapp:hover { background: var(--q-whatsapp-bg-hover); color: var(--q-whatsapp-text); }
.q-btn--whatsapp:active { background: var(--q-whatsapp-bg-active); }

.q-btn:disabled, .q-btn[aria-disabled="true"] {
  background: var(--q-action-disabled-bg); border-color: transparent; color: var(--q-action-disabled-text); cursor: not-allowed; transform: none;
}
.q-btn[aria-busy="true"] { cursor: progress; }
/* A brand mark is never greyed out (no recolouring): a disabled button drops it and keeps its label. */
.q-btn:disabled .q-icon--brand, .q-btn[aria-disabled="true"] .q-icon--brand { display: none; }

/* ============================================================
   FIELDS (DESIGN.md §10.4, §10.5): moved from site.css in C13, unchanged, so the panel's forms draw them too. The
   field, its label and error row, the input, select and textarea, a fieldset that is a field, the checkbox.
   ============================================================ */
.q-field { display: grid; gap: var(--q-space-2); min-inline-size: 0; }
.q-label { font-size: var(--q-type-small-size); font-weight: var(--q-font-weight-medium); line-height: var(--q-type-small-line-height); color: var(--q-text-primary); }
.q-optional { font-weight: var(--q-font-weight-regular); color: var(--q-text-muted); }
/* An error row: icon + text, never colour alone (§0.6); always in the page, shown only on an invalid field. */
.q-error { display: none; align-items: flex-start; gap: var(--q-space-1); margin: 0; font-size: var(--q-type-small-size); line-height: var(--q-type-small-line-height); color: var(--q-field-text-error); }
.q-error .q-icon { flex: none; margin-block-start: 0.15em; }
.q-field.is-invalid > .q-error { display: flex; }
/* A hint under a field (§10.4): what it takes, linked by aria-describedby; added in C13 for the panel's forms. */
.q-hint { margin: 0; font-size: var(--q-type-caption-size); line-height: var(--q-type-caption-line-height); color: var(--q-text-muted); }

.q-input, .q-select, .q-textarea {
  inline-size: 100%; min-block-size: var(--q-size-control-lg);
  padding-inline: var(--q-space-3); padding-block: var(--q-space-2);
  background: var(--q-field-bg); color: var(--q-field-text);
  border: var(--q-border-width-hairline) solid var(--q-field-border); border-radius: var(--q-radius-base);
  /* 1.6, not tighter: the Arabic face's descenders (ج، ع، ي) reach below a 1.4 line and the field clips them. */
  font: inherit; font-size: var(--q-type-small-size); line-height: 1.6;
  transition: border-color var(--q-motion-duration-fast) var(--q-motion-easing-standard), box-shadow var(--q-motion-duration-fast) var(--q-motion-easing-standard);
}
.q-textarea { min-block-size: calc(var(--q-size-control-md) * 2.5); resize: vertical; padding-block: var(--q-space-3); }
/* iOS zooms into any field under 16px: touch screens get 16px field text, the phone widget's country search too. */
@media (pointer: coarse) { .q-input, .q-select, .q-textarea { font-size: 16px; } }
.q-input::placeholder, .q-textarea::placeholder { color: var(--q-field-placeholder); opacity: 1; }
.q-input:hover, .q-select:hover, .q-textarea:hover { border-color: var(--q-field-border-hover); }
.q-input:focus-visible, .q-select:focus-visible, .q-textarea:focus-visible {
  border-color: var(--q-field-border-hover);
  outline: var(--q-focus-width) solid var(--q-focus-ring); outline-offset: var(--q-focus-offset);
}
/* Error: colour + a thicker edge (an inset shadow, no layout shift) + the icon row. A phone error marks the number
   only; the country keeps its normal border. */
.q-field.is-invalid :is(.q-input, .q-textarea), [aria-invalid="true"]:is(.q-input, .q-textarea) {
  border-color: var(--q-field-border-error); box-shadow: inset 0 0 0 var(--q-border-width-hairline) var(--q-field-border-error);
}

/* Select: native control, chevron drawn as a 45° turned square (G3). */
.q-select-wrap { position: relative; }
.q-select { appearance: none; -webkit-appearance: none; padding-inline-end: var(--q-space-10); cursor: pointer; }
.q-select-wrap::after {
  content: ""; position: absolute; inset-inline-end: var(--q-space-4); inset-block-start: 50%;
  inline-size: var(--q-space-2); block-size: var(--q-space-2); margin-block-start: calc(var(--q-space-1) * -1);
  border-inline-end: var(--q-border-width-strong) solid var(--q-text-secondary); border-block-end: var(--q-border-width-strong) solid var(--q-text-secondary);
  transform: rotate(45deg); pointer-events: none;
}
.q-select-wrap:dir(rtl)::after { transform: rotate(-45deg); }
.q-select-wrap[hidden] { display: none; }

fieldset.q-field { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
fieldset.q-field legend { padding: 0; margin-block-end: var(--q-space-3); }

/* Checkbox: a 24px box inside a ≥ 40px target row. */
.q-check { display: flex; align-items: flex-start; gap: var(--q-space-3); min-block-size: var(--q-size-touch-min); padding-block: var(--q-space-3); cursor: pointer; }
.q-check input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  inline-size: var(--q-size-icon); block-size: var(--q-size-icon);
  border: var(--q-border-width-strong) solid var(--q-field-border); border-radius: var(--q-radius-base); background: var(--q-field-bg);
  display: grid; place-content: center; cursor: pointer;
  transition: background-color var(--q-motion-duration-fast) var(--q-motion-easing-standard), border-color var(--q-motion-duration-fast) var(--q-motion-easing-standard);
}
.q-check input::after {
  content: ""; inline-size: calc(var(--q-space-1) * 1.5); block-size: calc(var(--q-space-3)); margin-block-start: calc(var(--q-space-1) * -0.5);
  /* Physical sides on purpose: a tick reads the same in RTL and LTR (it is not a direction cue). */
  border-right: var(--q-border-width-strong) solid var(--q-field-checkmark); border-bottom: var(--q-border-width-strong) solid var(--q-field-checkmark);
  transform: rotate(45deg) scale(0); transition: transform var(--q-motion-duration-fast) var(--q-motion-easing-enter);
}
.q-check input:checked { background: var(--q-field-checked); border-color: var(--q-field-checked); }
.q-check input:checked::after { transform: rotate(45deg) scale(1); }
.q-check input:hover { border-color: var(--q-field-border-hover); }
.q-check input:checked:hover { border-color: var(--q-field-checked); }
.q-check input:focus-visible { outline: var(--q-focus-width) solid var(--q-focus-ring); outline-offset: var(--q-focus-offset); }
.q-check input[aria-invalid="true"], .q-field.is-invalid .q-check input { border-color: var(--q-field-border-error); }
.q-check-text { font-size: var(--q-type-caption-size); line-height: var(--q-type-caption-line-height); color: var(--q-text-secondary); padding-block-start: var(--q-space-1); }

/* The form's grid (§10.10, moved from site.css in C13 with the fields): one column, two from md; q-span-2 takes both. */
.q-form-grid { display: grid; gap: var(--q-space-8) var(--q-space-6); }
@media (min-width: 768px) {
  .q-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .q-form-grid .q-span-2 { grid-column: 1 / -1; }
}

/* ============================================================
   ERROR PAGE (C07; shared by both hosts since C12): one heading, one sentence, the way back. Title → text 16px, text → button 32px (graded, D20).
   ============================================================ */
.error-body { display: grid; gap: var(--q-space-4); justify-items: start; }
.error-body p { max-inline-size: var(--q-layout-measure-text); color: var(--q-text-secondary); text-wrap: pretty; }
.error-body > .q-btn { margin-block-start: var(--q-space-4); }
/* A withdrawn project's page (C10): WhatsApp, then the projects on show, side by side where they fit. */
.error-actions { display: flex; flex-wrap: wrap; gap: var(--q-space-3); margin-block-start: var(--q-space-4); }

/* Text from Markdown (ADR 0031): a project's description on its page and in the panel's preview. The page's own type,
   a quiet rhythm, no decoration of its own. */
.q-prose { display: grid; gap: var(--q-space-3); min-inline-size: 0; overflow-wrap: anywhere; }
.q-prose > * { margin: 0; }
.q-prose h3, .q-prose h4, .q-prose h5, .q-prose h6 { margin-block-start: var(--q-space-3); color: var(--q-text-heading); font-weight: var(--q-font-weight-bold); }
.q-prose h3 { font-size: var(--q-type-h4-size); line-height: var(--q-type-h4-line-height); }
.q-prose h4, .q-prose h5, .q-prose h6 { font-size: var(--q-type-h5-size); line-height: var(--q-type-h5-line-height); }
.q-prose strong { color: var(--q-text-primary); font-weight: var(--q-font-weight-bold); }
.q-prose ul, .q-prose ol { display: grid; gap: var(--q-space-1); padding-inline-start: var(--q-space-6); }
.q-prose li::marker { color: var(--q-text-accent); }
.q-prose a { color: var(--q-text-link); text-decoration: underline; text-underline-offset: 0.3em; text-decoration-thickness: var(--q-border-width-hairline); }
.q-prose a:hover { color: var(--q-text-link-hover); }
.q-prose blockquote { padding-inline-start: var(--q-space-4); border-inline-start: var(--q-border-width-strong) solid var(--q-text-accent); color: var(--q-text-primary); }
.q-prose hr { border: 0; border-block-start: var(--q-border-width-hairline) solid var(--q-border-subtle); }
.q-prose table { display: block; max-inline-size: 100%; overflow-x: auto; border-collapse: collapse; }
.q-prose th, .q-prose td { padding: var(--q-space-2) var(--q-space-3); text-align: start; border-block-end: var(--q-border-width-hairline) solid var(--q-border-subtle); }
.q-prose th { color: var(--q-text-muted); font-weight: var(--q-font-weight-regular); }
.q-prose code { font-family: inherit; color: var(--q-text-primary); }
