/* Shared layout for every page: tokens, header, menu, footer and terms dialog.
   Tokens mirror the current platform (main/tools/theme/theme.js) — see STYLE.md. */

:root,
:root[data-theme="light"] {
  --theme-bg-primary: #ffffff;
  --theme-bg-secondary: #f7f7f5;
  --theme-bg-tertiary: #eeeeea;
  --theme-text-primary: #18181b;
  --theme-text-secondary: #52525b;
  --theme-text-tertiary: #a1a1aa;
  --theme-text-inverse: #ffffff;
  --theme-border-subtle: #e4e4e7;
  --theme-border-default: #d4d4d8;
  --theme-color-primary: #2d5cf6;
  --theme-surface-raised: #ffffff;
  --theme-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --theme-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --site-cta-bg: #2d5cf6;
  --site-cta-text: #ffffff;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --theme-bg-primary: #0f0f10;
  --theme-bg-secondary: #18181b;
  --theme-bg-tertiary: #27272a;
  --theme-text-primary: #fafafa;
  --theme-text-secondary: #a1a1aa;
  --theme-text-tertiary: #71717a;
  --theme-text-inverse: #18181b;
  --theme-border-subtle: #27272a;
  --theme-border-default: #3f3f46;
  --theme-color-primary: #6b8cff;
  --theme-surface-raised: #1c1c1f;
  --theme-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --theme-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --site-cta-bg: #1e3fb8;
  --site-cta-text: #ffffff;
  color-scheme: dark;
}

:root {
  --theme-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --theme-radius-sm: 6px;
  --theme-radius-md: 10px;
  --theme-radius-lg: 14px;
  --theme-radius-full: 9999px;
  --site-primary-soft: color-mix(in srgb, var(--theme-color-primary) 12%, transparent);
  --site-header-height: 64px;
  --site-gutter: clamp(16px, 4vw, 48px);
  --site-max-width: 1600px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--site-header-height) + 8px);
  -webkit-text-size-adjust: 100%;
}

.site {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  margin: 0;
  background: var(--theme-bg-primary);
  color: var(--theme-text-primary);
  font-family: var(--theme-font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

:where(.site) a {
  color: inherit;
}

:where(.site) :where(h1, h2, h3) {
  margin: 0;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

:where(.site) :where(p, figure, blockquote) {
  margin: 0;
}

:where(.site) :where(button) {
  font: inherit;
}

.site-main {
  flex: 1 0 auto;
}

.site-container {
  width: 100%;
  max-width: var(--site-max-width);
  margin-inline: auto;
  padding-inline: var(--site-gutter);
}

.site-skip {
  position: absolute;
  inset-inline-start: 16px;
  top: -64px;
  z-index: 20;
  padding: 8px 14px;
  border-radius: var(--theme-radius-md);
  background: var(--theme-color-primary);
  color: #ffffff;
  font-weight: 600;
  text-decoration: none;
}

.site-skip:focus {
  top: 12px;
}

/* Logos swap with the theme without JS. */
:root[data-theme="dark"] .site-logo-light,
:root:not([data-theme="dark"]) .site-logo-dark {
  display: none;
}

/* Header */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--theme-bg-tertiary) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  box-shadow: var(--theme-shadow-sm);
}

.site-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--site-header-height);
}

.site-header-brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  border-radius: var(--theme-radius-sm);
}

.site-header-logo {
  display: block;
  width: auto;
  height: 48px;
}

.site-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-header-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  overflow: hidden;
  border: 2px solid var(--theme-surface-raised);
  border-radius: var(--theme-radius-full);
  background: var(--site-primary-soft);
  color: var(--theme-color-primary);
  box-shadow: var(--theme-shadow-sm);
  cursor: pointer;
}

.site-header-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-header-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--theme-radius-md);
  background: transparent;
  color: var(--theme-text-primary);
  cursor: pointer;
  transition: background 120ms ease;
}

