@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #080B12;
  --bg-panel: #0E131C;
  --bg-panel-raised: #121927;
  --border: #1C2536;
  --border-soft: #161E2C;
  --blue: #3D6FFF;
  --blue-soft: #274B99;
  --blue-glow: rgba(61, 111, 255, 0.35);
  --text: #E7ECF7;
  --text-muted: #7C8AA5;
  --text-dim: #4C5872;

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --header-h: 76px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 15% 0%, rgba(61,111,255,0.10), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(61,111,255,0.06), transparent 40%);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

#bg-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  #bg-field { display: none; }
}

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 64px);
  background: rgba(8, 11, 18, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-slot {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  position: relative;
  flex-shrink: 0;
}

.logo-slot .logo-placeholder {
  width: 100%;
  height: 100%;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
}

.logo-slot img.logo-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.logo-slot .logo-placeholder {
  display: none;
}

.logo-slot.logo-missing img.logo-icon {
  display: none;
}

.logo-slot.logo-missing .logo-placeholder {
  display: flex;
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-name span {
  color: var(--blue);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.main-nav a {
  position: relative;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 9px 16px;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.main-nav a:hover {
  color: var(--text);
  background: var(--bg-panel-raised);
}

.main-nav a.active {
  color: var(--text);
}

.main-nav a.active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 4px;
  height: 2px;
  background: var(--blue);
  border-radius: 2px;
  box-shadow: 0 0 8px var(--blue-glow);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
}

.nav-toggle svg { width: 18px; height: 18px; }

@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .main-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-soft);
    padding: 10px clamp(20px, 5vw, 64px) 18px;
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease;
  }

  .main-nav.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .main-nav a { padding: 12px 14px; }
}

/* ---------- Main / page shell ---------- */

main { flex: 1; }

.stub-page {
  min-height: calc(100vh - var(--header-h) - 140px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  padding: 80px 24px;
}

.stub-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--blue);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stub-page h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 600;
}

.stub-page p {
  color: var(--text-muted);
  max-width: 440px;
  font-size: 15px;
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 64px) clamp(64px, 8vw, 112px);
}

.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue);
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(36px, 5.4vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.hero-text h1 span {
  color: var(--blue);
}

.hero-desc {
  margin-top: 22px;
  color: var(--text-muted);
  font-size: 16px;
  max-width: 460px;
  line-height: 1.65;
}

.hero-actions {
  margin-top: 34px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 0 0 0 var(--blue-glow);
}

.btn-primary:hover {
  background: #4d7bff;
  transform: translateY(-1px);
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover {
  border-color: var(--blue-soft);
  background: var(--bg-panel-raised);
}

/* ----- editor mockup ----- */

.editor {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.6), 0 0 0 1px rgba(61,111,255,0.04);
}

.editor-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-panel-raised);
  border-bottom: 1px solid var(--border-soft);
}

.editor-dots {
  display: flex;
  gap: 6px;
}

.editor-dots span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border);
}

.editor-filename {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-left: 2px;
}

.editor-body {
  display: flex;
  padding: 24px 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.85;
}

.editor-gutter {
  display: flex;
  flex-direction: column;
  padding: 0 16px;
  color: var(--text-dim);
  text-align: right;
  user-select: none;
  border-right: 1px solid var(--border-soft);
  margin-right: 20px;
}

.editor-code {
  color: #C9D4EA;
  white-space: pre-wrap;
  word-break: break-word;
  padding-right: 20px;
  position: relative;
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--blue);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

@media (max-width: 860px) {
  .hero-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .editor-body { font-size: 12px; }
  .editor-gutter { padding: 0 10px; margin-right: 12px; }
}

/* ---------- About page ---------- */

.about {
  padding: clamp(48px, 7vw, 80px) clamp(20px, 5vw, 64px) clamp(64px, 8vw, 112px);
}

.about-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.section-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--blue);
  margin-bottom: 16px;
  letter-spacing: 0.02em;
}

.about-text h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-bottom: 26px;
}

.about-text p {
  color: var(--text-muted);
  font-size: 15.5px;
  line-height: 1.75;
  margin-bottom: 18px;
  max-width: 620px;
}

.about-text p:last-child { margin-bottom: 0; }

.stack-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  position: sticky;
  top: calc(var(--header-h) + 24px);
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.55);
}

.stack-body {
  padding: 22px 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stack-group:not(:last-child) {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
}

.stack-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 11px;
}

.stack-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  padding: 6px 11px;
  border-radius: 7px;
  line-height: 1.2;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.tag:hover {
  border-color: var(--blue-soft);
  color: #fff;
}

@media (max-width: 860px) {
  .about-inner {
    grid-template-columns: 1fr;
  }
  .stack-panel {
    position: static;
  }
}

/* ---------- Projects page ---------- */

.projects {
  padding: clamp(48px, 7vw, 80px) clamp(20px, 5vw, 64px) clamp(64px, 8vw, 112px);
  max-width: 1180px;
  margin: 0 auto;
}

.projects-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(28px, 3.8vw, 40px);
  margin-bottom: 40px;
}

.main-project {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(24px, 4vw, 36px);
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.55);
  position: relative;
  overflow: hidden;
}

