/* ============================================
   TimeKeeper Landing Page — CSS Foundation
   ============================================ */

/* ----- 1. CSS Custom Properties / Color System ----- */

:root,
[data-theme="light"] {
  /* Brand colors — light mode */
  --color-accent-primary: #4F46E5;
  --color-countdown-safe: #22C55E;
  --color-countdown-warning: #F59E0B;
  --color-countdown-urgent: #F97316;
  --color-countdown-expired: #EF4444;

  /* Surface & text — light mode */
  --color-bg: #FFFFFF;
  --color-bg-alt: #F9FAFB;
  --color-surface: #F3F4F6;
  --color-surface-raised: #FFFFFF;
  --color-text: #111827;
  --color-text-secondary: #4B5563;
  --color-text-inverse: #FFFFFF;
  --color-border: #E5E7EB;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
  /* Brand colors — dark mode */
  --color-accent-primary: #6366F1;
  --color-countdown-safe: #4ADE80;
  --color-countdown-warning: #FBBF24;
  --color-countdown-urgent: #FB923C;
  --color-countdown-expired: #F87171;

  /* Surface & text — dark mode */
  --color-bg: #111827;
  --color-bg-alt: #1F2937;
  --color-surface: #1F2937;
  --color-surface-raised: #374151;
  --color-text: #F9FAFB;
  --color-text-secondary: #D1D5DB;
  --color-text-inverse: #111827;
  --color-border: #374151;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.4);
}

/* ----- 2. Base Reset & Typography ----- */

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  color: var(--color-text);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.25rem; }

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

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

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: none;
}

/* ----- 3. Layout Utilities ----- */

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

.section {
  padding: 4rem 0;
}

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

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

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

/* ----- 4. Buttons ----- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 600;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

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

.btn-primary:hover {
  opacity: 0.9;
  text-decoration: none;
  transform: translateY(-1px);
}

/* ----- 5. Navigation Bar ----- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--color-surface-raised);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.2s ease;
}

.navbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.navbar-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  display: flex;
  align-items: center;
}

.navbar-logo {
  height: 36px;
  width: auto;
  border-radius: 8px;
}

.navbar-brand:hover {
  text-decoration: none;
  color: var(--color-accent-primary);
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.navbar-links a {
  color: var(--color-text-secondary);
  font-weight: 500;
  transition: color 0.2s ease;
}

.navbar-links a:hover {
  color: var(--color-accent-primary);
  text-decoration: none;
}

.navbar-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  color: var(--color-text-secondary);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.navbar-controls button:hover {
  background-color: var(--color-surface);
  color: var(--color-text);
}

/* Hamburger menu button — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.375rem;
  color: var(--color-text);
}

.hamburger span {
  display: block;
  width: 1.25rem;
  height: 2px;
  background-color: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.hamburger span + span {
  margin-top: 4px;
}

/* ----- 6. Hero Section ----- */

.hero {
  padding: 5rem 0;
  background-color: var(--color-bg-alt);
  overflow: visible;
}

.hero .container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  overflow: visible;
}

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

.hero-content h1 {
  margin-bottom: 1rem;
}

