/* ==========================================================================
   DeafTech — styles.css
   Foundation stylesheet: design tokens + reusable component library.
   Vanilla CSS, no preprocessor, no framework. Mobile-first.

   TABLE OF CONTENTS
   1. Reset / Base
   2. Variables (:root custom properties)
   3. Typography
   4. Layout (containers, max-width, grid helpers)
   5. Navigation
   6. Hero
   7. Sections (general spacing/patterns)
   8. Cards
   9. Buttons
   10. Contact
   11. Footer
   12. Responsive (320 / 375 / 414 / 768 / 1024 / 1440+)
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. RESET / BASE
   A lightweight reset — not a full normalize. Keeps default browser
   affordances (focus rings, form controls) mostly intact for accessibility,
   only removing inconsistent spacing/box-sizing quirks.
   -------------------------------------------------------------------------- */

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

html {
  /* Prevents horizontal scroll from any accidental overflow child */
  overflow-x: hidden;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

/* Accessibility: visible focus state for all interactive elements.
   Never rely on browser default alone since it's inconsistent across
   browsers, but never remove it either — only restyle it. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}


/* --------------------------------------------------------------------------
   2. VARIABLES (:root custom properties)
   Central design-token system. Parts 2 & 3 must reuse these tokens rather
   than hard-coding new values, so the visual language stays consistent.
   -------------------------------------------------------------------------- */

:root {
  /* ---- Color: neutrals (backgrounds, borders, dividers) ---- */
  --color-bg: #ffffff;             /* primary page background */
  --color-bg-alt: #f7f8fa;         /* alternating section background */
  --color-surface: #ffffff;        /* card / surface background */
  --color-border: #e3e6eb;         /* subtle hairline borders */

  /* ---- Color: text ---- */
  --color-text: #1b2430;           /* dark charcoal/navy — primary text */
  --color-text-muted: #5a6472;      /* secondary/supporting text */
  --color-text-inverse: #ffffff;    /* text on dark/accent backgrounds */

  /* ---- Color: brand accent (subtle indigo/blue) ---- */
  --color-accent: #3355ee;
  --color-accent-hover: #2944c4;
  --color-accent-soft: #eef1fd;    /* tint background for badges/highlights */

  /* ---- Color: semantic feedback (used sparingly, never sole indicator) ---- */
  --color-success: #1c7a4d;
  --color-danger: #b3261e;

  /* ---- Typography ---- */
  --font-base: Inter, ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", sans-serif;

  --fs-xs: 0.8125rem;   /* 13px */
  --fs-sm: 0.9375rem;   /* 15px */
  --fs-base: 1rem;      /* 16px */
  --fs-md: 1.125rem;    /* 18px */
  --fs-lg: 1.375rem;    /* 22px */
  --fs-xl: 1.75rem;     /* 28px */
  --fs-2xl: 2.25rem;    /* 36px */
  --fs-3xl: 2.75rem;    /* 44px */

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-relaxed: 1.7;

  /* ---- Spacing scale (used for margin/padding/gap consistently) ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  /* ---- Layout ---- */
  --container-max: 1200px;
  --container-padding: var(--space-5);

  /* ---- Border radius ---- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* ---- Shadows (modest, never heavy/glowing) ---- */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.10);

  /* ---- Transitions ---- */
  --transition-fast: 150ms ease;
  --transition-base: 220ms ease;

  /* ---- Z-index scale ---- */
  --z-nav: 100;
  --z-overlay: 200;
}


/* --------------------------------------------------------------------------
   3. TYPOGRAPHY
   Base text rendering. Heading sizes use the font-size tokens above so
   later content sections inherit a consistent type scale.
   -------------------------------------------------------------------------- */