.main-project::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, rgba(61,111,255,0.10), transparent 55%);
  pointer-events: none;
}

.main-project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.priority-badge {
  font-family: var(--font-mono);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--blue);
  border: 1px solid var(--blue-soft);
  background: rgba(61,111,255,0.08);
  padding: 6px 12px;
  border-radius: 100px;
}

.progress-percent {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

.main-project-title {
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 600;
  margin-bottom: 18px;
}

.progress-track {
  height: 7px;
  border-radius: 100px;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border-soft);
  overflow: hidden;
  margin-bottom: 22px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue-soft), var(--blue));
  border-radius: 100px;
  transition: width 0.4s ease;
}

.main-project-desc {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
  max-width: 640px;
  margin-bottom: 24px;
}

.secondary-header {
  margin-top: 56px;
  margin-bottom: 22px;
}

.secondary-header h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  color: var(--text);
}

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

.project-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.project-card-head h3 {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
}

.status-badge {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7FE0A8;
  border: 1px solid #285C41;
  background: rgba(127,224,168,0.08);
  padding: 4px 9px;
  border-radius: 100px;
  white-space: nowrap;
}

.project-card p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  flex: 1;
}

.btn-small {
  padding: 9px 16px;
  font-size: 13px;
  align-self: flex-start;
}

.empty-state {
  border: 1px dashed var(--border);
  border-radius: 14px;
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* ---------- Admin page ---------- */

.admin-flag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--blue);
  border: 1px solid var(--blue-soft);
  background: rgba(61,111,255,0.08);
  padding: 5px 10px;
  border-radius: 100px;
}

.admin {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(48px, 7vw, 80px) clamp(20px, 5vw, 64px) clamp(64px, 8vw, 112px);
}

.gate {
  display: flex;
  justify-content: center;
  padding-top: 8vh;
}

.gate-box {
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.gate-box h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 14px;
}

.gate-note {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.6;
  margin-bottom: 26px;
}

.gate-form {
  display: flex;
  gap: 10px;
}

.gate-form input {
  flex: 1;
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
}

.gate-form input:focus {
  outline: none;
  border-color: var(--blue-soft);
}

.gate-error {
  margin-top: 12px;
  font-size: 13px;
  color: #FF7A7A;
  min-height: 1em;
}

.admin-hint {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.65;
  margin-bottom: 36px;
  max-width: 560px;
}

.admin-hint a { color: var(--blue); }

.admin-block {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}

.admin-block h2 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 18px;
}

.admin-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.admin-block-head h2 { margin-bottom: 0; }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
}

.field:last-child { margin-bottom: 0; }

.field span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.field input[type="text"],
.field input[type="password"],
.field textarea {
  background: var(--bg-panel-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
}

.field input[type="text"]:focus,
.field input[type="password"]:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--blue-soft);
}

.field input[type="range"] {
  accent-color: var(--blue);
  width: 100%;
}

.secondary-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 18px;
}

.secondary-row {
  border: 1px solid var(--border-soft);
  background: var(--bg-panel-raised);
  border-radius: 10px;
  padding: 16px;
}

.secondary-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.secondary-row-label {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.row-remove {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}

.row-remove:hover {
  border-color: #7a2f2f;
  color: #FF7A7A;
}

.admin-empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 10px 0;
}

.admin-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.save-status {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: #7FE0A8;
}

/* ---------- Contact page ---------- */

.contact {
  padding: clamp(48px, 7vw, 80px) clamp(20px, 5vw, 64px) clamp(64px, 8vw, 112px);
  max-width: 1180px;
  margin: 0 auto;
}

.contact-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
  margin-top: 40px;
}

.contact-form {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(22px, 3vw, 32px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.55);
}

.contact-form .field {
  margin-bottom: 18px;
}

.contact-form textarea {
  resize: vertical;
}

.form-note {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}

.contact-form .btn {
  align-self: flex-start;
  margin-top: 4px;
  margin-bottom: 10px;
}

.contact-info {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.55);
}

.contact-info-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 10px;
  transition: background 0.2s ease;
}

.contact-row:hover {
  background: var(--bg-panel-raised);
}

.contact-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-panel-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
}

.contact-icon svg { width: 18px; height: 18px; }

.contact-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.contact-label {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.contact-value {
  font-size: 14.5px;
  color: var(--text);
  overflow-wrap: anywhere;
}

@media (max-width: 860px) {
  .contact-inner {
    grid-template-columns: 1fr;
  }
}

/* ----- toast ----- */

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -140%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  background: #0F2A1C;
  border: 1px solid #2C6B47;
  color: #A8F0C4;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 20px 40px -14px rgba(0,0,0,0.5);
  z-index: 200;
  opacity: 0;
  transition: transform 0.35s cubic-bezier(.34,1.4,.64,1), opacity 0.3s ease;
  pointer-events: none;
}

.toast svg {
  width: 18px;
  height: 18px;
  color: #4DDB8A;
  flex-shrink: 0;
}

.toast-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

/* ---------- Footer / legal ---------- */

.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 22px clamp(20px, 5vw, 64px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-dim);
}

.site-footer a {
  color: var(--text-muted);
  font-family: var(--font-mono);
  transition: color 0.2s ease;
}

.site-footer a:hover { color: var(--blue); }