.site-header-toggle:hover,
.site-header-toggle[aria-expanded="true"] {
  background: var(--theme-bg-tertiary);
}

:where(.site) :where(a, button, select):focus-visible {
  outline: 2px solid var(--theme-color-primary);
  outline-offset: 2px;
}

/* Menu */

.site-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: var(--site-gutter);
  width: min(320px, calc(100vw - 32px));
  max-height: calc(100dvh - var(--site-header-height) - 24px);
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--theme-radius-md);
  background: var(--theme-surface-raised);
  box-shadow: var(--theme-shadow-md);
}

.site-menu[hidden] {
  display: none;
}

.site-menu-section {
  display: grid;
  gap: 6px;
  padding: 8px;
}

.site-menu-section + .site-menu-section {
  border-top: 1px solid var(--theme-border-subtle);
}

.site-menu-label {
  color: var(--theme-text-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.site-menu-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.site-menu-langs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.site-menu-option,
.site-menu-lang,
.site-menu-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--theme-radius-sm);
  background: transparent;
  color: var(--theme-text-primary);
  font-size: 14px;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.site-menu-option {
  justify-content: center;
  border-color: var(--theme-border-subtle);
}

.site-menu-option:hover,
.site-menu-lang:hover,
.site-menu-action:hover {
  background: var(--theme-bg-secondary);
}

.site-menu-option.is-active,
.site-menu-lang.is-active {
  border-color: var(--theme-color-primary);
  background: var(--site-primary-soft);
  color: var(--theme-color-primary);
}

.site-menu-lang-code {
  flex: none;
  width: 22px;
  color: var(--theme-text-tertiary);
  font-size: 11px;
  font-weight: 700;
}

.site-menu-lang.is-active .site-menu-lang-code {
  color: inherit;
}

.site-menu-lang-name {
  min-width: 0;
}

/* Sign-in dialog */

.site-login {
  width: min(420px, calc(100vw - 32px));
  padding: 40px 28px 28px;
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--theme-radius-lg);
  background: var(--theme-surface-raised);
  color: var(--theme-text-primary);
  box-shadow: var(--theme-shadow-md);
  text-align: center;
}

.site-login[open] {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.site-login::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.site-login-close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px;
  display: inline-flex;
  padding: 6px;
  border: 0;
  border-radius: var(--theme-radius-md);
  background: transparent;
  color: var(--theme-text-secondary);
  cursor: pointer;
}

.site-login-close:hover {
  background: var(--theme-bg-secondary);
}

.site-login-logo {
  width: auto;
  height: 56px;
}

.site-login-title {
  font-size: 22px;
}

.site-login-intro {
  color: var(--theme-text-secondary);
  font-size: 16px;
}

.site-login-google {
  display: flex;
  justify-content: center;
  min-height: 44px;
  margin-top: 8px;
}

.site-login-agreement,
.site-login-error {
  color: var(--theme-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.site-login-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--theme-color-primary);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

/* Share band: the blue call to action above the footer of every page. */

.site-cta {
  padding-block: 80px;
  background: var(--site-cta-bg);
  color: var(--site-cta-text);
}

.site-cta-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
}

.site-cta-title {
  font-size: clamp(1.75rem, 3.6vw, 2.5rem);
  font-weight: 700;
}

.site-cta-text {
  margin-bottom: 8px;
  font-size: 18px;
  opacity: 0.92;
}

.site-cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--theme-radius-md);
  background: rgba(255, 255, 255, 0.12);
  color: var(--site-cta-text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}

.site-cta-button:hover {
  background: rgba(255, 255, 255, 0.2);
}

.site-cta-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.site-cta-list[hidden],
.site-cta-copied[hidden] {
  display: none;
}

.site-cta-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--theme-radius-full);
  background: rgba(255, 255, 255, 0.14);
  color: var(--site-cta-text);
  transition: background 120ms ease;
}

.site-cta-link:hover {
  background: rgba(255, 255, 255, 0.26);
}

