/* ===== Landing Page Styles ===== */

/* CSS Variables */
:root {
  --lp-bg: #FAFAFA;
  --lp-text: #171717;
  --lp-text-muted: #666666;
  --lp-border: #e5e7eb;
  --lp-border-cross: rgb(168, 168, 168);
  --lp-card-hover: #f9fafb;
  --lp-arrow-bg: #f3f4f6;
  --lp-cta-text: #374151;
  --lp-footer-text: #6b7280;
  --lp-max-w: 72rem;
}

[data-mode='dark'] {
  --lp-bg: #000;
  --lp-text: #f3f4f6;
  --lp-text-muted: #9ca3af;
  --lp-border: #1f2937;
  --lp-border-cross: #374151;
  --lp-card-hover: rgba(17, 24, 39, 0.3);
  --lp-arrow-bg: #1f2937;
  --lp-cta-text: #d1d5db;
  --lp-footer-text: #9ca3af;
}

/* ===== Base Reset ===== */
html,
body {
  margin: 0;
  padding: 0;
}

.landing-page * {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.landing-page {
  min-height: 100vh;
  background: var(--lp-bg);
  color: var(--lp-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.5;
}

/* ===== Header ===== */
.lp-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--lp-bg);
  border-bottom: 1px solid var(--lp-border);
}

.lp-nav {
  max-width: var(--lp-max-w);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

@media (min-width: 640px) { .lp-nav { padding: 0 1.5rem; } }
@media (min-width: 1024px) { .lp-nav { padding: 0 2rem; } }
@media (min-width: 1280px) { .lp-nav { padding: 0 3rem; } }

/* Logo */
.lp-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  opacity: 1;
  transition: opacity 0.15s;
}
.lp-logo:hover { opacity: 0.75; }

.lp-logo img {
  width: 2rem;
  height: 2rem;
  object-fit: contain;
}
[data-mode='dark'] .lp-logo img { filter: invert(1); }

.lp-logo span {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--lp-text);
}

/* Right side container: always a flex item so nav only has 2 children */
.lp-nav-right {
  display: flex;
  align-items: center;
}

/* Desktop nav */
.lp-desktop-links {
  display: none;
  align-items: center;
  gap: 1.5rem;
}
@media (min-width: 768px) { .lp-desktop-links { display: flex; } }

.lp-nav-link {
  color: var(--lp-text);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: opacity 0.15s;
}
.lp-nav-link:hover { opacity: 0.65; }

.lp-nav-sep {
  display: flex;
  align-items: center;
  height: 1.25rem;
  border-left: 1px solid var(--lp-border);
  border-right: 1px solid var(--lp-border);
  padding: 0 0.75rem;
}

/* GitHub icon link */
.lp-github-link {
  color: var(--lp-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: opacity 0.15s;
}
.lp-github-link:hover { opacity: 0.65; }

/* Mobile actions (github + hamburger, hidden on desktop) */
.lp-mobile-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
@media (min-width: 768px) { .lp-mobile-actions { display: none; } }

/* Hamburger button */
.lp-menu-btn {
  display: flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--lp-text);
  padding: 0.5rem;
}

/* Mobile dropdown menu */
.lp-mobile-menu {
  display: none;
  border-top: 1px solid var(--lp-border);
  padding: 1rem 0;
}
.lp-mobile-menu.open { display: block; }

.lp-mobile-link {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--lp-text);
  text-decoration: none;
  font-size: 0.9375rem;
  transition: opacity 0.15s;
}
.lp-mobile-link:hover { opacity: 0.65; }

/* ===== Main Content ===== */
.lp-main {
  max-width: var(--lp-max-w);
  margin: 0 auto;
  padding: 3rem 1rem;
}
@media (min-width: 640px) { .lp-main { padding: 3rem 1.5rem; } }
@media (min-width: 1024px) { .lp-main { padding: 3rem 2rem; } }
@media (min-width: 1280px) { .lp-main { padding: 3rem 3rem; } }

/* ===== Hero ===== */
.lp-hero {
  position: relative;
  border: 1px solid var(--lp-border);
}

/* Corner cross decorations */
.lp-cross {
  position: absolute;
  z-index: 30;
}
.lp-cross-tl {
  top: -11px;
  left: -11px;
}
.lp-cross-tl .lp-cross-v {
  width: 11px;
  height: 21px;
  border-right: 1px solid var(--lp-border-cross);
}
.lp-cross-tl .lp-cross-h {
  width: 21px;
  height: 11px;
  border-bottom: 1px solid var(--lp-border-cross);
  position: absolute;
  top: 0;
  left: 0;
}

/* Dot pattern background */
.lp-dot-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}
.lp-dot-bg svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: rgba(156, 163, 175, 0.8);
  -webkit-mask-image: radial-gradient(400px circle at center, white, transparent);
  mask-image: radial-gradient(400px circle at center, white, transparent);
}
[data-mode='dark'] .lp-dot-bg svg {
  fill: rgba(75, 85, 99, 0.8);
}

/* Hero content */
.lp-hero-content {
  position: relative;
  z-index: 10;
  padding: 3rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.lp-hero-title {
  font-size: 2.25rem;
  font-weight: 600;
  color: var(--lp-text);
  line-height: 1.2;
}
@media (min-width: 768px) { .lp-hero-title { font-size: 3rem; } }
@media (min-width: 1024px) { .lp-hero-title { font-size: 3.75rem; } }

.lp-hero-tagline {
  font-size: 1rem;
  color: var(--lp-text-muted);
  text-align: center;
  max-width: 28rem;
}
@media (min-width: 768px) { .lp-hero-tagline { font-size: 1.125rem; } }

/* ===== Project Cards Grid ===== */
.lp-cards {
  display: grid;
  grid-template-columns: 1fr;
  border-left: 1px solid var(--lp-border);
  border-bottom: 1px solid var(--lp-border);
}
@media (min-width: 640px) { .lp-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .lp-cards { grid-template-columns: repeat(3, 1fr); } }

.lp-card {
  border-right: 1px solid var(--lp-border);
  border-bottom: 1px solid var(--lp-border);
  padding: 3rem;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--lp-text);
  cursor: pointer;
  transition: background 0.15s;
}
.lp-card:hover { background: var(--lp-card-hover); }

