/* Copied from prototypes/shared/base.css (approved in A-02). Keep both in sync. */
/*
 * Base styles shared by every prototype screen.
 * Uses logical properties (inline/block, start/end) so layouts mirror
 * automatically between RTL (Arabic) and LTR (English).
 */

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

/* The hidden attribute always wins over component display rules. */
[hidden] {
  display: none !important;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--line-height);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  margin-block: 0 var(--space-3);
  line-height: 1.3;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

p {
  margin-block: 0 var(--space-3);
}

a {
  color: var(--color-primary);
}

img {
  max-width: 100%;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--color-surface-muted);
  padding-inline: var(--space-1);
  border-radius: var(--radius-sm);
  direction: ltr;
  unicode-bidi: isolate;
}

/* Minimal helpers shared by screens; screens add their own layout. */
.container {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--space-4);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding-block: var(--space-2);
  padding-inline: var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font: inherit;
  cursor: pointer;
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

.button--secondary {
  background: var(--color-secondary);
  color: var(--color-secondary-contrast);
}

.button--ghost {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

/* Every focusable control, not only .button/a/input/select (UX audit 2026-11-21, UX-034): plain <button>s such as
   the sign-in button had no indicator. The colour is the kit's --ui-focus (the brand's readable text tone, ui-kit.css). */
.button:focus-visible,
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ui-focus, var(--color-info));
  outline-offset: 2px;
}

/* Language switch rendered by i18n.js */
.lang-switch {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.lang-switch button {
  border: 0;
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--text-sm);
  padding-block: var(--space-1);
  padding-inline: var(--space-3);
  cursor: pointer;
}

.lang-switch button[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

/* Date-time and time fields read hours then minutes on Arabic pages too (tester's note 2026-11-30): every one is laid
   out left to right, including those made by scripts without dir="ltr", and keeps to the start of the field on RTL
   pages. Firefox lays out the inside of the field from its own Arabic format whatever the page says, so time-field.js
   replaces them with our own field; this rule stays for those left native (data-native) or before the script runs. */
input:is([type="datetime-local"], [type="time"]) {
  direction: ltr;
}

[dir="rtl"] input:is([type="datetime-local"], [type="time"]) {
  text-align: right;
}
