/*
 * SweetRacket UI foundation
 *
 * Loaded after site.css. This is the source of truth for shared typography,
 * control geometry, and the public desktop header. Page-specific styles may
 * choose a documented size token, but should not redefine foundation values.
 */

:root {
  /* Typography */
  --sr-font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --sr-font-display: "DM Serif Display", Georgia, "Times New Roman", serif;
  --sr-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sr-type-caption: 11px;
  --sr-type-helper: 12px;
  --sr-type-body: 14px;
  --sr-type-control: 15px;
  --sr-type-nav-wide: 18px;
  --sr-type-title-sm: 20px;
  --sr-type-title-md: 28px;
  --sr-weight-body: 500;
  --sr-weight-label: 620;
  --sr-weight-control: 720;
  --sr-weight-title: 760;

  /* Text and state color */
  --sr-color-text: #fffaf0;
  --sr-color-muted: rgba(246, 241, 232, .62);
  --sr-color-faint: rgba(246, 241, 232, .42);
  --sr-color-line: rgba(246, 241, 232, .12);
  --sr-color-line-soft: rgba(246, 241, 232, .08);
  --sr-color-signal: var(--signal, #dfff55);
  --sr-color-signal-ink: #07100d;

  /* Shared control geometry */
  --sr-control-height-sm: 36px;
  --sr-control-height-md: 44px;
  --sr-control-height-lg: 52px;
  --sr-control-height-xl: 58px;
  --sr-control-radius: 8px;
  --sr-control-padding-sm: 8px 10px;
  --sr-control-padding-md: 10px 16px;
  --sr-control-padding-lg: 12px 18px;

  /* Standard desktop header: 1181-1599px */
  --sr-header-height: 96px;
  --sr-header-logo-width: 240px;
  --sr-header-logo-height: 64px;
  --sr-header-account-width: 132px;
}

html,
body,
button,
input,
textarea,
select {
  font-synthesis-weight: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font-family: var(--sr-font-ui);
  letter-spacing: 0;
  text-shadow: none;
}

.dark-button,
.light-button,
.clay-button {
  min-height: var(--sr-control-height-md);
  border-radius: var(--sr-control-radius);
  padding: var(--sr-control-padding-md);
  font-family: var(--sr-font-ui);
  font-size: var(--sr-type-body);
  font-weight: var(--sr-weight-control);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: none;
}

.tag-button,
.nav-contact-button {
  min-height: var(--sr-control-height-sm);
  border-radius: var(--sr-control-radius);
  font-family: var(--sr-font-ui);
  font-size: 13px;
  font-weight: var(--sr-weight-label);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: none;
}

.primary-nav .nav-contact-button {
  border-color: transparent;
  color: var(--sr-color-muted);
  background: transparent;
  box-shadow: none;
}

.primary-nav .nav-contact-button:hover,
.primary-nav .nav-contact-button:focus-visible {
  border-color: rgba(223, 255, 85, .32);
  color: var(--sr-color-text);
  background: rgba(223, 255, 85, .08);
}

.locale-switcher {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  flex: 0 0 auto;
  min-width: 80px;
  padding: 3px;
  border: 1px solid var(--sr-border);
  border-radius: var(--sr-radius-control);
  background: rgba(255, 255, 255, .035);
}

.locale-switcher button {
  min-width: 0;
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  color: var(--sr-text-muted);
  background: transparent;
  font-family: var(--sr-font-ui);
  font-size: var(--sr-type-caption);
  font-weight: var(--sr-weight-label);
  line-height: 1;
  white-space: nowrap;
}

.locale-switcher button.active {
  color: var(--sr-text);
  background: rgba(223, 255, 85, .12);
  box-shadow: inset 0 0 0 1px rgba(223, 255, 85, .22);
}

/* Standard desktop: restore the previous 1440px header baseline. */
@media (min-width: 1181px) and (max-width: 1599px) {
  .site-header {
    grid-template-columns: 240px minmax(0, 1fr) max-content;
    min-height: var(--sr-header-height);
    gap: 18px;
    padding: 14px max(18px, calc((100vw - 1480px) / 2));
  }

  .wordmark {
    width: var(--sr-header-logo-width);
    height: var(--sr-header-logo-height);
  }

  .primary-nav {
    justify-self: stretch;
    justify-content: safe center;
    width: 100%;
    min-width: 0;
    gap: 4px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 6px;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .primary-nav a,
  .nav-contact-button {
    min-height: var(--sr-control-height-md);
    padding: 9px 11px;
    font-family: var(--sr-font-ui);
    font-size: var(--sr-type-control);
    font-weight: var(--sr-weight-control);
    line-height: 1;
    letter-spacing: 0;
  }

  .header-actions {
    width: auto;
    max-width: none;
    min-width: 0;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
  }

  .header-actions .dark-button,
  .header-actions .header-logout-button {
    min-height: var(--sr-control-height-lg);
    max-width: none;
    padding: var(--sr-control-padding-md);
    font-size: var(--sr-type-control);
  }

  .header-actions .dark-button {
    width: auto;
    max-width: var(--sr-header-account-width);
    overflow: hidden;
    font-weight: var(--sr-weight-title);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions .header-logout-button {
    flex: 0 0 auto;
  }
}

/* Wide desktop: preserve the larger proportions from the legacy reference. */
@media (min-width: 1600px) {
  :root {
    --sr-header-height: 112px;
    --sr-header-logo-width: 300px;
    --sr-header-logo-height: 78px;
    --sr-header-account-width: 164px;
  }

  .site-header {
    grid-template-columns: 300px minmax(0, 1fr) max-content;
    min-height: var(--sr-header-height);
    gap: 24px;
    padding: 16px max(28px, calc((100vw - 1840px) / 2));
  }

  .wordmark {
    width: var(--sr-header-logo-width);
    height: var(--sr-header-logo-height);
  }

  .primary-nav {
    justify-self: stretch;
    justify-content: safe center;
    width: 100%;
    min-width: 0;
    gap: 4px;
    padding: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .primary-nav::-webkit-scrollbar {
    display: none;
  }

  .primary-nav a,
  .nav-contact-button {
    min-height: var(--sr-control-height-lg);
    padding: 12px 17px;
    font-family: var(--sr-font-ui);
    font-size: var(--sr-type-nav-wide);
    font-weight: var(--sr-weight-control);
    line-height: 1;
    letter-spacing: 0;
  }

  .header-actions {
    width: auto;
    max-width: none;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .header-actions .dark-button,
  .header-actions .header-logout-button {
    min-height: var(--sr-control-height-lg);
    max-width: none;
    padding: var(--sr-control-padding-lg);
    font-size: var(--sr-type-nav-wide);
  }

  .header-actions .dark-button {
    width: auto;
    max-width: var(--sr-header-account-width);
    overflow: hidden;
    font-weight: var(--sr-weight-title);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header-actions .header-logout-button {
    flex: 0 0 auto;
  }
}

.header-account-label {
  display: block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .locale-switcher {
    min-width: 70px;
    padding: 2px;
    border-radius: 7px;
  }

  .locale-switcher button {
    min-height: 34px;
    padding: 5px 6px;
    font-size: 10px;
  }

  .header-actions:has(.locale-switcher) {
    max-width: min(54vw, 184px);
  }
}
