/*
 * host123 Webmail base styles (§29): reset, document defaults, typography, focus, icons.
 * Tokens only (tokens.css); no !important (that belongs to utilities.css).
 */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
  background-color: var(--bg-canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  font-weight: var(--fw-normal);
  line-height: var(--lh);
  color: var(--text);
  background: var(--bg-app);
  background-color: var(--bg-canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--space-3);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  color: var(--text);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }
h5, h6 { font-size: var(--fs-md); }

p {
  margin: 0 0 var(--space-3);
}
p:last-child {
  margin-bottom: 0;
}

ul, ol {
  margin: 0 0 var(--space-3);
  padding-inline-start: var(--space-6);
}

small {
  font-size: var(--fs-xs);
}

strong, b {
  font-weight: var(--fw-semibold);
}

a {
  color: var(--link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-thickness: 2px;
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
pre {
  margin: 0 0 var(--space-3);
  overflow: auto;
  white-space: pre-wrap;
}

hr {
  height: 0;
  margin: var(--space-4) 0;
  border: 0;
  border-top: 1px solid var(--border);
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}

/* Media */
img, svg, video, canvas, iframe {
  max-width: 100%;
}
img, video {
  height: auto;
}
img {
  border-style: none;
}
iframe {
  border: 0;
}

/* Forms: inherit the typography, components style the rest */
button, input, select, textarea, optgroup {
  margin: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button, [role="button"] {
  cursor: pointer;
}
button:disabled, [aria-disabled="true"]:not(.is-locked) {
  cursor: not-allowed;
}
input[type="checkbox"], input[type="radio"] {
  accent-color: var(--check-accent);
}
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
legend {
  padding: 0;
  font-weight: var(--fw-semibold);
}
textarea {
  resize: vertical;
}
::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

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

/* Focus: a visible ring on every interactive element reached by keyboard (§29.4). */
:focus-visible {
  outline: 2px solid var(--focus-color);
  outline-offset: 2px;
}

/* Scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) transparent;
}

/* Icons (§29.5): <svg class="icon" aria-hidden="true"><use href="…/sprite.svg#i-name"/></svg> */
.icon {
  display: inline-block;
  flex-shrink: 0;
  width: var(--icon-md);
  height: var(--icon-md);
  vertical-align: middle;
  color: inherit;
  fill: none;
  stroke: currentColor;
  overflow: visible;
}
.icon-xs { width: var(--icon-xs); height: var(--icon-xs); }
.icon-sm { width: var(--icon-sm); height: var(--icon-sm); }
.icon-lg { width: var(--icon-lg); height: var(--icon-lg); }
.icon-spin {
  animation: wm-spin 900ms linear infinite;
}

/* Skip link "Pereiti prie turinio" (§29.4): first focusable element of every page. */
.skip-link {
  position: absolute;
  inset-inline-start: var(--space-2);
  top: var(--space-2);
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  color: var(--link);
  font-weight: var(--fw-semibold);
  box-shadow: var(--shadow-md);
  transform: translateY(-200%);
  transition: transform var(--dur-fast) var(--ease);
}
.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

/* Shared keyframes (used by components.css and the icon helpers above). */
@keyframes wm-spin {
  to { transform: rotate(360deg); }
}
@keyframes wm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes wm-pop-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
@keyframes wm-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
@keyframes wm-shimmer {
  from { background-position: 150% 0; }
  to { background-position: -50% 0; }
}
@keyframes wm-indeterminate {
  from { transform: translateX(-100%); }
  to { transform: translateX(250%); }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .icon-spin {
    animation-duration: 2400ms;
  }
}

/* Windows high-contrast / forced colours: keep boundaries and focus visible. */
@media (forced-colors: active) {
  :focus-visible {
    outline-color: Highlight;
  }
  .icon {
    forced-color-adjust: auto;
  }
}
