:root {
  /* Backgrounds */
  --bg: #181a1b; /* main background */
  --bg-2: #1f2223; /* subtle depth */

  /* Text */
  --text: #e4e6eb; /* primary text */
  --muted: #a1a6ad; /* secondary text */

  /* Lines / borders */
  --line: rgba(255, 255, 255, 0.08);

  /* Accent (modern muted blue-grey) */
  --accent: #8fb3c8;
  --accent-2: #6f9fb8;

  /* UI */
  --chip: rgba(143, 179, 200, 0.14);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* === iOS Safari viewport + background fix === */
html {
  background: var(--bg);
  background-color: var(--bg);
  min-height: 100%;
}

body {
  min-height: 100dvh; /* dynamic viewport (iOS-safe) */
  overflow-x: hidden;
  overflow-y: auto;
  background: none; /* gradient will be painted below */
}

/* Light mode overrides */
body.light {
  --bg: #f4f5f7;
  --bg-2: #e9ebee;

  --text: #1f2933;
  --muted: #4b5563;

  --line: rgba(0, 0, 0, 0.08);

  --accent: #3b82f6;
  --accent-2: #2563eb;

  --chip: rgba(59, 130, 246, 0.14);
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial,
    sans-serif;
  background: radial-gradient(
      900px 500px at 50% 30%,
      rgba(143, 179, 200, 0.06),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  color: var(--text);
}

body,
body * {
  transition: background-color 180ms ease, color 180ms ease,
    border-color 180ms ease;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: transparent;
  backdrop-filter: blur(8px);
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 22px;
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.mark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--accent);
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 0.06em;
}

.mark-brace {
  transform: translateY(-1px);
  opacity: 0.95;
}

.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}

.nav-link {
  text-decoration: none;
  color: rgba(215, 223, 222, 0.82);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.04);
}

.nav-link.is-active {
  color: var(--accent);
  background: var(--chip);
  border-color: rgba(143, 179, 200, 0.35);
  box-shadow: none;
}

/* Focus behaviour */
.nav-link:focus:not(:focus-visible),
.nav-toggle:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
.nav-link:focus-visible,
.nav-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(39, 209, 139, 0.25);
}

/* Mobile toggle */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
}

/* Hamburger lines */
.nav-toggle span {
  display: block;
  height: 2px;
  width: 18px;
  margin: 3px 0;
  background: rgba(215, 223, 222, 0.9);
  border-radius: 999px;
}

/* Light mode: hamburger matches "View Projects" button surface */
body.light .nav-toggle {
  background: rgba(255, 255, 255, 0.65); /* SAME as .btn.ghost */
  border-color: rgba(0, 0, 0, 0.18);
}

body.light .nav-toggle:hover {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.25);
}

/* Keep hamburger lines neutral */
body.light .nav-toggle span {
  background: rgba(31, 41, 55, 0.9);
}

/* Theme toggle */
.theme-toggle {
  width: 44px;
  height: 44px;
  margin-left: 12px;
  border-radius: 12px;

  display: grid;
  place-items: center;

  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  color: var(--text);

  cursor: pointer;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
}

.theme-toggle .icon {
  font-size: 18px;
  line-height: 1;
}

/* Make moon icon monochrome */
.theme-toggle .moon {
  filter: grayscale(100%) brightness(0.9);
}

/* Icon switching */
body:not(.light) .moon {
  display: none;
}

body.light .sun {
  display: none;
}

/* Ensure icon switching applies everywhere (including the mobile clone) */
body:not(.light) .theme-toggle .moon {
  display: none !important;
}

body.light .theme-toggle .sun {
  display: none !important;
}

/* Light mode text overrides */
body.light {
  color-scheme: light;
}

/* Navigation text */
body.light .nav-link {
  color: rgba(31, 41, 55, 0.85);
}

body.light .nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

body.light .nav-link.is-active {
  color: var(--accent);
}

/* Headings */
body.light .hero-name {
  color: #111827;
  text-shadow: none;
}

/* Re-apply accent for the highlighted name in light mode */
body.light .hero-name.accent {
  color: var(--accent);
}

body.light .hero-sub {
  color: #1f2937;
}

/* Body text */
body.light .hero-blurb,
body.light .page-text,
body.light .card p {
  color: var(--muted);
}

/* Card titles */
body.light .card h2,
body.light .page-title {
  color: #111827;
}

/* Social icons (SVGs) */
body.light .social-btn svg {
  fill: rgba(31, 41, 55, 0.9);
}

/* Light mode: improve "Hi, I'm" readability */
body.light .kicker {
  color: #374151;
}

/* Light mode: strengthen outlines for cards & ghost buttons */
body.light .card,
body.light .btn.ghost {
  border-color: rgba(0, 0, 0, 0.14);
  background: rgba(255, 255, 255, 0.65);
}

/* Light mode: mobile menu */
body.light .nav-panel {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(10px);
}

/* Light mode: menu links */
body.light .nav-panel .nav-link {
  color: #1f2937;
}

body.light .nav-panel .nav-link:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* Mobile nav panel (hidden unless .open) */
.nav-panel {
  display: none;
  position: absolute;
  right: 22px;
  top: 74px;

  padding: 12px;
  border-radius: 16px;
  background: rgba(10, 14, 14, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);

  flex-direction: column;
  min-width: 220px;
  gap: 8px;
  z-index: 55;
}
.nav-panel.open {
  display: flex;
}

