/* =========================================
   Smooth UI Theme (Dark-first)
   - Softer slate/indigo palette
   - More flexible spacing + typography
   - Better readability in light mode
   ========================================= */

/* ---------- Tokens ---------- */
:root{
  /* Layout */
  --max: 1040px;
  --radius: 18px;
  --radius-sm: 12px;

  --space-1: 10px;
  --space-2: 14px;
  --space-3: 18px;
  --space-4: 24px;
  --space-5: 32px;

  /* Typography */
  --body: 16px;
  --line: 1.7;
  --h1: clamp(1.75rem, 3vw, 2.5rem);
  --h2: clamp(1.25rem, 2.2vw, 1.7rem);
  --h3: clamp(1.05rem, 2vw, 1.25rem);

  /* Dark palette (smooth) */
  --bg: #0b1220;
  --bg-2: #0a1628;

  --grad-1: rgba(99, 102, 241, 0.14);   /* indigo */
  --grad-2: rgba(56, 189, 248, 0.09);   /* sky */

  --surface: rgba(15, 23, 42, 0.62);    /* slate */
  --surface-2: rgba(30, 41, 59, 0.55);
  --surface-solid: #0f172a;

  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.28);

  --text: #e5e7eb;
  --muted: rgba(226, 232, 240, 0.72);

  --accent: #818cf8;     /* soft indigo */
  --accent-2: #38bdf8;   /* soft sky */
  --link: #a5b4fc;

  --shadow: 0 14px 36px rgba(0,0,0,0.30);
  --shadow-soft: 0 10px 24px rgba(0,0,0,0.22);

  --focus: rgba(129, 140, 248, 0.40);
  --ring: 0 0 0 4px var(--focus);
}

/* Light mode overrides */
body.light{
  --bg: #f8fafc;
  --bg-2: #ffffff;

  --grad-1: rgba(99, 102, 241, 0.08);
  --grad-2: rgba(56, 189, 248, 0.06);

  --surface: rgba(255,255,255,0.92);
  --surface-2: rgba(241,245,249,0.92);
  --surface-solid: #ffffff;

  --border: rgba(15, 23, 42, 0.12);
  --border-strong: rgba(15, 23, 42, 0.18);

  --text: #0f172a;
  --muted: rgba(15, 23, 42, 0.70);

  --accent: #4f46e5;
  --accent-2: #0284c7;
  --link: #4f46e5;

  --shadow: 0 16px 36px rgba(2, 6, 23, 0.10);
  --shadow-soft: 0 10px 24px rgba(2, 6, 23, 0.08);

  --focus: rgba(79, 70, 229, 0.30);
}

/* ---------- Base ---------- */
*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce){
  html{ scroll-behavior: auto; }
  *{ transition: none !important; animation: none !important; }
}