/* Border logic:
   - Grid container provides left + bottom outer borders
   - Each card's border-right = column separator OR right outer border (last col)
   - Each card's border-bottom = row separator (removed on last row, grid border-bottom is outer)
   1-col: last card removes border-bottom
   2-col: 2nd-col cards remove border-right (no outer right); last 2 cards remove border-bottom
   3-col: ALL cards keep border-right (3rd-col cards form the outer right); last 3 remove border-bottom
*/
@media (max-width: 639px) {
  .lp-card:last-child { border-bottom: none; }
}
@media (min-width: 640px) and (max-width: 1023px) {
  .lp-card:nth-child(2n) { border-right: none; }
  .lp-card:nth-last-child(-n+2) { border-bottom: none; }
}
@media (min-width: 1024px) {
  /* 3rd column keeps border-right — it IS the outer right border of the grid */
  .lp-card:nth-last-child(-n+3) { border-bottom: none; }
}

.lp-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 2rem;
}

.lp-card-icon {
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--lp-text);
}
.lp-card-icon img { width: 2rem; height: 2rem; object-fit: contain; }
.lp-card-icon svg { width: 2rem; height: 2rem; }

.lp-card-arrow {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--lp-arrow-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.lp-card-arrow svg { width: 1rem; height: 1rem; color: var(--lp-text); }

.lp-card-title {
  font-weight: 600;
  color: var(--lp-text);
  margin-bottom: 1rem;
  font-size: 1.2rem;
  line-height: 1.75rem;
}
.lp-card-title-first {
  font-size: 1.5rem;
  line-height: 2.5rem;
}
@media (min-width: 768px) {
  .lp-card-title { font-size: 1.2rem; }
  .lp-card-title-first { font-size: 2rem; }
}

.lp-card-desc {
  font-size: 1rem;
  color: var(--lp-text-muted);
  line-height: 1.5;
}

/* ===== CTA Section ===== */
.lp-cta {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  border: 1px dashed var(--lp-border);
  border-top: none;
}
@media (min-width: 640px) { .lp-cta { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .lp-cta { grid-template-columns: 2fr 1fr; } }

/* CTA corner cross decorations */
.lp-cta-cross-tl {
  position: absolute;
  top: -11px;
  left: -11px;
  z-index: 2;
}
.lp-cta-cross-tl .lp-cross-v {
  width: 11px;
  height: 21px;
  border-right: 1px solid var(--lp-border-cross);
}
.lp-cta-cross-tl .lp-cross-h {
  width: 21px;
  height: 11px;
  border-bottom: 1px solid var(--lp-border-cross);
  position: absolute;
  top: 0;
  left: 0;
}

.lp-cta-cross-br {
  position: absolute;
  bottom: -11px;
  right: -11px;
  z-index: 2;
}
.lp-cta-cross-br .lp-cross-v {
  width: 11px;
  height: 21px;
  border-left: 1px solid var(--lp-border-cross);
  position: absolute;
  bottom: 0;
  right: 0;
}
.lp-cta-cross-br .lp-cross-h {
  width: 21px;
  height: 11px;
  border-bottom: 1px solid var(--lp-border-cross);
  position: absolute;
  bottom: 10px;
  right: 0;
}

.lp-cta-text {
  border-right: 1px dashed var(--lp-border);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 639px) {
  .lp-cta-text { border-right: none; border-bottom: 1px dashed var(--lp-border); }
}

.lp-cta-text p {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--lp-cta-text);
  line-height: 1.4;
}
@media (min-width: 768px) { .lp-cta-text p { font-size: 1.5rem; } }
@media (min-width: 1024px) { .lp-cta-text p { font-size: 1.875rem; } }

.lp-cta-globe {
  position: relative;
  min-height: 300px;
  overflow: hidden;
}

.lp-globe-clip {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 200%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  clip-path: inset(0 0 50% 0);
}

.lp-globe-inner {
  width: 100%;
  height: 100%;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lp-globe-canvas {
  width: 100%;
  height: 100%;
  contain: layout style paint;
}

/* ===== Footer ===== */
.lp-footer {
  background: var(--lp-bg);
  border-top: 1px solid var(--lp-border);
  margin-top: 4rem;
}

.lp-footer-inner {
  max-width: var(--lp-max-w);
  margin: 0 auto;
  padding: 3rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
@media (min-width: 640px) {
  .lp-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    padding: 3rem 1.5rem;
  }
}
@media (min-width: 1024px) { .lp-footer-inner { padding: 3rem 2rem; } }
@media (min-width: 1280px) { .lp-footer-inner { padding: 3rem 3rem; } }

.lp-footer-copy {
  font-size: 0.875rem;
  color: var(--lp-footer-text);
  text-align: center;
}
.lp-footer-copy a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}
.lp-footer-copy a:hover { color: var(--lp-text); }

/* Theme toggle button */
.lp-theme-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: none;
  border: 1px solid var(--lp-border);
  border-radius: 0.5rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  color: var(--lp-text-muted);
  font-size: 0.875rem;
  transition: color 0.15s, border-color 0.15s;
}
.lp-theme-btn:hover { color: var(--lp-text); }
.lp-theme-btn svg { width: 1rem; height: 1rem; }
