/* ==========================================================================
   Dr Nikhil's Vighnaharta Clinic — Base / Reset / Layout
   Mobile-first. Accessible. Apple-inspired premium feel.
   ========================================================================== */

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

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

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  /* Slide-in reveal animations briefly sit past the screen edge; never let that
     produce a sideways scroll on phones (clip, unlike hidden, keeps sticky working). */
  overflow-x: clip;
  transition: background var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard);
}

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

a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4, h5, h6 { margin: 0 0 0.5em; font-weight: 700; line-height: 1.2; }
p { margin: 0 0 1em; }

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

/* Focus visibility — WCAG 2.4.7 */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip-to-content link for keyboard/screen-reader users */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--color-primary);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Layout shell ---- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-content {
  flex: 1;
  padding: 1.25rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .app-content { padding: 2rem 2.5rem; }
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ---- Utility grid/flex helpers ---- */
.grid { display: grid; gap: 1.25rem; }
.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Grid children may shrink below their content width (tables, long inputs). */
.grid > * { min-width: 0; }
/* Views mark wide cards with an inline `grid-column:span 2`. Where the grid has
   collapsed to a single column that would create a phantom second column and
   push the page wider than the screen, so span the full (single) row instead. */
@media (max-width: 639px) {
  .grid > [style*="grid-column"] { grid-column: 1 / -1 !important; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .grid[class*="lg:grid-cols"]:not([class*="sm:grid-cols"]):not([class*="md:grid-cols"]):not(.grid-cols-2):not(.grid-cols-3) > [style*="grid-column"] { grid-column: 1 / -1 !important; }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.text-muted { color: var(--color-text-muted); }
.text-subtle { color: var(--color-text-subtle); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

/* ---- Scrollbar polish (progressive enhancement) ---- */
* { scrollbar-width: thin; scrollbar-color: var(--color-border-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--color-border-strong); border-radius: var(--radius-full); }
*::-webkit-scrollbar-track { background: transparent; }
