/* ============================================================================
   WithRajesh.com - v4 base layer (Feature #27)
   Loaded after tokens.css. Contains: font faces, reset, base element styles,
   layout containers, accessibility primitives, and the shared utilities the
   component layer builds on. Component classes live in components.css.

   Rule: this file references TIER 2/3 tokens only. No literal colors.
   ============================================================================ */

/* ----------------------------------------------------------------------------
   Fonts - self-hosted Inter variable (no third-party requests)
   ---------------------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/InterVariable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../fonts/InterVariable-Italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}

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

/* [hidden] must win. Any component that sets its own display (.menu, .btn,
   .floating-cluster child) would otherwise re-show itself, which leaves the
   element visible while assistive tech is told it is hidden. */
[hidden] { display: none !important; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
  /* Offset in-page anchors so a sticky header never covers the target
     (SC 2.4.11 Focus Not Obscured). */
  scroll-padding-top: calc(var(--topbar-height) + var(--space-4));
}

body {
  margin: 0;
  overflow-x: clip;
  background-color: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  font-weight: var(--weight-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }
ul[role="list"], ol[role="list"] { list-style: none; margin: 0; padding: 0; }

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

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

/* Long words and URLs must not force horizontal scroll at 320px (SC 1.4.10). */
p, li, h1, h2, h3, h4, h5, h6, dd, dt, td, th, figcaption {
  overflow-wrap: break-word;
}

/* Alpine: hide until initialised. */
[x-cloak] { display: none !important; }

/* ----------------------------------------------------------------------------
   Typography scale
   ---------------------------------------------------------------------------- */
h1, .text-h1 { font-size: var(--text-4xl); line-height: var(--leading-4xl); font-weight: var(--weight-bold);     letter-spacing: var(--tracking-tight); }
h2, .text-h2 { font-size: var(--text-3xl); line-height: var(--leading-3xl); font-weight: var(--weight-bold);     letter-spacing: var(--tracking-tight); }
h3, .text-h3 { font-size: var(--text-2xl); line-height: var(--leading-2xl); font-weight: var(--weight-semibold); }
h4, .text-h4 { font-size: var(--text-xl);  line-height: var(--leading-xl);  font-weight: var(--weight-semibold); }
h5, .text-h5 { font-size: var(--text-lg);  line-height: var(--leading-lg);  font-weight: var(--weight-semibold); }
h6, .text-h6 { font-size: var(--text-base);line-height: var(--leading-base);font-weight: var(--weight-semibold); }

.text-display {
  font-size: var(--text-5xl);
  line-height: var(--leading-5xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}
@media (min-width: 48rem) { .text-display { font-size: var(--text-6xl); line-height: var(--leading-6xl); } }
@media (min-width: 64rem) { .text-display { font-size: var(--text-7xl); line-height: var(--leading-7xl); } }

.text-lead  { font-size: var(--text-lg); line-height: var(--leading-lg); color: var(--color-text-secondary); }
.text-small { font-size: var(--text-sm); line-height: var(--leading-sm); }
.text-micro { font-size: var(--text-xs); line-height: var(--leading-xs); }

.text-muted     { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-brand     { color: var(--color-text-brand); }

/* Vivid display orange. Permitted ONLY at >= 24px or >= 19px bold, where the
   3:1 large-text threshold applies (SC 1.4.3). Never for body copy. */
.text-brand-display { color: var(--color-brand-display); }

a {
  color: var(--color-text-link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--color-text-link-hover); }

/* Links inside prose are underlined so they are not identified by color alone
   (SC 1.4.1). Navigation and buttons are exempt - position identifies them. */
.prose a { text-decoration: underline; }

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--color-text-brand);
}

.tracking-luxe { letter-spacing: var(--tracking-luxe); }

/* ----------------------------------------------------------------------------
   Long-form prose (archetype B: articles, legal, founder)
   ---------------------------------------------------------------------------- */
.prose {
  max-width: var(--measure-prose);
  font-size: var(--text-lg);
  line-height: var(--leading-lg);
  color: var(--color-text-secondary);
}
.prose > * + *            { margin-top: var(--space-6); }
.prose h2                 { margin-top: var(--space-12); color: var(--color-text-primary); }
.prose h3                 { margin-top: var(--space-10); color: var(--color-text-primary); }
.prose h2 + *, .prose h3 + * { margin-top: var(--space-4); }
.prose ul, .prose ol      { padding-left: var(--space-6); }
.prose li + li            { margin-top: var(--space-2); }
.prose img, .prose figure { border-radius: var(--radius-md); }
.prose blockquote {
  padding-left: var(--space-6);
  border-left: var(--border-thick) solid var(--color-brand);
  color: var(--color-text-primary);
  font-style: italic;
}
.prose pre {
  padding: var(--space-4);
  overflow-x: auto;
  background: var(--color-surface-sunken);
  border: var(--border-thin) solid var(--color-border);
  border-radius: var(--radius-md);
}
.prose hr { border: 0; border-top: var(--border-thin) solid var(--color-border-subtle); }

/* ----------------------------------------------------------------------------
   Layout containers (Atlassian grid model)
   The grid spans the main content area only - never the side nav or panel.
   ---------------------------------------------------------------------------- */
.container,
.container-wide {
  width: 100%;
  max-width: var(--container-wide);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.container-narrow {
  width: 100%;
  max-width: var(--container-narrow);
  margin-inline: auto;
  padding-inline: var(--space-4);
}
.container-fluid {
  width: 100%;
  padding-inline: var(--space-4);
}
@media (min-width: 48rem) {
  .container, .container-wide, .container-narrow, .container-fluid {
    padding-inline: var(--space-6);
  }
}
@media (min-width: 64rem) {
  .container, .container-wide, .container-narrow, .container-fluid {
    padding-inline: var(--space-8);
  }
}

/* Grid children must be allowed to shrink below their content width, or long
   words force two-dimensional scrolling at 320px (SC 1.4.10). */
.grid > *, .flex > * { min-width: 0; }

.section      { padding-block: var(--space-16); }
@media (min-width: 48rem) { .section { padding-block: var(--space-24); } }
.section-tight { padding-block: var(--space-12); }

.stack > * + * { margin-top: var(--space-4); }
.stack-sm > * + * { margin-top: var(--space-2); }
.stack-lg > * + * { margin-top: var(--space-8); }

/* A wrapping row of inline things: button pairs, chip sets, avatar stacks.
   It wraps rather than shrinking, so the gap has to hold in both axes. */
.demo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

/* ----------------------------------------------------------------------------
   Accessibility primitives
   ---------------------------------------------------------------------------- */

/* Visible, on-brand keyboard focus ring (SC 2.4.7).
   Buttons, links, and discrete controls use an offset outline on keyboard focus. */
:where(a, button, [role="button"], summary, [tabindex], input[type="checkbox"], input[type="radio"]):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Form controls (text inputs, selects, textareas) use a seamless border + ring
   instead of an offset outline, eliminating the double-border gap.
   outline: 2px solid transparent preserves high contrast / forced-colors accessibility. */
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea):focus,
:where(input:not([type="checkbox"]):not([type="radio"]):not([type="button"]):not([type="submit"]):not([type="range"]):not([type="color"]):not([type="file"]), select, textarea):focus-visible {
  outline: 2px solid transparent;
  outline-offset: 0;
  border-color: var(--color-border-focus);
  box-shadow: var(--focus-ring-shadow);
}

/* Screen-reader-only text that still receives focus when tabbed to. */
.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;
}
.not-sr-only {
  position: static;
  width: auto; height: auto;
  padding: 0; margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: var(--z-max);
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: var(--border-thin) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--elevation-overlay);
}
.skip-link:focus { left: var(--space-4); top: var(--space-4); }

