/* ==========================================================================
   Cross Kashmir — Base
   Font loading, minimal reset, element defaults, accessibility foundation.
   Requires tokens.css.
   ========================================================================== */

/* ---- Fonts: Noto Nastaliq Urdu (variable, SIL OFL 1.1) ------------------- */
@font-face {
  font-family: "Noto Nastaliq Urdu Variable";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/noto-nastaliq-urdu-arabic-wght-normal.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891,
                 U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F,
                 U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: "Noto Nastaliq Urdu Variable";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("../assets/fonts/noto-nastaliq-urdu-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                 U+02DC, U+2000-206F, U+20AC, U+2122, U+2212;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  text-align: start;               /* follows dir="rtl"; never "right" */
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

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

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

img, video {
  height: auto;
}

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

button {
  cursor: pointer;
}

table {
  border-collapse: collapse;
  width: 100%;
}

hr {
  border: 0;
  border-block-start: var(--border);
  margin-block: var(--space-8);
}

/* ---- Links ---------------------------------------------------------------- */
a {
  color: var(--color-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: var(--underline-offset);   /* Nastaliq descenders need extra clearance (see tokens.css) */
}

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

/* ---- Text selection ------------------------------------------------------- */
::selection {
  background-color: var(--color-selection-bg);
  color: var(--color-selection-text);
}

/* ---- Accessibility foundation -------------------------------------------- */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

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

.skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background-color: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-sm);
  transform: translateY(-300%);
}

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

/* ---- Form-control foundation (restrained; refined when forms are built) --- */
label {
  display: block;
  margin-block-end: var(--space-1);
  font-weight: var(--fw-medium);
}

input[type="text"],
input[type="email"],
input[type="search"],
input[type="url"],
input[type="tel"],
select,
textarea {
  display: block;
  width: 100%;
  min-height: var(--tap-target);
  padding: var(--space-1) var(--space-3);
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  line-height: var(--lh-ui);
}

textarea {
  min-height: 8rem;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

/* Latin-only values (email, URL, phone) stay readable in an RTL page */
input[type="email"],
input[type="url"],
input[type="tel"] {
  direction: ltr;
  text-align: start;
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  cursor: not-allowed;
}

/* ---- Reduced motion ------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
