:root {
  --bg: #050706;
  --surface: rgba(12, 16, 15, 0.88);
  --border: rgba(255, 255, 255, 0.14);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #15803d;
  --accent-glow: rgba(21, 128, 61, 0.25);
}

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

html, body {
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
  z-index: 0;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(95px);
  pointer-events: none;
  z-index: 0;
}

.orb-1 { width: 440px; height: 440px; top: -110px; right: -80px; background: var(--accent-glow); }
.orb-2 { width: 360px; height: 360px; bottom: -110px; left: -80px; background: var(--accent-glow); }

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.brand { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; cursor: pointer; }
.nav-links { display: flex; flex-wrap: wrap; gap: 4px; }

.nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.75rem;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.nav-btn:hover { color: var(--text); background: var(--surface); }
.nav-btn.active { color: #ffffff; background: var(--accent); font-weight: 600; }

.accent-picker { display: flex; gap: 6px; }
.dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--swatch);
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
}

.viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.page {
  display: none;
  width: 100%;
  height: 100%;
  padding: 12px 0;
  flex-direction: column;
  justify-content: center;
}

.page.active { display: flex; }

.eyebrow {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
}

.accent { color: var(--accent); }

.home-layout {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  align-items: center;
  gap: 24px;
  height: 100%;
}

.hero-name { font-size: clamp(2rem, 4.8vw, 4.3rem); font-weight: 800; line-height: 1.05; }

/* Full Uncropped Home Profile Portrait */
.home-photo-frame {
  height: min(56vh, 400px);
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 32px var(--accent-glow);
  display: flex;
  align-items: center;
  justify-content: center;
}

.home-photo-frame img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.page-header { margin-bottom: 10px; }
.page-header.split { display: flex; justify-content: space-between; align-items: flex-end; }
.page-header h2 { font-size: clamp(1.2rem, 2.4vw, 1.8rem); font-weight: 700; }
.hint-text { font-size: 0.74rem; color: var(--muted); }

.card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.info-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; }
.bio-card h3 { font-size: 0.96rem; margin-bottom: 8px; color: var(--accent); }
.bio-card p { color: var(--muted); line-height: 1.5; font-size: 0.84rem; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tags span { font-size: 0.7rem; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text); }

.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.detail-item .label { font-size: 0.62rem; letter-spacing: 0.14em; color: var(--accent); display: block; margin-bottom: 4px; font-weight: 700; }
.detail-item .value { font-size: 0.88rem; font-weight: 600; }
.span-2 { grid-column: span 2; }

/* =========================================================
   PAGE 3: ACHIEVEMENTS (5x2 Filled Certificate Grid)
   ========================================================= */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 10px;
  height: min(60vh, 430px);
}

.gallery-tile {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
}

.gallery-tile:hover { border-color: var(--accent); }
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tile-overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 16px 10px 8px;
  background: linear-gradient(to top, rgba(3, 6, 5, 0.98) 45%, rgba(3, 6, 5, 0.78) 75%, transparent);
}

.tile-overlay small {
  display: block;
  font-size: 0.65rem;
  color: #fde047;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.tile-overlay strong {
  display: block;
  font-size: 0.74rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   PAGE 4: FAMILY & FRIENDS (3-Tier Capsule & Circle Showcase)
   ========================================================= */
#fam-grid {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  grid-template-rows: 1.2fr 1fr 0.95fr;
  gap: 12px;
  height: min(62vh, 450px);
}

#fam-grid .gallery-tile:nth-child(1) { grid-column: 1 / 16; grid-row: 1; border-radius: 999px; }
#fam-grid .gallery-tile:nth-child(2) { grid-column: 16 / 31; grid-row: 1; border-radius: 999px; }

#fam-grid .gallery-tile:nth-child(3) { grid-column: 1 / 11; grid-row: 2; border-radius: 36px 36px 14px 14px; }
#fam-grid .gallery-tile:nth-child(4) { grid-column: 11 / 21; grid-row: 2; border-radius: 36px 36px 14px 14px; }
#fam-grid .gallery-tile:nth-child(5) { grid-column: 21 / 31; grid-row: 2; border-radius: 36px 36px 14px 14px; }

#fam-grid .gallery-tile:nth-child(6)  { grid-column: 1 / 7; grid-row: 3; border-radius: 999px; }
#fam-grid .gallery-tile:nth-child(7)  { grid-column: 7 / 13; grid-row: 3; border-radius: 999px; }
#fam-grid .gallery-tile:nth-child(8)  { grid-column: 13 / 19; grid-row: 3; border-radius: 999px; }
#fam-grid .gallery-tile:nth-child(9)  { grid-column: 19 / 25; grid-row: 3; border-radius: 999px; }
#fam-grid .gallery-tile:nth-child(10) { grid-column: 25 / 31; grid-row: 3; border-radius: 999px; }

#fam-grid .gallery-tile {
  border: 2px solid var(--border);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

#fam-grid .gallery-tile:hover {
  border-color: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}

#fam-grid .tile-overlay {
  text-align: center;
  padding: 6px 14px 8px;
}

/* =========================================================
   POPUP MODAL (FULL UNCROPPED PICTURE WHEN CLICKED)
   ========================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 5, 0.88);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.open { display: flex; }

.modal-box {
  position: relative;
  max-width: 820px;
  width: 100%;
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 20px;
  align-items: center;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-img-wrap {
  width: 100%;
  max-height: 72vh;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #050706;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-img-wrap img {
  width: 100%;
  height: auto;
  max-height: 72vh;
  object-fit: contain;
  display: block;
}

.badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
}

.modal-text h3 { font-size: 1.15rem; margin: 8px 0 6px; }
.meta-where { font-size: 0.82rem; color: var(--muted); margin-bottom: 8px; }
.modal-text .desc { font-size: 0.86rem; line-height: 1.55; color: var(--text); }

.bottombar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.page-nav-btn { background: transparent; border: none; color: var(--muted); font-size: 0.72rem; font-weight: 600; letter-spacing: 0.12em; cursor: pointer; }
.page-nav-btn:hover { color: var(--accent); }
.page-indicator { font-size: 0.75rem; letter-spacing: 0.16em; color: var(--accent); font-weight: 700; }

@media (max-width: 520px) {
  .home-layout, .info-grid, .modal-box { grid-template-columns: 1fr; gap: 10px; }
  .home-photo-frame { height: 170px; }
}