body {
  font-family: var(--font-base);
  font-size: var(--fs-base);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  color: var(--color-text);
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p {
  color: var(--color-text-muted);
  line-height: var(--lh-relaxed);
}

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

.text-eyebrow {
  /* Small uppercase label used above section headings */
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
}


/* --------------------------------------------------------------------------
   4. LAYOUT (containers, max-width, grid helpers)
   -------------------------------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
}

/* Narrower container for text-heavy content (e.g. privacy policy) */
.container--narrow {
  max-width: 760px;
}

.grid {
  display: grid;
  gap: var(--space-6);
}

.grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

/* Mobile-first: multi-column grids collapse to a single column by default,
   then expand at the md/lg breakpoints in section 12. */
.grid--2,
.grid--3,
.grid--4 {
  grid-template-columns: 1fr;
}

.stack {
  display: flex;
  flex-direction: column;
}

.cluster {
  /* Horizontally flowing group with wrapping (e.g. tag lists, button rows) */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}


/* --------------------------------------------------------------------------
   5. NAVIGATION
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background-color: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--color-border);
}

.navbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
  gap: var(--space-4);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-links a {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  padding: var(--space-2) var(--space-1);
  transition: color var(--transition-fast);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--color-text);
}

/* Mobile menu toggle button — functional as of Part 2 (script.js toggles
   the .nav-links--open class below). Hidden on desktop via the responsive
   section since the inline nav is visible there instead. */
.nav-toggle {
  display: none;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

/* Part 2 addition: mobile dropdown panel for .nav-links when opened by the
   hamburger toggle. Only applies below the 768px breakpoint (see section 12
   which hides .nav-links by default on mobile — this class overrides that). */
.nav-links--open {
  display: flex !important;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  background-color: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  padding: var(--space-3) var(--container-padding) var(--space-4);
}

.nav-links--open a {
  width: 100%;
  padding: var(--space-3) 0;
}


/* --------------------------------------------------------------------------
   6. HERO
   -------------------------------------------------------------------------- */

.hero {
  padding-block: var(--space-9) var(--space-8);
}

.hero .text-eyebrow {
  margin-bottom: var(--space-3);
}

.hero h1 {
  margin-bottom: var(--space-4);
}

.hero p {
  margin-bottom: var(--space-2);
}

.hero-content {
  max-width: 680px;
}

.hero-actions {
  margin-top: var(--space-6);
}


/* --------------------------------------------------------------------------
   7. SECTIONS
   Consistent vertical rhythm and alternating background pattern reused
   across all content sections in Parts 2 & 3.
   -------------------------------------------------------------------------- */

.section {
  padding-block: var(--space-9);
}

.section--alt {
  background-color: var(--color-bg-alt);
}

.section-header {
  max-width: 640px;
  margin-bottom: var(--space-7);
}

.section-header > .text-eyebrow {
  margin-bottom: var(--space-3);
}

/* Part 2 addition: Featured App section — visually more prominent than a
   standard .card, used to spotlight the flagship app. Reuses design tokens
   (radius, shadow, accent) rather than introducing new ad hoc values. */
.featured-app-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-8);
  background-image: linear-gradient(180deg, var(--color-accent-soft) 0%, var(--color-surface) 55%);
}

.featured-app-content {
  max-width: 640px;
}

.featured-app-content h2 {
  margin-top: var(--space-2);
  margin-bottom: var(--space-4);
}


/* --------------------------------------------------------------------------
   8. CARDS
   Generic reusable card — used for app listings, feature/"what we build"
   blocks, team info, etc. Keep visually restrained: hairline border +
   modest shadow, no heavy gradients.
   -------------------------------------------------------------------------- */

.card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background-color: var(--color-accent-soft);
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--fs-md);
  margin-bottom: var(--space-2);
}

.card-body {
  font-size: var(--fs-sm);
}

/* Part 3 addition: app cards in the Our Apps grid extend .card. They stack
   with flex so the optional Galaxy Store button (present on some cards,
   absent on others per verified-URL rules) always sits at the card bottom
   without misaligning the grid row heights. */
.app-card {
  display: flex;
  flex-direction: column;
}

.app-category {
  margin-bottom: var(--space-3);
}

.app-card .card-title {
  margin-bottom: var(--space-2);
}

.app-card .card-body {
  margin-bottom: var(--space-5);
  flex-grow: 1;
}

.app-card .btn {
  align-self: flex-start;
}

/* Part 3 addition: Company Information section — reuses .card as the
   outer surface, styled internally as a simple definition list. */
.company-info-card {
  max-width: 640px;
}

.company-info-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.company-info-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border);
}

.company-info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.company-info-row dt {
  flex: 0 0 140px;
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
}

.company-info-row dd {
  flex: 1 1 200px;
  font-size: var(--fs-sm);
}


/* --------------------------------------------------------------------------
   9. BUTTONS
   Primary (solid accent) and secondary (outline) CTA styles. Minimum 44px
   tap target height for mobile accessibility.
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  transition: background-color var(--transition-fast),
    color var(--transition-fast),
    border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-text-inverse);
  border: 1px solid var(--color-accent);
}

.btn--primary:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}

.btn--secondary {
  background-color: transparent;
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn--secondary:hover {
  border-color: var(--color-text-muted);
  background-color: var(--color-bg-alt);
}

/* Part 2 addition: applied to CTAs whose destination URL is not yet
   verified (e.g. Featured App "View on Galaxy Store"). Visually communicates
   a pending state without looking broken — remove this class once the real
   URL is confirmed and inserted. */
