/* Reset, type, and the app shell.
 *
 * The shell is a fixed-height column: header, one scrolling screen, bottom
 * nav — with the canvas painted behind all of it. That structure is what lets
 * the ground act as the status display rather than sitting inside a card.
 */

@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--font-heading-weight);
  line-height: 1.12;
  letter-spacing: -0.015em;
}
p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: var(--color-accent); text-underline-offset: 3px; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* Readings change in place, so keep digits from reflowing. Latin-ordered
   values (clock times, "20′/40′") keep their own direction inside RTL text. */
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ------------------------------------------------------------------ shell */

#root { height: 100%; }

.app {
  position: relative;
  height: 100%;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  overflow: hidden;
}

/* The ground. Behind everything, full bleed, and the app's main status
   display -- not decoration. */
.ground {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

/* The two children that place themselves are excluded by name: this selector
   is two classes and would otherwise out-specify their own `position`, which
   drops the canvas into layout and the toast into the column below the tab
   bar. */
.app > *:not(.ground):not(.toast) { position: relative; z-index: 2; }

.header {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  /* The standalone app owns its status-bar space; inside Telegram the host
     already drew a header above us. */
  padding: calc(var(--safe-top) + 44px) var(--space-3) var(--space-1) var(--space-6);
}

.app[data-host="telegram"] .header {
  padding: var(--space-4) var(--space-3) var(--space-1) var(--space-6);
}

.header__titles {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
}
.header__title { font-size: 16px; font-weight: 500; }
.header__sub { font-size: 12px; color: var(--color-neutral-400); }

/* The scrolling body of whichever screen is showing. Scrollbars are hidden:
   this is a phone surface, and the design shows none. */
.screen {
  flex: 1;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  display: flex;
  flex-direction: column;
}
.screen::-webkit-scrollbar { width: 0; height: 0; display: none; }

/* Home hangs its content off the bottom so the airflow has room above it. */
.screen--home {
  justify-content: flex-end;
  gap: var(--space-6);
  padding: 0 var(--space-6) var(--space-3);
}

.screen--list {
  gap: var(--space-4);
  padding: var(--space-1) var(--space-6) var(--space-6);
}

.screen--form {
  gap: 18px;
  padding: var(--space-1) var(--space-6) var(--space-6);
}

/* ------------------------------------------------------------------- nav */

.nav {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: var(--space-2) var(--space-2) calc(var(--safe-bottom) + 26px);
  background: color-mix(in srgb, var(--color-neutral-900) 78%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: 0 -1px 0 var(--color-divider);
}

.nav__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 7px 2px;
  min-height: 48px;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--color-neutral-400);
  font-size: 10.5px;
}
.nav__item[aria-current="page"] { color: var(--color-accent); }

/* ------------------------------------------------------------------ utils */

.row { display: flex; align-items: center; gap: var(--space-3); }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.none { flex: none; }
.spacer { flex: 1; }
.muted { color: var(--color-neutral-400); }
.dim { color: var(--color-neutral-300); }
.center { text-align: center; }
.hidden { display: none !important; }
.pretty { text-wrap: pretty; }

.kicker {
  font-size: 10px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--color-neutral-400);
}