.hero-content .tagline {
  font-size: 1.25rem;
  color: var(--color-text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Hero Mockup — 3-device composition */
.hero-mockup {
  position: relative;
  width: 100%;
  max-width: 550px;
  display: inline-block;
}

.hero-mockup img {
  display: block;
  max-width: 100%;
  height: auto;
  background: transparent;
}

.hero-ipad {
  width: 100%;
  display: block;
  z-index: 1;
  border-radius: 10px;
}

.hero-iphone {
  position: absolute;
  width: 32%;
  right: -4%;
  bottom: 0;
  z-index: 2;
  border-radius: 16px;
}

.hero-watch {
  position: absolute;
  width: 16%;
  right: 26%;
  bottom: 0;
  z-index: 3;
  border-radius: 14px;
}

/* ----- 7. Features Grid ----- */

.features {
  padding: 4rem 0;
}

.features h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.feature-card {
  background-color: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

.feature-card .icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

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

.feature-card p {
  font-size: 0.9375rem;
  margin-bottom: 0;
}

/* ----- 8. Lifecycle Ring Section ----- */

.lifecycle {
  padding: 4rem 0;
  background-color: var(--color-bg-alt);
}

.lifecycle h2 {
  text-align: center;
  margin-bottom: 2.5rem;
}

.lifecycle-rings {
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.lifecycle-ring-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.lifecycle-ring {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 8px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.lifecycle-ring.safe {
  border-color: var(--color-countdown-safe);
  color: var(--color-countdown-safe);
}

.lifecycle-ring.warning {
  border-color: var(--color-countdown-warning);
  color: var(--color-countdown-warning);
}

.lifecycle-ring.urgent {
  border-color: var(--color-countdown-urgent);
  color: var(--color-countdown-urgent);
}

.lifecycle-ring.expired {
  border-color: var(--color-countdown-expired);
  color: var(--color-countdown-expired);
}

.lifecycle-ring-item .label {
  font-weight: 600;
  color: var(--color-text);
}

.lifecycle-ring-item .range {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* ----- 9. CTA Section ----- */

.cta-section {
  padding: 4rem 0;
  text-align: center;
}

.cta-section h2 {
  margin-bottom: 1rem;
}

.cta-section p {
  margin-bottom: 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

/* ----- 10. Footer ----- */

.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg-alt);
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--color-text-secondary);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--color-accent-primary);
}

.footer .copyright {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

/* ----- 11. Support & Privacy Page Styles ----- */

.page-content {
  padding: 3rem 0;
  max-width: 800px;
  margin: 0 auto;
}

.page-content h1 {
  margin-bottom: 2rem;
}

.page-content h2 {
  margin-top: 2rem;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.page-content p {
  margin-bottom: 1rem;
}

.faq-item {
  margin-bottom: 1.5rem;
  padding: 1.25rem;
  background-color: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
}

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

.faq-item p {
  margin-bottom: 0;
}

/* ============================================
   12. Responsive Breakpoints
   ============================================ */

/* --- Tablet: up to 1024px --- */
@media (max-width: 1024px) {
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Mobile: below 768px --- */
@media (max-width: 767px) {
  /* Navigation — hamburger visible, links hidden */
  .hamburger {
    display: flex;
  }

  .navbar-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 4rem;
    left: 0;
    right: 0;
    background-color: var(--color-surface-raised);
    border-bottom: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    padding: 1rem 1.5rem;
    gap: 1rem;
  }

  .nav-open .navbar-links {
    display: flex;
  }

  /* Features — single column */
  .features-grid {
    grid-template-columns: 1fr;
  }

  /* Hero adjustments */
  .hero {
    padding: 3rem 0;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .hero-content .tagline {
    font-size: 1.1rem;
  }

  .hero-mockup {
    max-width: 400px;
  }

  /* Lifecycle rings — wrap tighter */
  .lifecycle-rings {
    gap: 1.25rem;
  }

  .lifecycle-ring {
    width: 80px;
    height: 80px;
    border-width: 6px;
    font-size: 0.75rem;
  }

  /* Footer stacks */
  .footer .container {
    flex-direction: column;
    text-align: center;
  }

  /* Section padding */
  .section {
    padding: 2.5rem 0;
  }

  /* Page content padding */
  .page-content {
    padding: 2rem 1rem;
  }
}

/* --- Tablet: 768px+ — hero side-by-side --- */
@media (min-width: 768px) {
  .hero .container {
    flex-direction: row;
    text-align: left;
  }
  .hero-content {
    flex: 1;
    text-align: left;
  }
  .hero-mockup {
    flex: 1.5;
    max-width: 700px;
  }
  .hero-iphone {
    width: 30%;
    right: -3%;
  }
  .hero-watch {
    width: 15%;
    right: 25%;
  }
}

/* --- Desktop: 1024px+ --- */
@media (min-width: 1024px) {
  .hero-mockup {
    flex: 1.6;
    max-width: 800px;
  }
  .hero-iphone {
    width: 28%;
    right: -2%;
  }
  .hero-watch {
    width: 14%;
    right: 24%;
  }
}

/* --- Large desktop: up to 2560px --- */
@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }

  h1 {
    font-size: 3rem;
  }

  h2 {
    font-size: 2.25rem;
  }
}