body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-size: var(--body);
  line-height: var(--line);
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 15% 0%, var(--grad-1), transparent 55%),
    radial-gradient(900px 520px at 85% 10%, var(--grad-2), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

/* ---------- Links / Focus ---------- */
a{
  color: var(--link);
  text-decoration: none;
}
a:hover{
  text-decoration: underline;
  text-underline-offset: 6px;
}
a:focus-visible, button:focus-visible{
  outline: none;
  box-shadow: var(--ring);
  border-radius: 12px;
}

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

/* ---------- Header (sticky, flexible) ---------- */
header{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(2,6,23,0.45);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
body.light header{
  background: rgba(255,255,255,0.72);
}

header .container{
  text-align: center;
  padding-top: 18px;
  padding-bottom: 18px;
}

/* Profile image */
.profile-pic{
  width: 112px;
  height: 112px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(129,140,248,0.55);
  box-shadow: var(--shadow-soft);
  transition: transform 180ms ease, border-color 180ms ease;
}
.profile-pic:hover{
  transform: translateY(-1px);
  border-color: rgba(56,189,248,0.80);
}

header h1{
  margin: 12px 0 4px;
  font-size: var(--h1);
  letter-spacing: 0.2px;
}
header h2{
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--muted);
}

/* Nav - more flexible */
nav{
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
nav a{
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 750;
  opacity: 0.92;
  transition: background 180ms ease, border-color 180ms ease, transform 180ms ease;
}
nav a:hover{
  opacity: 1;
  background: rgba(148,163,184,0.10);
  border-color: var(--border);
  text-decoration: none;
  transform: translateY(-1px);
}
nav a.active{
  opacity: 1;
  background: rgba(129,140,248,0.16);
  border-color: rgba(129,140,248,0.32);
}

/* Toggle button */
.dark-toggle{
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(129,140,248,0.35);
  background: rgba(129,140,248,0.14);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}
.dark-toggle:hover{
  transform: translateY(-1px);
  background: rgba(129,140,248,0.20);
  border-color: rgba(56,189,248,0.45);
}

/* ---------- Page hero ---------- */
.page-hero{
  margin: var(--space-3) 0 var(--space-2);
  padding: var(--space-3);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.06);
}

.page-hero h1{
  margin: 0 0 10px;
  font-size: var(--h1);
}
.subtitle{
  margin: 0;
  color: var(--muted);
}

/* ---------- Sections / Headings ---------- */
section{ margin: var(--space-4) 0; }

h2{
  margin: 0 0 12px;
  font-size: var(--h2);
  padding-bottom: 10px;
  border-bottom: 2px solid rgba(129,140,248,0.22);
}
h3{
  margin: 0 0 10px;
  font-size: var(--h3);
  color: rgba(165,180,252,0.95);
}
body.light h3{
  color: rgba(79,70,229,0.92);
}

/* ---------- Cards (flexible, smoother) ---------- */
.card{
  padding: var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.meta{
  margin-top: -6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.96em;
}

.card p{
  margin-top: 0;
  margin-bottom: 12px;
}

ul{
  margin: 10px 0 0;
  padding-left: 1.15rem;
}
li{ margin-bottom: 10px; }

/* Links row */
.links{ margin-top: 12px; color: var(--muted); }
.sep{ margin: 0 8px; opacity: 0.6; }

/* ---------- Footer ---------- */
footer{
  margin-top: var(--space-5);
  border-top: 1px solid var(--border);
  background: rgba(148,163,184,0.06);
}
footer .container{
  padding-top: 18px;
  padding-bottom: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ---------- Back to top (if your JS adds it) ---------- */
#backToTop{
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}
#backToTop.show{
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#backToTop button{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  font-weight: 800;
}

/* ---------- Responsive ---------- */
@media (max-width: 900px){
  .container{ padding: 18px; }
  .card{ padding: 18px; }
  .page-hero{ padding: 18px; }
}

@media (max-width: 540px){
  .profile-pic{ width: 96px; height: 96px; }
  nav{ gap: 8px; }
  nav a{ padding: 8px 10px; }
}
/* =========================
   Header organisation fix
   ========================= */

.header-wrap{
  display: grid;
  gap: 14px;
  align-items: center;
}

.header-top{
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.header-title{
  text-align: left;
}

@media (max-width: 700px){
  .header-top{
    grid-template-columns: 1fr;
    text-align: center;
  }
  .header-title{
    text-align: center;
  }
}

/* Make sure header content is centered within container */
header .container{
  text-align: center; /* keeps nav + button centered */
}

/* Nav pills alignment consistency */
.nav-pills{
  margin-top: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* =========================
   Home page organisation
   ========================= */

.hero-grid{
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 16px;
  align-items: start;
}

.hero-left .subtitle{
  margin-top: 10px;
}

.cta-row{
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  text-decoration: none;
  font-weight: 800;
  color: var(--text);
  background: rgba(148,163,184,0.10);
}

.btn-primary{
  background: rgba(129,140,248,0.16);
  border-color: rgba(129,140,248,0.32);
}

.btn-secondary{
  background: rgba(148,163,184,0.10);
}

/* Featured grid */
.grid-2{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* Tight list */
.tight-list{
  margin: 0;
  padding-left: 1.1rem;
}
.tight-list li{ margin-bottom: 10px; }

/* Responsive home layout */
@media (max-width: 900px){
  .hero-grid{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
}
