/*
 * Base styles: reset, shared components (focus, icons, buttons, notices) and
 * the landing layout of the call page. Every value derives from tokens.css.
 * The widget loads this file into its shadow root as well.
 * Rules with few short declarations take one line.
 */
:root {
  --focus-ring: var(--color-focus-ring);
  --focus-width: calc(var(--space-1) / 2);
  --icon-size: calc(var(--space-4) + var(--space-1));
  --gutter: clamp(var(--space-4), 5vw, var(--space-6));
  --line-sm: calc(var(--text-sm) * var(--leading-normal));
  --row-size: calc(var(--size-touch) + var(--space-3));
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html:has(dialog[open]) { overflow: hidden; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
}
h1, h2, p, ul, ol, fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  list-style: none;
}
button, input { font: inherit; color: inherit; }

/* Focus, utilities, icons */
:focus-visible,
.language-switch__input:focus-visible + .language-switch__label {
  outline: var(--focus-width) solid var(--focus-ring);
  outline-offset: var(--focus-width);
}
.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.icon {
  flex: none;
  inline-size: var(--icon-size);
  block-size: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-block-size: var(--size-touch);
  padding: var(--space-2) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.button--primary { background: var(--color-accent); color: var(--color-text-on-accent); }
.button--primary:hover { background: var(--color-accent-hover); }
.button--primary:active { background: var(--color-accent-active); }
.button--quiet {
  border-color: var(--color-border-strong);
  background: transparent;
  color: var(--color-accent-text);
}
.button--quiet:hover { background: var(--color-accent-soft); }
.button--large {
  min-block-size: var(--row-size);
  padding-inline: var(--space-6);
  font-size: var(--text-lg);
  box-shadow: var(--shadow-md);
}
.button:disabled {
  border-color: var(--color-border);
  background: var(--color-surface-sunken);
  color: var(--color-text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

/* Calm information (notice) and a problem the customer can act on (warning). */
.notice,
.service-state:is([data-state="not_configured"], [data-state="unavailable"]) {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  color: var(--color-text);
  font-size: var(--text-sm);
}
.service-state:is([data-state="not_configured"], [data-state="unavailable"]) {
  background: var(--color-warning-soft);
  color: var(--color-warning);
}
pre.notice { margin: 0; overflow-x: auto; }

/* Entrance to a call: button, hint, service state, recording notice */
.entrance {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
}
.entrance__hint,
.recording-note,
.service-state,
.last-conversation__summary,
.site-footer {
  min-block-size: var(--line-sm);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}
.service-state,
.recording-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.recording-note { flex-wrap: nowrap; align-items: flex-start; }
.recording-note[data-state="pending"] { visibility: hidden; }

/* Landing page */
.skip-link {
  position: absolute;
  inset: var(--space-2) auto auto var(--space-2);
  z-index: var(--layer-toast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-accent-text);
  box-shadow: var(--shadow-md);
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Page layout */
.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-block-size: 100dvh;
  max-inline-size: var(--size-content);
  margin-inline: auto;
  padding: var(--space-5) var(--gutter);
}
.page__main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-5);
  outline: none;
}
.site-header,
.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

/* Header: wordmark and language switch */
.wordmark {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
}
.wordmark__accent { color: var(--color-accent-text); }
.language-switch__options {
  display: inline-flex;
  gap: var(--space-1);
  min-block-size: calc(var(--size-touch) + var(--space-2));
  padding: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface-sunken);
}
.language-switch__option { position: relative; display: inline-flex; }
.language-switch__input {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.language-switch__label {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--size-touch);
  padding-inline: var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  transition: background-color var(--duration-fast) var(--ease-standard);
}
.language-switch__input:checked + .language-switch__label {
  background: var(--color-surface-raised);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* Hero and panels */
.hero,
.panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: clamp(var(--space-4), 5vw, var(--space-6));
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.hero { border-radius: var(--radius-xl); box-shadow: var(--shadow-md); }
.hero__title {
  min-block-size: calc(var(--text-2xl) * var(--leading-tight));
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  text-wrap: balance;
}
.hero__lead {
  min-block-size: calc(var(--text-lg) * var(--leading-normal) * 2);
  margin-block-end: var(--space-2);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}
.panel__title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
}

/* Contacts and footer */
.contacts__list { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.contact { flex: 1 1 auto; }
.contact__row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-block-size: var(--row-size);
  padding: var(--space-2);
  border-radius: var(--radius-md);
  color: inherit;
  text-decoration: none;
}
a.contact__row:hover { background: var(--color-accent-soft); }
.contact__icon {
  display: inline-flex;
  padding: var(--space-3);
  border-radius: var(--radius-full);
  background: var(--color-accent-soft);
  color: var(--color-accent-text);
}
.contact__text { display: flex; flex-direction: column; }
.contact__label { font-size: var(--text-xs); color: var(--color-text-muted); }
.contact__value { font-weight: var(--weight-medium); white-space: nowrap; }
a.contact__row .contact__value { color: var(--color-accent-text); text-decoration: underline; }
.contact--placeholder { background: var(--color-surface-sunken); }
.site-footer__version {
  min-inline-size: calc(var(--space-8) * 2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-align: end;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