/* Every pointer target must be at least 24x24 CSS px (SC 2.5.8). Apply to any
   control whose visual box is smaller than its required hit area - the
   pseudo-element expands the target without changing the layout. */
.target-min {
  position: relative;
}
.target-min::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 100%; height: 100%;
  min-width: var(--target-min);
  min-height: var(--target-min);
  transform: translate(-50%, -50%);
}

/* Live regions are announced, not seen. */
.live-region { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

::selection {
  background: var(--color-brand-tint-20);
  color: var(--color-text-primary);
}

/* ----------------------------------------------------------------------------
   Motion
   ---------------------------------------------------------------------------- */
a, button, [role="button"], input, select, textarea, .lift {
  transition:
    color var(--dur-fast) var(--ease-standard),
    background-color var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    opacity var(--dur-fast) var(--ease-standard),
    transform var(--dur-fast) var(--ease-standard);
}

.lift:hover {
  transform: translateY(-2px);
  border-color: var(--color-border-hover);
}

/* Belt and braces: the duration tokens already collapse to 1ms under reduced
   motion, but third-party or inline animations do not read our tokens. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .lift:hover { transform: none; }
}

/* ----------------------------------------------------------------------------
   Texture and brand effects (carried forward from v3)
   ---------------------------------------------------------------------------- */
.grain { position: relative; }
.grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: var(--z-base);
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.glow-brand {
  background: radial-gradient(60% 50% at 50% 0%, var(--color-brand-tint-10), transparent 70%);
}

.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.no-scrollbar::-webkit-scrollbar { display: none; }

.rule { height: var(--border-thin); background: var(--color-border-subtle); border: 0; }

/* ----------------------------------------------------------------------------
   Icons - inline SVG sprite, no runtime icon library
   <svg class="icon" aria-hidden="true"><use href="/icons/sprite.svg#i-check"/></svg>
   ---------------------------------------------------------------------------- */
.icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.5rem; height: 1.5rem; }
.icon-xl { width: 2rem; height: 2rem; }

/* ----------------------------------------------------------------------------
   Section accents
   Set --section-accent on a shell root and descendants pick it up. Used for
   wayfinding chrome only (rails, chips, icon tiles), never for primary CTAs -
   the brand orange owns those across every subdomain (SC 3.2.4).
   ---------------------------------------------------------------------------- */
[data-section]              { --section-accent: var(--color-brand); }
[data-section="connect"]    { --section-accent: var(--color-section-connect); }
[data-section="work"]       { --section-accent: var(--color-section-work); }
[data-section="learn"]      { --section-accent: var(--color-section-learn); }
[data-section="support"]    { --section-accent: var(--color-section-support); }
[data-section="collaborate"]{ --section-accent: var(--color-section-collaborate); }
[data-section="invest"]     { --section-accent: var(--color-section-invest); }
[data-section="build"]      { --section-accent: var(--color-section-build); }
[data-section="secure"]     { --section-accent: var(--color-section-secure); }
[data-section="automate"]   { --section-accent: var(--color-section-automate); }

.text-section { color: var(--section-accent); }
.bg-section-tint { background: color-mix(in srgb, var(--section-accent) 10%, transparent); }
.border-section { border-color: var(--section-accent); }

/* ----------------------------------------------------------------------------
   Print
   ---------------------------------------------------------------------------- */
@media print {
  .no-print, .skip-link { display: none !important; }
  body { background: #fff; color: #000; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 0.8em; }
}
