/* QazSociety brand layer, loaded on every page via SITE.customCSS.
   Colours and fonts are set through BRAND in popular.config.ts; this file
   only adds the two flag colours and a few accents. `html` prefixes keep
   these rules ahead of the theme's equally specific selectors. */
html:root {
  --qs-blue: #00ABC2;  /* Kazakhstan blue: accents, washes, text on dark */
  --qs-gold: #FFEC2D;  /* sparingly, and only with dark text */
  --qs-ink: #0E2730;
}

html .g-header { border-bottom: 3px solid var(--qs-blue); }
html .g-footer { border-top: 4px solid var(--qs-gold); }
/* The dark link blue disappears on the ink footer; #00ABC2 on ink is 5.6:1. */
html .g-footer__bottom a { color: var(--qs-blue); }

/* Anchored sections (e.g. /qazspace/#room) clear the sticky header. */
html [id] { scroll-margin-top: 5.5rem; }

/* Forms: account and admin pages. 1rem inputs stop iOS from zooming in. */
html .qs-panel { max-width: 28rem; display: grid; gap: 1.25rem; }
html .qs-form { display: grid; gap: 1rem; }
html .qs-field { display: grid; gap: 0.35rem; font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--text-strong); }
html .qs-field input {
  font: inherit; font-size: 1rem; font-weight: 400; color: var(--text-strong);
  padding: 0.7rem 0.85rem; border: 1px solid var(--border-default); border-radius: 10px; background: #fff;
}
html .qs-field input:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; border-color: var(--color-primary); }
html .qs-hint { font-weight: 400; color: var(--text-muted); }
html .qs-alert { padding: 0.8rem 1rem; border-radius: 10px; font-size: var(--text-sm); }
html .qs-alert--error { background: #FDECEC; color: #8A1C1C; border: 1px solid #F5C2C2; }
html .qs-alert--notice { background: var(--surface-wash); color: var(--qs-ink); border: 1px solid #B8E6EE; }
html .qs-divider { margin: 0; text-align: center; color: var(--text-muted); font-size: var(--text-sm); }
html .qs-btn-block { width: 100%; justify-content: center; }
html .qs-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: var(--text-sm); }
html .qs-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4, 1.5rem); }
@media (max-width: 640px) { html .qs-grid-2 { grid-template-columns: 1fr; } }
/* Header: the account item is a profile icon when signed in (src/middleware.ts); its
   text is for screen readers on desktop and shown in the phone menu. In the phone menu
   the whole row is tappable, not just the words. */
html .qs-nav-avatar { font-size: 1.65rem; vertical-align: middle; color: var(--color-primary); }
html .qs-nav-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 920px) {
  html .g-navlinks a { display: block; padding: 0.85rem 1rem; }
  html .qs-nav-avatar { font-size: 1.3rem; }
  html .qs-nav-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; margin-left: 0.5rem; }
}

/* Buttons by meaning, on top of the theme's g-btn: red removes, cancels or ends;
   green approves or marks as done; teal (g-btn--primary) stays the main action. */
