/* ===== Base (dark as default) ===== */
:root {
  /* Dark theme (default) */
  --bg: #070a0f;            /* darker base */
  --fg: #e9f1fb;
  --muted: #b7c2cf;
  --brand: #66e0a3;
  --brand-2: #7de4ff;
  --brand-ink: #0e1b16;

  --panel: #101720;
  --card: #121822;
  --card-hover: #162031;
  --ring: #2e7dff33;
  --section-border: rgba(125,228,255,0.12);

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, Inter, Arial, sans-serif;
  color: var(--fg);

  /* Layered background with enhanced depth */
  background:
    linear-gradient(135deg, rgba(125,228,255,0.06), rgba(102,224,163,0.05)),
    radial-gradient(60vw 60vh at 80% -10%, rgba(10,16,26,0.75) 0%, transparent 60%),
    radial-gradient(70vw 70vh at -10% 0%, rgba(9,14,22,0.75) 0%, transparent 60%),
    /* fainter grid */
    repeating-linear-gradient(
      0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 26px
    ),
    repeating-linear-gradient(
      90deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 26px
    ),
    var(--bg);
  background-attachment: fixed;
}

.container { width: min(1100px, 92vw); margin: 0 auto; }

header { padding: 48px 0 8px; }

.brand { display: flex; align-items: center; gap: 14px; }
.logo-img {
  width: 44px; height: 44px; display: block;
  border-radius: 12px;
  background: radial-gradient(18px 18px at 30% 30%, rgba(125,228,255,0.45), transparent 60%);
  box-shadow:
    0 0 0 1px rgba(125,228,255,0.22) inset,
    0 10px 24px rgba(0,0,0,0.35);
}
h1 { margin: 0; font-size: 28px; letter-spacing: 0.2px; }
.subtitle { margin: 4px 0 0; color: var(--muted); }

/* Section Styling */
.app-section {
  margin-bottom: 48px;
}

.app-section:last-of-type {
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding-bottom: 12px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--section-border);
  color: var(--fg);
}

.section-icon {
  font-size: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(125,228,255,0.15), rgba(102,224,163,0.12));
  border: 1px solid rgba(125,228,255,0.2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding: 0;
}

.card {
  display: block;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, var(--card), #0d1420);
  border: 1px solid #1a2636;
  text-decoration: none; color: inherit;
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
  transform: translateY(0);
  transition:
    transform .2s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow .2s cubic-bezier(0.4, 0, 0.2, 1),
    background .2s ease,
    border-color .2s ease;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--brand-2), var(--brand));
  opacity: 0;
  transition: opacity .2s ease;
}

.card:hover::before,
.card:focus-visible::before {
  opacity: 1;
}

.card:hover, .card:focus-visible {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: rgba(125,228,255,0.45);
  outline: none;
  box-shadow:
    0 0 0 4px var(--ring),
    0 16px 32px rgba(0,0,0,0.3);
}

.card-icon { 
  font-size: 32px; 
  margin-bottom: 12px;
  display: block;
  line-height: 1;
}

.card-title { 
  font-weight: 700; 
  font-size: 18px; 
  letter-spacing: .2px;
  margin-bottom: 6px;
}

.card-desc { 
  margin: 0; 
  color: var(--muted); 
  font-size: 14px;
  line-height: 1.4;
}

.footer {
  padding: 32px 0 64px;
  color: var(--muted);
  font-size: 14px;
}

/* Make the footer link darker and bolder for both themes */
.footer a {
  color: #0a4aa6;           /* high-contrast blue */
  font-weight: 600;         /* boost legibility */
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .2s ease;
}

.footer a:hover {
  color: #0856c9;
}

/* ===== Light theme overrides (auto, based on OS) ===== */
@media (prefers-color-scheme: light) {
  :root {
    /* Blue-forward palette */
    --bg: #eaf3ff;          /* pleasant soft blue base */
    --fg: #0b1f33;          /* deep navy text */
    --muted: #3f5870;

    --brand: #1fbf7a;
    --brand-2: #2cb7ff;
    --brand-ink: #08324d;

    --panel: #ffffff;
    --card: #ffffff;
    --card-hover: #f2f7ff;
    --ring: rgba(44,183,255,0.22);
    --section-border: rgba(44,183,255,0.25);

    color-scheme: light;
  }

  body {
    /* Blue gradient + subtle blue grid for depth */
    background:
      linear-gradient(180deg, #eaf3ff 0%, #d6eaff 40%, #c7e1ff 100%),
      repeating-linear-gradient(
        0deg, rgba(10,74,166,0.06) 0 1px, transparent 1px 28px
      ),
      repeating-linear-gradient(
        90deg, rgba(10,74,166,0.06) 0 1px, transparent 1px 28px
      ),
      var(--bg);
  }

  .logo-img {
    box-shadow:
      0 0 0 1px rgba(44,183,255,0.22) inset,
      0 8px 18px rgba(0,0,0,0.08);
    background: radial-gradient(18px 18px at 30% 30%, rgba(44,183,255,0.35), transparent 60%);
  }

  .section-icon {
    background: linear-gradient(135deg, rgba(44,183,255,0.18), rgba(31,191,122,0.15));
    border: 1px solid rgba(44,183,255,0.3);
  }

  .card {
    border-color: #cfe0f1;
    box-shadow: 0 6px 16px rgba(17,36,56,0.08);
    background: linear-gradient(180deg, #ffffff, #f9fcff);
  }

  .card:hover, .card:focus-visible {
    border-color: rgba(44,183,255,0.55);
    box-shadow:
      0 0 0 4px var(--ring),
      0 14px 28px rgba(17,36,56,0.12);
  }

  .footer a {
    color: #0856c9;
  }

  .footer a:hover {
    color: #0a4aa6;
  }
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
  }

  .section-title {
    font-size: 18px;
  }

  .card {
    padding: 16px;
  }

  .card-icon {
    font-size: 28px;
  }
}