.btn--pending-url {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

/* Part 3 addition: compact button variant for card-level CTAs (e.g. the
   "Galaxy Store" link on each app card), where the full-size .btn would
   feel oversized relative to the card. Tap target stays >= 40px. */
.btn--sm {
  min-height: 40px;
  padding: var(--space-2) var(--space-5);
  font-size: var(--fs-xs);
}


/* --------------------------------------------------------------------------
   10. CONTACT
   -------------------------------------------------------------------------- */

.contact {
  padding-block: var(--space-9);
}

/* Part 3 addition: plainly displayed postal address, no form. */
.contact-address {
  display: block;
  margin-top: var(--space-5);
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  line-height: var(--lh-relaxed);
}

.contact-grid {
  display: grid;
  gap: var(--space-6);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.form-field label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}

.form-field input,
.form-field textarea {
  font: inherit;
  padding: var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  color: var(--color-text);
  min-height: 44px;
}

.form-field textarea {
  min-height: 120px;
  resize: vertical;
}


/* --------------------------------------------------------------------------
   11. FOOTER
   -------------------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding-block: var(--space-7);
  background-color: var(--color-bg-alt);
}

.footer-grid {
  display: grid;
  gap: var(--space-6);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-5);
}

.footer-links a {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--color-text);
}

.footer-bottom {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--color-border);
  font-size: var(--fs-xs);
  color: var(--color-text-muted);
}


/* --------------------------------------------------------------------------
   ANIMATION UTILITY (Part 2 addition)
   Gentle fade-in-on-scroll, driven by an IntersectionObserver in script.js
   which adds .is-visible once a .fade-in element enters the viewport.
   Progressive enhancement only: base state is fully visible, so content
   never depends on JS to be shown (works with JS disabled).
   -------------------------------------------------------------------------- */

.fade-in {
  opacity: 1;
  transform: none;
}

.js-enabled .fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.js-enabled .fade-in.is-visible {
  opacity: 1;
  transform: none;
}


/* --------------------------------------------------------------------------
   LOGO / BRANDING
   Reusable wordmark: small abstract geometric icon (inline SVG) + text.
   Drop this markup (.logo) into the nav and footer in later parts:

   <a href="index.html" class="logo">
     <span class="logo-mark" aria-hidden="true">
       <svg viewBox="0 0 24 24" width="24" height="24">
         <rect x="1" y="1" width="10" height="10" rx="3" fill="currentColor"/>
         <rect x="13" y="1" width="10" height="10" rx="3" fill="var(--color-accent)" opacity="0.4"/>
         <rect x="1" y="13" width="10" height="10" rx="3" fill="var(--color-accent)" opacity="0.4"/>
         <rect x="13" y="13" width="10" height="10" rx="3" fill="currentColor"/>
       </svg>
     </span>
     <span class="logo-text">DeafTech</span>
   </a>
   -------------------------------------------------------------------------- */

.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text);
}

.logo-mark {
  display: inline-flex;
  color: var(--color-accent);
}

.logo-text {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
}


/* --------------------------------------------------------------------------
   12. RESPONSIVE
   Mobile-first: base rules above target ~320–414px phones already.
   Progressive enhancement upward through tablet/desktop breakpoints.
   -------------------------------------------------------------------------- */

/* ~375px and up: minor breathing room increase */
@media (min-width: 375px) {
  :root {
    --container-padding: var(--space-5);
  }
}

/* ~414px and up: large phones */
@media (min-width: 414px) {
  .hero {
    padding-block: var(--space-9) var(--space-8);
  }
}

/* Tablet, 768px and up */
@media (min-width: 768px) {
  :root {
    --container-padding: var(--space-6);
  }

  h1 { font-size: var(--fs-3xl); }

  .grid--2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .nav-toggle {
    display: none;
  }

  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Small desktop / large tablet, 1024px and up */
@media (min-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .contact-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Large desktop, 1440px and up */
@media (min-width: 1440px) {
  :root {
    --container-max: 1280px;
  }

  h1 { font-size: 3.25rem; }
}

/* Below 768px: collapse inline nav links in favor of the mobile toggle.
   Functional open/close behavior is wired up when nav markup is added. */
@media (max-width: 767px) {
  .nav-links {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
  }
}