html .qs-btn-danger { background: #fff; color: #B42318; border: 1px solid #E4A3AD; }
html .qs-btn-danger:hover { background: #FDECEC; color: #912018; border-color: #B42318; }
html .qs-btn-danger-solid { background: #B42318; color: #fff; border: 1px solid #B42318; }
html .qs-btn-danger-solid:hover { background: #912018; color: #fff; border-color: #912018; }
html .qs-btn-success { background: #0F6E44; color: #fff; border: 1px solid #0F6E44; }
html .qs-btn-success:hover { background: #0B5634; color: #fff; border-color: #0B5634; }
html .qs-btn-success-outline { background: #fff; color: #0F6E44; border: 1px solid #8CC9A8; }
html .qs-btn-success-outline:hover { background: #E6F3EC; color: #0B5634; border-color: #0F6E44; }
html .qs-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Big booking button on the live office (/qazspace/live/) */
.qs-cta-big { justify-self: start; display: inline-flex; align-items: center; gap: 0.7rem; font-size: 1.15rem; padding: 0.95rem 1.6rem; min-height: 56px; border-radius: 999px; box-shadow: 0 10px 26px rgba(0, 122, 140, 0.28); }
.qs-cta-big:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(0, 122, 140, 0.34); }
@media (max-width: 640px) { .qs-cta-big { justify-self: stretch; justify-content: center; font-size: 1.05rem; } }
/* /qazspace/: "Who is at QazSpace now" button, with a pulsing live dot */
.qs-live-btn { justify-self: start; display: inline-flex; align-items: center; gap: 0.6rem; border-radius: 999px; white-space: normal; text-align: left; }
.qs-live-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #2E9E5B; animation: qs-live-pulse 2s ease-out infinite; }
@keyframes qs-live-pulse { from { box-shadow: 0 0 0 0 rgba(46, 158, 91, 0.55); } 70%, to { box-shadow: 0 0 0 9px rgba(46, 158, 91, 0); } }
@media (prefers-reduced-motion: reduce) { .qs-live-dot { animation: none; } }

/* Sign-in, sign-up and similar pages: the form in a card, a community photo beside it on wide screens */
.qs-auth { display: grid; gap: 2rem; }
.qs-auth__aside { display: none; }
@media (min-width: 960px) {
  .qs-auth { grid-template-columns: minmax(0, 31rem) minmax(0, 1fr); gap: 3rem; align-items: stretch; }
  .qs-auth__card { max-width: none; padding: 2.2rem; border: 1px solid var(--border-subtle); border-radius: 22px; background: #fff; box-shadow: 0 18px 44px rgba(14, 39, 48, 0.08); }
  .qs-auth__aside { display: block; position: relative; overflow: hidden; min-height: 28rem; border-radius: 22px; background: #0E2730; }
  .qs-auth__aside img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
  .qs-auth__aside::after { content: ''; position: absolute; inset: 0; background: linear-gradient(165deg, rgba(0, 171, 194, 0.18) 0%, rgba(14, 39, 48, 0.55) 45%, rgba(14, 39, 48, 0.92) 100%); }
  .qs-auth__aside-body { position: absolute; z-index: 1; left: 2.2rem; right: 2.2rem; bottom: 2.2rem; color: #fff; display: grid; gap: 1rem; }
  .qs-auth__aside-body h2 { margin: 0; font-size: 1.7rem; line-height: 1.2; color: #fff; }
  .qs-auth__aside-body ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.6rem; }
  .qs-auth__aside-body li { display: flex; gap: 0.7rem; align-items: center; font-size: 1.02rem; }
  .qs-auth__aside-body li i { color: #00ABC2; width: 1.2rem; text-align: center; }
  .qs-auth__flag { width: 3rem; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #00ABC2, #FEC50C); }
}

/* Language switcher and dark-mode toggle (added to the header by src/middleware.ts) */
.qs-lang, .qs-theme { position: relative; list-style: none; display: flex; align-items: center; }
.qs-lang summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.8rem; border-radius: 999px; font-weight: 600; color: var(--text-strong); white-space: nowrap; }
.qs-lang summary::-webkit-details-marker { display: none; }
.qs-lang summary:hover, .qs-lang details[open] summary { background: var(--surface-wash); }
.qs-lang summary:focus-visible, .qs-theme__btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
.qs-lang ul { position: absolute; right: 0; top: calc(100% + 0.4rem); z-index: 30; min-width: 10rem; margin: 0; padding: 0.4rem; list-style: none; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: 14px; box-shadow: var(--shadow-lg); }
.qs-lang ul li { list-style: none; }
.qs-lang ul a { display: block; padding: 0.55rem 0.8rem; border-radius: 10px; color: var(--text-strong); text-decoration: none; }
.qs-lang ul a:hover { background: var(--surface-wash); }
.qs-lang ul a[aria-current] { font-weight: 700; color: var(--color-primary); }
.qs-theme__btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; border-radius: 50%; background: none; color: var(--text-strong); cursor: pointer; font-size: 1.05rem; }
.qs-theme__btn:hover { background: var(--surface-wash); }
.qs-theme__btn .fa-sun, :root[data-theme="dark"] .qs-theme__btn .fa-moon { display: none; }
:root[data-theme="dark"] .qs-theme__btn .fa-sun { display: inline-block; }
.qs-theme__label { display: none; }
@media (max-width: 920px) {
  .qs-theme__btn { width: auto; height: auto; padding: 0.55rem 0.8rem; border-radius: 999px; gap: 0.6rem; font: inherit; font-weight: 500; }
  .qs-theme__label { display: inline; }
  .qs-lang ul { position: static; box-shadow: none; border: 0; padding: 0 0 0 1rem; background: none; }
  .qs-lang, .qs-theme { padding: 0.25rem 0; }
}

/* Dark theme: the toggle (or the device setting, on the first visit) sets
   <html data-theme="dark">. Theme tokens first, then the few places with fixed whites. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-page: #0D1A1F;
  --surface-card: #13242A;
  --surface-wash: #0F2F38;
  --surface-wash-soft: #11262D;
  --surface-tertiary: #10222A;
  --surface-code: #1B3038;
  --surface-ink: #071318;
  --text-strong: #EAF4F6;
  --text-body: #C6D6DB;
  --text-muted: #8FA6AE;
  --text-link: #4FD3E3;
  --text-link-hover: #8BE6F0;
  --text-on-brand: #04232A;
  --border-subtle: #21363E;
  --border-default: #2E4A54;
  --border-strong: #CFE3E8;
  --color-primary: #00ABC2;
  --color-primary-hover: #22C0D5;
  --color-primary-active: #0097AB;
  --color-accent: #4FD3E3;
  --color-accent-hover: #8BE6F0;
  --color-primary-subtle: #0F2F38;
  --focus-ring: rgba(0, 171, 194, 0.55);
  --qs-ink: #EAF4F6;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.5);
  --fc-page-bg-color: #13242A;
  --fc-neutral-bg-color: #1A2E35;
  --fc-border-color: #2E4A54;
  --fc-today-bg-color: rgba(0, 171, 194, 0.12);
  --fc-list-event-hover-bg-color: #1A2E35;
}
:root[data-theme="dark"] body { background: var(--surface-page); color: var(--text-body); }
:root[data-theme="dark"] :is(.qs-auth__card, .vo-panel, .vo-list__item, .qs-spots__item, .qs-access, .qs-cal__detail, .qs-cal__chip,
  .qs-fieldset, .qs-preview, .qs-help-list li, .qs-admin-list > li, .qs-booking, .qs-book__tab, .qs-cal__modes button, .qs-cal__navbtn) {
  background: var(--surface-card); color: var(--text-body); border-color: var(--border-subtle);
}
:root[data-theme="dark"] :is(input, select, textarea):not([type="checkbox"]):not([type="radio"]):not([type="submit"]) {
  background: #0F1F25; color: var(--text-strong); border-color: var(--border-default);
}
:root[data-theme="dark"] .qs-booking--past, :root[data-theme="dark"] .qs-spots__item--unavailable, :root[data-theme="dark"] .qs-spots__item--idle { background: #10202A; }
:root[data-theme="dark"] .qs-alert--error { background: #3A1518; color: #FFD7D9; border-color: #6B2A2F; }
:root[data-theme="dark"] .qs-alert--notice { background: #0F2F38; color: #CFF3F8; border-color: #1E5562; }
:root[data-theme="dark"] :is(.qs-btn-danger, .qs-btn-success-outline, .qs-btn-light) { background: transparent; }
:root[data-theme="dark"] .qs-btn-danger { color: #FF8A93; border-color: #FF8A93; }
:root[data-theme="dark"] .qs-btn-light { color: var(--text-strong); border-color: var(--border-default); }
:root[data-theme="dark"] .qs-plan__outline { fill: #10202A; stroke: #5D7F8A; }
:root[data-theme="dark"] .qs-plan__zone, :root[data-theme="dark"] .qs-spot--other rect { fill: #182B32; stroke: #2E4A54; }
:root[data-theme="dark"] :is(.qs-spot--idle, .qs-spot--free) rect { fill: #13242A; }
:root[data-theme="dark"] .qs-spot--free text, :root[data-theme="dark"] .qs-spot--idle text { fill: var(--text-strong); }
:root[data-theme="dark"] .qs-legend__swatch--free { background: #13242A; }
:root[data-theme="dark"] .vo-chip--free { background: #0E3324; color: #8EE8B9; }
:root[data-theme="dark"] .vo-chip--busy { background: #3A2A10; color: #F5C27A; }
:root[data-theme="dark"] .vo-timeline__cells { background: #21363E; border-color: #2E4A54; }
:root[data-theme="dark"] .vo-timeline__cell { background: #0E3324; }
@media (hover: hover) { :root[data-theme="dark"] .vo-timeline__cell:not(:disabled):hover { background: #145238; } }
:root[data-theme="dark"] .vo-timeline__cell:disabled { background: #172830; }
:root[data-theme="dark"] .g-footer { background: var(--surface-ink); }
:root[data-theme="dark"] img.g-brand__logo, :root[data-theme="dark"] .g-brand img { background: #fff; border-radius: 50%; }
/* Gold stays gold in dark mode, so the text on it stays dark ink. */
:root[data-theme="dark"] :is(.qs-pill, .qs-btn-gold, .qs-btn-gold:hover) { color: #0E2730; }
:root[data-theme="dark"] .g-brand__sub { color: var(--text-muted); }
:root[data-theme="dark"] :is(.g-hero h1, .g-pagehero h1, .g-pagehero__lead, .g-hero__lead) { color: var(--text-strong); }
:root[data-theme="dark"] .g-pagehero__lead { color: var(--text-body); }
:root[data-theme="dark"] :is(.g-navlinks a.is-active, .g-filter.is-active, .g-pager__num.is-active) { background: var(--surface-wash); color: var(--text-link); }

/* Footer "Follow us" column: icon + name for each link */
.g-footer__col a .qs-follow__icon { width: 1.1rem; text-align: center; margin-right: 0.35rem; color: #00ABC2; }
/* Long labels (Kazakh, Russian) wrap instead of widening the page on phones. */
html .qs-cta-big { white-space: normal; max-width: 100%; text-align: center; text-wrap: balance; }
.qs-live-page { grid-template-columns: minmax(0, 1fr); }
