/* TechLight Mail: base layer for web pages (the web build, previews, TechLight's admin page).
   Needs tokens.css first. Every value comes from a token. Logical properties only, so one sheet
   serves Hebrew (dir="rtl", the default) and English (dir="ltr"). */

:root {
  /* Movement (height, position, scale) uses --dur-move; colour and opacity fades keep their own
     durations. Reduced motion zeroes movement and keeps the fades. */
  --dur-move: var(--dur-slow);
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-move: 0ms; }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
/* one-line content (dir="auto") keeps its own direction, but lines up with the interface's start edge */
html[dir="rtl"] .tm-cut[dir="auto"] { text-align: right; }
html[dir="ltr"] .tm-cut[dir="auto"] { text-align: left; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;                       /* never hidden: clip keeps sticky elements working */
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-block-size: 100%;
  background:
    radial-gradient(1100px 560px at 88% -12%, var(--overlay-atmos-1), transparent 62%),
    radial-gradient(900px 520px at 4% 2%, var(--overlay-atmos-2), transparent 58%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  text-align: start;
}

/* ---------- type ---------- */
h1, h2, h3, h4 { margin: 0; color: var(--text-strong); text-wrap: balance; }
.tm-h1 { font-size: var(--fs-3xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); letter-spacing: var(--ls-title); }
.tm-h2 { font-size: var(--fs-2xl); font-weight: var(--fw-heavy); line-height: var(--lh-tight); letter-spacing: var(--ls-title); }
.tm-h3 { font-size: var(--fs-xl); font-weight: var(--fw-heavy); line-height: var(--lh-snug); }
.tm-h4 { font-size: var(--fs-lg); font-weight: var(--fw-bold); line-height: var(--lh-snug); }
.tm-read { font-size: var(--fs-body); line-height: var(--lh-read); color: var(--text); }
.tm-ui { font-size: var(--fs-md); line-height: var(--lh-ui); }
.tm-small { font-size: var(--fs-sm); line-height: var(--lh-ui); color: var(--text-2); }
.tm-hint { font-size: var(--fs-xs); line-height: var(--lh-ui); color: var(--text-3); }   /* the floor: nothing below 12px */
.tm-label { font-size: var(--fs-sm); font-weight: var(--fw-semibold); letter-spacing: var(--ls-label); color: var(--text-2); }
.tm-caps { font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--text-3); }
.tm-num { font-variant-numeric: tabular-nums; }
.tm-mono { font-family: var(--font-mono); font-size: .92em; }
p { margin: 0; }

/* Ids, emails, phones and numbers inside Hebrew text sit in an isolate so they never scramble. */
.tm-iso { direction: ltr; unicode-bidi: isolate; }
/* A date and its hour are one left-to-right unit that never breaks: 29/10/2026 10:00 */
.tm-dt { direction: ltr; unicode-bidi: isolate; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tm-nowrap { white-space: nowrap; }
/* Text that may be cut: one line with an ellipsis; a tooltip shows the full text only when it is cut. */
.tm-cut { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

::selection { background: var(--overlay-selection); color: var(--text-strong); }

/* ---------- the fade layer: every state change on an interactive element fades ---------- */
:where(a, button, input, select, textarea, summary, label, [role="button"], [role="tab"], [role="switch"], [role="option"], [role="menuitem"], .tm-fade) {
  transition-property: color, background-color, border-color, box-shadow, opacity, outline-color, fill, stroke, text-decoration-color;
  transition-duration: var(--dur-base);
  transition-timing-function: var(--ease-standard);
}
/* Focus rings fade in and out (owner, 16.11): the ring always exists, only its colour changes. */
:where(a, button, summary, [role="button"], [role="tab"], [role="switch"], [role="option"], [tabindex]) {
  outline: var(--size-ring) solid transparent;
  outline-offset: var(--size-ring-offset);
}
:where(a, button, summary, [role="button"], [role="tab"], [role="switch"], [role="option"], [tabindex]):focus-visible {
  outline-color: var(--focus-ring);
}

/* ---------- links: the underline animates under the words only, never a cell's width, never an icon ---------- */
.tm-link {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  border-radius: var(--radius-xs);
}
.tm-link:hover { color: var(--accent-hover); }
.tm-link__t {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-size: 0% 1.5px;
  background-position: 100% 100%;                 /* grows from the reading start (right in Hebrew) */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding-block-end: 1px;
  transition: background-size var(--dur-slow) var(--ease-draw);
}
[dir="ltr"] .tm-link__t { background-position: 0% 100%; }
.tm-link:hover .tm-link__t, .tm-link:focus-visible .tm-link__t { background-size: 100% 1.5px; }

/* ---------- icons (the TechLight sprite: 24px grid, stroke 1.8, round caps) ---------- */
.tm-ic {
  inline-size: var(--size-icon);
  block-size: var(--size-icon);
  flex: none;
  stroke: currentColor;
  fill: none;
  vertical-align: middle;
}
.tm-ic--sm { inline-size: var(--size-icon-sm); block-size: var(--size-icon-sm); }
.tm-ic--xs { inline-size: var(--size-icon-xs); block-size: var(--size-icon-xs); }
.tm-ic--lg { inline-size: var(--size-icon-lg); block-size: var(--size-icon-lg); }
/* Directional icons point by meaning: back points right in Hebrew, so they mirror in English. */
[dir="ltr"] .tm-ic--dir { scale: -1 1; }

/* ---------- scroll: one scrollbar per panel, never a scroller inside a scroller ---------- */
.tm-scroll { overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--overlay-scroll) transparent; }
.tm-scroll::-webkit-scrollbar { inline-size: 6px; block-size: 6px; }
.tm-scroll::-webkit-scrollbar-thumb { background: var(--overlay-scroll); border-radius: var(--radius-md); }
.tm-scroll::-webkit-scrollbar-track { background: transparent; }

/* ---------- keyboard keys ---------- */
.tm-kbd {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line-strong);
  border-block-end-width: 2px;
  background: var(--surface-2);
  color: var(--text-2);
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* ---------- visually hidden, still read by screen readers ---------- */
.tm-sr { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