.site-cta :where(a, button):focus-visible {
  outline-color: #ffffff;
}

.site-cta-copied {
  font-size: 14px;
  font-weight: 600;
}

/* Profile dialog */

.site-profile {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--theme-radius-lg);
  background: var(--theme-surface-raised);
  color: var(--theme-text-primary);
  box-shadow: var(--theme-shadow-md);
}

.site-profile::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.site-profile-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--theme-border-subtle);
  background: var(--theme-surface-raised);
}

.site-profile-heading {
  font-size: 18px;
}

.site-profile-close {
  display: inline-flex;
  padding: 6px;
  border: 0;
  border-radius: var(--theme-radius-md);
  background: transparent;
  color: var(--theme-text-secondary);
  cursor: pointer;
}

.site-profile-close:hover {
  background: var(--theme-bg-secondary);
}

.site-profile-body {
  display: grid;
  gap: 20px;
  padding: 20px 24px 24px;
}

.site-profile-status,
.site-profile-help {
  color: var(--theme-text-secondary);
  font-size: 14px;
}

.site-profile-person {
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-profile-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 72px;
  height: 72px;
  border-radius: var(--theme-radius-full);
  background: var(--site-primary-soft);
  color: var(--theme-color-primary);
  object-fit: cover;
}

.site-profile-name {
  font-size: 20px;
  font-weight: 700;
}

.site-profile-email {
  color: var(--theme-text-secondary);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.site-profile-message {
  padding: 10px 14px;
  border-radius: var(--theme-radius-md);
  background: var(--site-primary-soft);
  color: var(--theme-color-primary);
  font-size: 14px;
  font-weight: 600;
}

.site-profile-message.is-error {
  background: color-mix(in srgb, #dc2626 10%, transparent);
  color: #dc2626;
}

.site-profile-section {
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid var(--theme-border-subtle);
}

.site-profile-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
}

.site-profile-title svg {
  color: var(--theme-color-primary);
}

.site-profile-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.site-profile-link a {
  min-width: 0;
  color: var(--theme-color-primary);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.site-profile-form {
  display: grid;
  gap: 8px;
}

.site-profile-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--theme-border-default);
  border-radius: var(--theme-radius-md);
  background: var(--theme-bg-primary);
  color: var(--theme-text-primary);
  font: inherit;
  font-size: 15px;
}

.site-profile-input:focus {
  border-color: var(--theme-color-primary);
  outline: none;
  box-shadow: 0 0 0 3px var(--site-primary-soft);
}

.site-profile-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.site-profile-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: start;
  gap: 6px;
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--theme-border-default);
  border-radius: var(--theme-radius-md);
  background: transparent;
  color: var(--theme-text-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.site-profile-button:hover {
  border-color: var(--theme-color-primary);
}

.site-profile-button.is-primary {
  border-color: transparent;
  background: var(--theme-color-primary);
  color: #ffffff;
}

.site-profile-button:disabled {
  opacity: 0.7;
  cursor: progress;
}

.site-profile-toggles {
  display: grid;
  gap: 4px;
}

.site-profile-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 15px;
  cursor: pointer;
}

.site-profile-toggle input {
  appearance: none;
  position: relative;
  flex: none;
  width: 42px;
  height: 24px;
  margin: 0;
  border-radius: var(--theme-radius-full);
  background: var(--theme-border-default);
  cursor: pointer;
  transition: background 120ms ease;
}

.site-profile-toggle input::after {
  content: '';
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  border-radius: var(--theme-radius-full);
  background: #ffffff;
  box-shadow: var(--theme-shadow-sm);
  transition: transform 120ms ease;
}

.site-profile-toggle input:checked {
  background: var(--theme-color-primary);
}

.site-profile-toggle input:checked::after {
  transform: translateX(18px);
}

:root[dir="rtl"] .site-profile-toggle input:checked::after {
  transform: translateX(-18px);
}

