/* ============================================
   Glucoscape — Global Styles
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Brand */
  --gc-teal: #1A8A7D;
  --gc-teal-light: #22a595;
  --gc-ocean: #0F5B6E;
  --gc-amber: #F4A94E;
  --gc-amber-light: #f6bb72;

  /* Neutrals */
  --gc-ink: #1C2B33;
  --gc-slate: #4A6572;
  --gc-mist: #E8F0F2;
  --gc-snow: #F7FAFB;
  --gc-white: #FFFFFF;

  /* Semantic */
  --gc-in-range: #2ECC87;
  --gc-urgent-high: #E85D5D;

  /* Layout */
  --max-width: 1120px;
  --section-pad: 5rem 1.5rem;
  --radius: 12px;
  --radius-sm: 8px;

  /* Colours (theme-aware) */
  --bg: var(--gc-snow);
  --bg-card: var(--gc-white);
  --text: var(--gc-ink);
  --text-secondary: var(--gc-slate);
  --border: var(--gc-mist);
  --nav-bg: rgba(247, 250, 251, 0.92);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(28, 43, 51, 0.06);
  --shadow-md: 0 4px 16px rgba(28, 43, 51, 0.08);
  --shadow-lg: 0 8px 32px rgba(28, 43, 51, 0.10);

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Dark Mode --- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1a20;
    --bg-card: #162028;
    --text: #e2eaed;
    --text-secondary: #8fa7b3;
    --border: #1e3040;
    --nav-bg: rgba(14, 26, 32, 0.92);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.25);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.3);
  }
}

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

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

body {
  font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a {
  color: var(--gc-teal);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}

a:hover { color: var(--gc-teal-light); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gc-amber);
  outline-offset: 2px;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Sans', system-ui, -apple-system, sans-serif;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); margin-bottom: 1rem; }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); margin-bottom: 0.75rem; }

p + p { margin-top: 1rem; }

/* --- Layout --- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

section {
  padding: var(--section-pad);
}

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
}

.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
  text-decoration: none;
}

.nav__brand:hover { color: var(--gc-teal); }

.nav__logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gc-teal), var(--gc-ocean));
  display: grid;
  place-items: center;
  color: white;
  font-size: 0.85rem;
  font-weight: 800;
  flex-shrink: 0;
}

.nav__links {
  display: flex;
  gap: 1.75rem;
  list-style: none;
}

.nav__links a {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.nav__links a:hover { color: var(--gc-teal); }

/* Mobile nav toggle */
.nav__toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
}

.nav__toggle svg {
  width: 24px;
  height: 24px;
}

@media (max-width: 640px) {
  .nav__toggle { display: block; }
  .nav__links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    gap: 1rem;
  }
  .nav__links.is-open { display: flex; }
}

/* --- Hero --- */
.hero {
  padding: 6rem 1.5rem 4rem;
  text-align: center;
}

.hero__eyebrow {
  display: inline-block;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gc-teal);
  margin-bottom: 1.25rem;
}

.hero h1 {
  max-width: 720px;
  margin: 0 auto 1.5rem;
}

.hero__sub {
  max-width: 560px;
  margin: 0 auto 2.5rem;
  font-size: 1.125rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border-radius: 50px;
  background: var(--gc-teal);
  color: white;
  text-decoration: none;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
}

.hero__cta:hover {
  background: var(--gc-teal-light);
  color: white;
  transform: translateY(-1px);
}

/* --- Screenshot Placeholder --- */
.screenshot {
  padding: 3rem 1.5rem;
}

.screenshot__frame {
  max-width: 340px;
  margin: 0 auto;
  aspect-ratio: 9 / 18;
  border-radius: 28px;
  background: linear-gradient(160deg, var(--gc-ocean) 0%, var(--gc-teal) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: rgba(255,255,255,0.6);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(26,138,125,0.15);
  position: relative;
  overflow: hidden;
}

.screenshot__frame::before {
  content: '';
  position: absolute;
  top: 12px;
  width: 80px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
}

.screenshot__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,0.12);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
}

