/* Azkari Pro — reset, mobile frame and layout primitives. */

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

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

a { color: var(--accent); }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--gold) 70%, transparent);
  outline-offset: 2px;
}

/* Desktop: calm surrounding canvas + centered phone frame. */
.app-shell {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 0;
  background:
    radial-gradient(circle at 18% 12%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
    radial-gradient(circle at 84% 82%, color-mix(in srgb, var(--gold) 14%, transparent), transparent 38%),
    var(--bg);
}

.app-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  min-height: 100dvh;
  background: var(--bg);
  overflow: hidden;
  isolation: isolate;
}

@media (min-width: 560px) {
  .app-shell {
    align-items: center;
    padding: 24px;
  }
  .app-frame {
    height: min(920px, calc(100dvh - 48px));
    min-height: 620px;
    border-radius: 32px;
    box-shadow: var(--shadow-lg);
    border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  }
}

.app-header {
  position: relative;
  flex: 0 0 auto;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  padding-top: max(var(--space-3), env(safe-area-inset-top));
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 10px 30px rgba(8, 40, 28, .22);
  color: var(--header-ink);
  z-index: 5;
}
.app-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 64 64'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-width='1.4'%3E%3Cpath d='M32 2 62 32 32 62 2 32Z'/%3E%3Ccircle cx='32' cy='32' r='14'/%3E%3Cpath d='M0 0h64v64H0z'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 52px 52px;
}
.app-header > * { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 14px;
  color: var(--accent-ink);
  background: linear-gradient(145deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000));
  box-shadow: var(--shadow-sm);
}
.brand-mark svg { width: 30px; height: 30px; }

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--header-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text p {
  margin: 0;
  font-size: var(--fs-xs);
  color: var(--header-gold);
  white-space: nowrap;
}

.header-actions { display: flex; align-items: center; gap: var(--space-2); flex: 0 0 auto; }

.app-main {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: var(--space-4) var(--space-4) calc(var(--nav-height) + var(--space-6));
}
.app-main::-webkit-scrollbar,
.index-list::-webkit-scrollbar,
.search-results::-webkit-scrollbar,
.reader-body::-webkit-scrollbar,
.quick-list::-webkit-scrollbar { display: none; width: 0; height: 0; }
.index-list, .search-results, .reader-body, .quick-list {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.view { display: none; animation: view-in .26s var(--ease); }
.view.is-active { display: block; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.bottom-nav {
  position: absolute;
  inset-inline: 0;
  inset-block-end: 0;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--border);
  z-index: 10;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.nav-item:hover { color: var(--accent); }
.nav-item.is-active { color: var(--accent); }
.nav-item.is-active .nav-icon {
  background: var(--accent-soft);
  transform: translateY(-2px);
}
.nav-item:active { transform: scale(.94); }
.nav-icon {
  width: 38px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill);
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.nav-icon svg { width: 21px; height: 21px; }