/* Processing indicator: the Edukors icon, animated (SiteHtml.loader). */

.site-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 16px;
  color: var(--theme-text-secondary);
  font-size: 14px;
  text-align: center;
}

.site-loader.is-compact {
  display: inline-flex;
  padding: 0;
}

.site-loader-icon {
  overflow: visible;
}

.site-loader-link line {
  stroke: #2f80ed;
  stroke-width: 9;
  stroke-linecap: round;
}

.site-loader-link circle {
  fill: #2f80ed;
}

.site-loader-link {
  opacity: 0.25;
  animation: site-loader-link 1.2s ease-in-out infinite;
  animation-delay: calc(var(--site-loader-index) * 0.2s);
}

.site-loader-hub {
  fill: none;
  stroke: #ff5a5f;
  transform-box: fill-box;
  transform-origin: center;
  animation: site-loader-hub 1.2s ease-in-out infinite;
}

@keyframes site-loader-link {
  0%, 100% {
    opacity: 0.25;
  }

  30% {
    opacity: 1;
  }
}

@keyframes site-loader-hub {
  0%, 100% {
    transform: scale(1);
  }

  50% {
    transform: scale(0.86);
  }
}

.site-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Footer: a single quiet line below the content, the way to the contact form. */

/* "Back to the homepage" link, just under the header of every secondary page */

.site-back {
  padding-block: 6px 0;
}

.site-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  color: var(--theme-color-primary);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.site-back-link:hover {
  text-decoration: underline;
}

.site-back-link:focus-visible {
  outline: 2px solid var(--theme-color-primary);
  outline-offset: 2px;
  border-radius: var(--theme-radius-sm);
}

[dir="rtl"] .site-back-link svg {
  transform: scaleX(-1);
}

.site-footer {
  flex: none;
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--theme-border-subtle);
  background: var(--theme-bg-secondary);
}

.site-footer-inner {
  display: flex;
  justify-content: center;
}

.site-footer-contact {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--theme-radius-md);
  color: var(--theme-text-secondary);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  transition: color 120ms ease;
}

.site-footer-contact:hover {
  color: var(--theme-color-primary);
}

/* Terms dialog */

.site-terms {
  width: min(820px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--theme-border-subtle);
  border-radius: var(--theme-radius-lg);
  background: var(--theme-surface-raised);
  color: var(--theme-text-primary);
  box-shadow: var(--theme-shadow-md);
}

.site-terms::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.site-terms-bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--theme-border-subtle);
  background: var(--theme-surface-raised);
}

.site-terms-heading {
  font-size: 17px;
}

.site-terms-close {
  padding: 6px 12px;
  border: 1px solid var(--theme-border-default);
  border-radius: var(--theme-radius-md);
  background: transparent;
  color: var(--theme-text-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.site-terms-body {
  padding: 20px 24px 28px;
  color: var(--theme-text-secondary);
  font-size: 15px;
}

.site-terms-body :where(h1, h2, h3) {
  margin: 1.4em 0 0.5em;
  color: var(--theme-text-primary);
}

.site-terms-body h1 {
  margin-top: 0;
  font-size: 22px;
}

.site-terms-body h2 {
  font-size: 18px;
}

.site-terms-body h3 {
  font-size: 16px;
}

.site-terms-body :where(p, ul, ol) {
  margin: 0 0 0.8em;
}

.site-terms-body :where(ul, ol) {
  padding-inline-start: 1.4em;
}

.site-terms-body strong {
  color: var(--theme-text-primary);
}

.site-terms-body a {
  color: var(--theme-color-primary);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .site-loader-link,
  .site-loader-hub {
    animation-duration: 2.4s;
    animation-timing-function: linear;
  }

  .site-loader-hub {
    animation: none;
  }
}

@media (max-width: 560px) {
  .site-header-logo {
    height: 40px;
  }

  .site-cta {
    padding-block: 56px;
  }
}