/* --- Features --- */
.features {
  padding: var(--section-pad);
}

.features__header {
  text-align: center;
  margin-bottom: 3rem;
}

.features__header p {
  max-width: 520px;
  margin: 0.75rem auto 0;
  color: var(--text-secondary);
}

.features__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  max-width: var(--max-width);
  margin: 0 auto;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 1.75rem;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

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

.feature-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 1.25rem;
}

.feature-card__icon--teal  { background: rgba(26,138,125,0.12); color: var(--gc-teal); }
.feature-card__icon--amber { background: rgba(244,169,78,0.12); color: var(--gc-amber); }
.feature-card__icon--green { background: rgba(46,204,135,0.12); color: var(--gc-in-range); }
.feature-card__icon--ocean { background: rgba(15,91,110,0.12); color: var(--gc-ocean); }

.feature-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
}

/* --- Disclaimer Banner --- */
.disclaimer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.disclaimer__inner {
  background: var(--bg-card);
  border: 1px solid var(--gc-amber);
  border-left: 4px solid var(--gc-amber);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.disclaimer__icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.6;
}

.disclaimer__text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.disclaimer__text strong {
  color: var(--text);
}

/* --- Download Section --- */
.download {
  padding: var(--section-pad);
  text-align: center;
}

.download h2 { margin-bottom: 0.75rem; }

.download p {
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.download__badge {
  display: inline-block;
  padding: 0.9rem 2rem;
  border-radius: 12px;
  background: var(--gc-ink);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.2s var(--ease);
}

@media (prefers-color-scheme: dark) {
  .download__badge {
    background: var(--gc-mist);
    color: var(--gc-ink);
  }
}

.download__badge:hover {
  opacity: 0.88;
  color: white;
}

@media (prefers-color-scheme: dark) {
  .download__badge:hover { color: var(--gc-ink); }
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.5rem;
}

.footer__inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.footer__links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  list-style: none;
}

.footer__links a {
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.footer__links a:hover { color: var(--gc-teal); }

.footer__copy {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* --- Legal Pages (privacy, terms, support) --- */
.legal {
  padding: 4rem 1.5rem 5rem;
}

.legal__inner {
  max-width: 720px;
  margin: 0 auto;
}

.legal__inner h1 {
  margin-bottom: 0.5rem;
}

.legal__updated {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 2.5rem;
}

.legal__inner h2 {
  margin-top: 2.5rem;
  font-size: 1.35rem;
}

.legal__inner h3 {
  margin-top: 2rem;
  font-size: 1.1rem;
}

.legal__inner p {
  color: var(--text-secondary);
}

.legal__inner ul, .legal__inner ol {
  color: var(--text-secondary);
  margin: 0.75rem 0 0.75rem 1.5rem;
}

.legal__inner li + li {
  margin-top: 0.4rem;
}

.legal__inner strong {
  color: var(--text);
}

/* --- FAQ (Support Page) --- */
.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem 0;
}

.faq-item:first-of-type {
  border-top: 1px solid var(--border);
}

.faq-item h3 {
  margin-bottom: 0.5rem;
  font-size: 1.05rem;
}

.faq-item p {
  font-size: 0.95rem;
}

/* --- Contact Card --- */
.contact-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-top: 2.5rem;
  text-align: center;
}

.contact-card h2 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.contact-card p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.contact-card a {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
}

/* --- Animations --- */
@media (prefers-reduced-motion: no-preference) {
  .fade-in {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
  }

  .fade-in.is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  .feature-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.45s var(--ease), transform 0.45s var(--ease), box-shadow 0.2s var(--ease);
  }

  .feature-card.is-visible {
    opacity: 1;
    transform: translateY(0);
  }
}

/* For users who prefer reduced motion, ensure everything is visible */
@media (prefers-reduced-motion: reduce) {
  .fade-in,
  .feature-card {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* --- Utilities --- */
.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;
}

.text-center { text-align: center; }