/* Theme toggle inside mobile dropdown — centered */
.nav-panel .theme-toggle--mobile {
  width: 100%;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px; /* ← ADD THIS */

  margin: 0;
  padding: 0;

  border: none;
  background: transparent;
}

/* Keep icons on one line */
.nav-panel .theme-toggle--mobile .icon {
  display: inline-block;
  line-height: 1;
}

/* Slightly larger text for "Theme" in mobile menu */
.nav-panel .theme-toggle--mobile span:not(.icon) {
  font-size: 15px; /* default nav-link is ~13px */
}

/* Page outlet */
.page {
  height: calc(100vh - 92px);
  display: grid;
  place-items: center;
  padding: 0 22px;
}

/* Hero */
.hero {
  width: 100%;
  display: grid;
  place-items: center;
}
.hero-inner {
  text-align: center;
  max-width: 720px;
  padding-top: 10px;
}
.kicker {
  margin: 0 0 12px;
  font-size: 18px;
  color: rgba(215, 223, 222, 0.9);
}
.hero-title {
  margin: 0 0 12px;
  font-size: clamp(44px, 7vw, 84px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-weight: 900;
}
.hero-name {
  color: #f1f3f5;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.accent {
  color: var(--accent);
}
.hero-sub {
  margin: 0 0 18px;
  font-size: 28px;
  letter-spacing: -0.01em;
  color: rgba(230, 236, 235, 0.92);
}
.hero-blurb {
  margin: 0 auto 26px;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 14px;
}
.hero-cta {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  transition: transform 120ms ease, background 160ms ease,
    border-color 160ms ease;
}
.btn:active {
  transform: translateY(1px);
}
.btn.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: #0f1416;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  border-color: rgba(143, 179, 200, 0.4);
  color: var(--accent);
}

/* Generic page content */
.page-section {
  width: 100%;
  max-width: 960px;
}
.page-title {
  margin: 0 0 14px;
  font-size: 40px;
  letter-spacing: -0.02em;
}
.page-text {
  margin: 0 0 22px;
  max-width: 680px;
  color: var(--muted);
  line-height: 1.7;
}
.link {
  color: var(--accent);
  text-decoration: none;
}
.link:hover {
  text-decoration: underline;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  box-shadow: none;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 16px;
}
.card p {
  margin: 0;
  color: rgba(215, 223, 222, 0.75);
  line-height: 1.6;
}
.card-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Social rail */
.social-rail {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 14px;
  z-index: 60;
}
.social-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.25);
  transition: transform 140ms ease, border-color 160ms ease,
    background 160ms ease;
}
.social-btn:hover {
  transform: translateY(-2px);
  border-color: rgba(39, 209, 139, 0.28);
  background: rgba(39, 209, 139, 0.08);
}
.social-btn svg {
  width: 18px;
  height: 18px;
  fill: rgba(215, 223, 222, 0.9);
}
.social-line {
  width: 2px;
  height: 80px;
  margin: 10px auto 0;
  background: rgba(39, 209, 139, 0.25);
  border-radius: 999px;
}

/* Support chip */
.support-chip {
  position: fixed;
  left: 22px;
  bottom: 22px;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
  color: rgba(230, 236, 235, 0.92);
}
.support-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(39, 209, 139, 0.12);
  color: var(--accent);
  font-size: 18px;
}
.support-text strong {
  display: block;
  font-size: 14px;
  line-height: 1.1;
}
.support-text small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: rgba(215, 223, 222, 0.6);
}

/* Responsive */
@media (max-width: 860px) {
  .nav-desktop {
    display: none;
  }

  .nav-toggle {
    display: inline-flex;
    flex-direction: column; /* IMPORTANT: stacks spans vertically */
    align-items: center;
    justify-content: center;
  }

  .card-grid {
    grid-template-columns: 1fr;
  }

  .social-rail {
    right: 14px;
  }

  .support-chip {
    left: 14px;
    bottom: 14px;
  }
}

@media (max-width: 860px) {
  .nav-wrap > .theme-toggle {
    display: none;
  }
}

/* Emoji optical alignment fix */
.nav-panel .theme-toggle .icon {
  display: block;
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
}

/* Contact form */
.form {
  display: grid;
  gap: 12px;
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-label {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(215, 223, 222, 0.9);
}

body.light .form-label {
  color: #111827;
}

.form-input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  outline: none;
}

.form-input:focus {
  box-shadow: 0 0 0 3px rgba(39, 209, 139, 0.22);
  border-color: rgba(39, 209, 139, 0.35);
}

body.light .form-input {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(0, 0, 0, 0.14);
  color: #111827;
}

/* Prevent focus ring from visually "pushing" the next field */
.form-input:focus {
  position: relative;
  z-index: 2;
}

.form-textarea {
  resize: vertical;
  min-height: 140px;
}

.form-status {
  margin: 10px 0 0;
  color: var(--muted);
  min-height: 1.2em;
}

.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Form input typography only */
input,
textarea,
select {
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.4;
}

/* Keep textarea consistent */
textarea {
  resize: vertical;
}

/* Prevent focus ring from visually "pushing" the next field */
.form-input:focus {
  position: relative;
  z-index: 2;
}

/* Paint background behind everything (prevents white bars on iOS) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
      900px 500px at 50% 30%,
      rgba(143, 179, 200, 0.06),
      transparent 60%
    ),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

html,
body {
  background: var(--bg);
  background-color: var(--bg);
  min-height: 100%;
}

/* Optional but helps prevent odd gaps */
body {
  min-height: 100vh;
}
