/* Language picker styles.
 *
 * The public menu links the original prebuilt Tailwind v4 bundle (original.css)
 * and does not run the PostCSS pipeline, so utility classes that were not in the
 * original markup simply do not exist. These components therefore ship their own
 * plain CSS instead of Tailwind utilities.
 *
 * Values follow the menu's existing language: large radii, translucent white
 * surfaces, olive hairlines, soft shadows. Colours reuse the --color-* tokens
 * already defined by original.css, with literal fallbacks so this file also
 * works if loaded on its own. */

.zt-lang-overlay {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: 120; /* above .grain-overlay (100) and the sticky header (50) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(35, 35, 28, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: zt-fade-in 0.25s ease-out both;
  overscroll-behavior: contain;
}

.zt-lang-panel {
  box-sizing: border-box; /* padding must stay inside the width, or the panel
                             overflows the viewport on narrow screens */
  width: 100%;
  max-width: 30rem;
  max-height: calc(100dvh - 3rem);
  overflow-y: auto;
  padding: 2rem 1.75rem 1.75rem;
  background: var(--color-white, #fff);
  border-radius: 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
  animation: zt-rise 0.32s cubic-bezier(0.23, 1, 0.32, 1) both;
}

.zt-lang-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display, Georgia, serif);
  font-weight: 300;
  font-size: 1.75rem;
  line-height: 1.15;
  text-align: center;
  color: var(--color-natural-text, #3d3d33);
}

.zt-lang-subtitle {
  margin: 0 0 1.75rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-align: center;
  color: color-mix(in oklab, var(--color-natural-accent, #5a5a40) 60%, transparent);
}

.zt-lang-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.625rem;
}

/* The prebuilt bundle's preflight sets `appearance: button` on every <button>,
 * which makes the browser impose native button layout and collapse flex
 * children onto one axis. Both controls must opt out of it explicitly. */
button.zt-lang-option,
button.zt-lang-trigger {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-sizing: border-box;
  text-align: center;
}

button.zt-lang-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 0.5rem;
  font: inherit;
  color: var(--color-natural-text, #3d3d33);
  background: color-mix(in oklab, var(--color-natural-bg, #f5f5f0) 55%, transparent);
  border: 1px solid color-mix(in oklab, var(--color-natural-accent, #5a5a40) 12%, transparent);
  border-radius: 18px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

button.zt-lang-option:hover {
  border-color: color-mix(in oklab, var(--color-brand-orange, #f26522) 45%, transparent);
  background: var(--color-white, #fff);
  transform: translateY(-2px);
}

button.zt-lang-option:focus-visible {
  outline: 2px solid var(--color-brand-orange, #f26522);
  outline-offset: 2px;
}

button.zt-lang-option[aria-current="true"] {
  border-color: var(--color-brand-orange, #f26522);
  background: color-mix(in oklab, var(--color-brand-orange, #f26522) 7%, var(--color-white, #fff));
}

.zt-lang-name {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

/* Header trigger */
button.zt-lang-trigger {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  width: auto;
  height: auto;
  padding: 0.3125rem 0.6875rem;
  font: inherit;
  line-height: 1;
  white-space: nowrap;
  background: transparent;
  border: 1px solid color-mix(in oklab, var(--color-natural-accent, #5a5a40) 20%, transparent);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

/* SVG inside the controls must not stretch to the flex cross axis. */
button.zt-lang-trigger svg,
button.zt-lang-option svg {
  display: block;
  flex: none;
}

button.zt-lang-trigger:hover {
  border-color: color-mix(in oklab, var(--color-brand-orange, #f26522) 50%, transparent);
  background: color-mix(in oklab, var(--color-natural-accent, #5a5a40) 5%, transparent);
}

button.zt-lang-trigger:focus-visible {
  outline: 2px solid var(--color-brand-orange, #f26522);
  outline-offset: 2px;
}

.zt-lang-trigger-code {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-natural-accent, #5a5a40);
}

@keyframes zt-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes zt-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* These overrides must match the specificity of the button.* rules above,
 * otherwise they lose and silently do nothing. */
@media (prefers-reduced-motion: reduce) {
  .zt-lang-overlay,
  .zt-lang-panel { animation: none; }
  button.zt-lang-option { transition: none; }
  button.zt-lang-option:hover { transform: none; }
}

@media (max-width: 380px) {
  .zt-lang-panel { padding: 1.5rem 1.25rem; }
  .zt-lang-grid { gap: 0.5rem; }
  button.zt-lang-option { padding: 0.75rem 0.375rem; }
}
