/* Base: reset, typography, focus, helpers. */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

html.has-modal {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background-color: var(--c-bg);
  background-image: radial-gradient(900px 340px at 85% -120px, color-mix(in srgb, var(--c-primary) 11%, transparent), transparent);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  line-height: var(--lh-tight);
  font-weight: var(--fw-bold);
  letter-spacing: -0.005em;
}

p,
dl,
dd,
figure,
blockquote {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

.icon {
  flex: none;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--c-primary-text);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

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

code,
kbd,
samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

::selection {
  background: var(--c-primary-soft-hover);
  color: var(--c-text);
}

:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Inputs show their focus on the surrounding box instead. */
.control__box :focus-visible {
  outline: none;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Notification lines: Urdu is right-to-left, English left-to-right. dir="auto" decides per element. */
[dir="auto"] {
  font-family: var(--font-line);
  unicode-bidi: plaintext;
  text-align: start;
}

[dir="auto"]:dir(rtl) {
  line-height: 2;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--c-primary);
  color: var(--c-on-primary);
  font-weight: var(--fw-semibold);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* The page shown while scripts load. */
.boot {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--sp-4);
  color: var(--c-text-2);
}

.boot img {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  box-shadow: var(--shadow-2);
}

main:focus {
  outline: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
