:root {
  --bg: #0B1620;
  --surface: #101F2B;
  --surface-2: #14293A;
  --line: #1F3A4D;
  --text: #E4ECF0;
  --text-muted: #7C93A0;
  --accent: #2FB6B6;
  --accent-dim: #1D7A7A;
  --amber: #E8A33D;
  --violet: #8C7AE6;
  --danger: #D9614F;
  --font-body: 'Space Grotesk', -apple-system, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
}

.chart-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--line) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--line) 40px);
  opacity: 0.35;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 500; margin: 0 0 0.4em; letter-spacing: -0.01em; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; max-width: 62ch; color: var(--text); }

.section-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  border: 0.5px solid var(--accent-dim);
  padding: 3px 8px;
  border-radius: var(--radius);
  margin-bottom: 0.8em;
}

/* Header */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 48px;
  border-bottom: 0.5px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 0.5px solid var(--accent);
  color: var(--accent);
  padding: 3px 6px;
  border-radius: var(--radius);
}
.brand-name { font-size: 1.05rem; font-weight: 500; }
.brand-dot { color: var(--text-muted); }
.site-nav { display: flex; gap: 28px; font-size: 0.95rem; }
.site-nav a { color: var(--text-muted); }
.site-nav a.active, .site-nav a:hover { color: var(--text); text-decoration: none; }

main { max-width: 1040px; margin: 0 auto; padding: 64px 48px 120px; }

/* Flash messages */
.flash-stack { margin-bottom: 24px; display: flex; flex-direction: column; gap: 8px; }
.flash {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 0.5px solid var(--line);
}
.flash-success { border-color: var(--accent-dim); color: var(--accent); }
.flash-error { border-color: var(--danger); color: var(--danger); }

/* Hero */
.hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  flex-wrap: wrap;
}
.hero { max-width: 600px; flex: 1 1 420px; animation: rise 0.6s ease both; }
.hero-meta { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.tag { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.hero-title { font-size: 3rem; margin-bottom: 4px; animation: rise 0.6s ease 0.05s both; }
.hero-role { font-family: var(--font-mono); color: var(--accent); font-size: 1.05rem; margin-bottom: 20px; animation: rise 0.6s ease 0.1s both; }
.hero-tagline { font-size: 1.15rem; color: var(--text-muted); max-width: 56ch; animation: rise 0.6s ease 0.15s both; }
.hero-actions { display: flex; gap: 14px; margin-top: 28px; animation: rise 0.6s ease 0.2s both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-panel { flex: 0 0 auto; animation: rise 0.6s ease 0.25s both; }
.hero-photo-frame {
  position: relative;
  width: 260px;
  height: 260px;
  padding: 14px;
}
.hero-photo-frame::before, .hero-photo-frame::after {
  content: "";
  position: absolute;
  width: 28px;
  height: 28px;
  border: 2px solid var(--accent);
}
.hero-photo-frame::before { top: 0; left: 0; border-right: none; border-bottom: none; }
.hero-photo-frame::after { bottom: 0; right: 0; border-left: none; border-top: none; }
.hero-photo {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  border: 0.5px solid var(--line);
}
.hero-photo.placeholder {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); color: var(--text-muted);
  font-family: var(--font-mono); font-size: 0.8rem; text-align: center; padding: 20px;
  box-sizing: border-box;
}

.bio-block { margin-top: 56px; padding-top: 32px; border-top: 0.5px solid var(--line); max-width: 68ch; }

@media (max-width: 860px) {
  .hero-row { flex-direction: column-reverse; align-items: flex-start; gap: 32px; }
  .hero-photo-frame { width: 200px; height: 200px; }
}

/* Buttons */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: var(--radius);
  border: 0.5px solid var(--line);
  cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #06201F; font-weight: 500; }
.btn-primary:hover { background: #3ECFCF; }
.btn-ghost { color: var(--text); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

/* Page head */
.page-head { margin-bottom: 48px; position: relative; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; border-left: 0.5px solid var(--line); padding-left: 32px; }
.timeline-item { position: relative; padding-bottom: 40px; }
.timeline-marker {
  position: absolute; left: -37.5px; top: 6px;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--bg); border: 1.5px solid var(--accent);
}
.timeline-body { display: flex; gap: 16px; }
.timeline-logo { width: 44px; height: 44px; object-fit: contain; background: #FFFFFF; border-radius: var(--radius); padding: 6px; }
.timeline-period { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent); }
.timeline-company { color: var(--text-muted); margin: 2px 0 8px; }
.timeline-desc { color: var(--text-muted); font-size: 0.95rem; white-space: pre-line; }

/* Explore cards */
.explore-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 56px;
}
.explore-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  color: var(--text);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.explore-cards a:nth-child(2) { border-top-color: var(--amber); }
.explore-cards a:nth-child(3) { border-top-color: var(--violet); }
.explore-card:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0,0,0,0.3);
}
.explore-icon { font-size: 1.6rem; margin-bottom: 12px; }
.explore-card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.explore-card p { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 14px; flex: 1; }
.explore-link { font-family: var(--font-mono); font-size: 0.82rem; color: var(--accent); }

.group-header { margin-bottom: 20px; }
.group-header h2 { margin-top: 4px; }
.see-all-link { display: inline-block; margin-top: 20px; font-family: var(--font-mono); font-size: 0.88rem; }

@media (max-width: 720px) {
  .explore-cards { grid-template-columns: 1fr; }
}

/* Plaque wall (career journey) */
.plaque-wall { display: flex; flex-direction: column; gap: 18px; }

.plaque {
  position: relative;
  display: grid;
  grid-template-columns: 110px 1fr 110px;
  align-items: center;
  gap: 24px;
  background:
    repeating-linear-gradient(100deg, rgba(255,255,255,0.015) 0px, rgba(255,255,255,0.015) 1px, transparent 1px, transparent 3px),
    linear-gradient(135deg, #17252F 0%, #0D161D 55%, #17252F 100%);
  border: 0.5px solid var(--line);
  border-radius: 6px;
  padding: 22px 30px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
}

.plaque-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(47, 182, 182, 0.35), 0 6px 16px rgba(0,0,0,0.35);
}

.bolt {
  position: absolute;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #8FA0AB, #263340 75%);
  box-shadow: inset 0 0 1px rgba(0,0,0,0.7);
}
.bolt-tl { top: 9px; left: 9px; }
.bolt-tr { top: 9px; right: 9px; }
.bolt-bl { bottom: 9px; left: 9px; }
.bolt-br { bottom: 9px; right: 9px; }

.plaque-date {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent);
  background: rgba(0,0,0,0.25);
  border: 0.5px solid var(--accent-dim);
  border-radius: 3px;
  padding: 10px 6px;
  text-align: center;
  line-height: 1.5;
}

.plaque-body h2 { font-size: 1.08rem; margin-bottom: 3px; }
.plaque-company { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.85rem; margin-bottom: 8px; }
.plaque-desc { font-size: 0.88rem; color: var(--text-muted); white-space: pre-line; margin: 0; max-width: none; }

.plaque-logo { display: flex; align-items: center; justify-content: center; }
.plaque-logo img {
  max-width: 100%; max-height: 60px; object-fit: contain;
  background: #F5F6F7; padding: 8px; border-radius: 3px;
}
.plaque-logo-placeholder {
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted);
  text-align: center; word-break: break-word;
}

.plaque-badge {
  position: absolute; top: -10px; right: 20px;
  background: var(--accent); color: #06201F;
  font-family: var(--font-mono); font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.05em;
  padding: 3px 9px; border-radius: 3px;
  animation: pulse-glow 2.2s ease-in-out infinite;
}

@media (max-width: 720px) {
  .plaque { grid-template-columns: 1fr; text-align: left; gap: 14px; padding: 20px; }
  .plaque-date { text-align: left; display: inline-block; padding: 6px 10px; }
  .plaque-logo { justify-content: flex-start; }
  .plaque-logo img { max-height: 44px; }
}

/* Freelance panel */
.freelance-panel {
  border: 0.5px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 28px 32px;
  margin-bottom: 40px;
}
.freelance-header { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.freelance-header h2 { margin: 0; font-size: 1.25rem; }
.available-badge {
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600;
  color: #2B1D06; background: var(--amber);
  padding: 3px 9px; border-radius: var(--radius);
  animation: pulse-glow-amber 2.2s ease-in-out infinite;
}
@keyframes pulse-glow-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 163, 61, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(232, 163, 61, 0); }
}
.freelance-intro { color: var(--text-muted); margin-bottom: 18px; max-width: 60ch; }
.freelance-roles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.role-chip {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text);
  border: 0.5px solid var(--amber);
  background: rgba(232, 163, 61, 0.08);
  padding: 6px 14px;
  border-radius: 999px;
}

/* Stats strip */
.stats-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 32px;
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 0.5px solid var(--line);
}
.stat { display: flex; flex-direction: column; }
.stat-num { font-family: var(--font-mono); font-size: 2rem; color: var(--accent); line-height: 1; }
.stat-label { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.05em; }

/* Map */
.map-section { margin-bottom: 56px; }
#project-map, #home-map {
  height: 380px;
  width: 100%;
  border-radius: var(--radius);
  border: 0.5px solid var(--line);
  background: var(--surface);
}
#project-map .leaflet-tile-pane, #home-map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.85);
}
#home-map { height: 300px; margin-top: 12px; }
.map-caption { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); margin: 10px 0 0; }

/* Year accordion */
.year-group {
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
  background: var(--surface);
}
.year-group summary {
  cursor: pointer;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  list-style: none;
}
.year-group summary::-webkit-details-marker { display: none; }
.year-group summary::before {
  content: "▸";
  color: var(--accent);
  font-size: 0.8rem;
  transition: transform 0.15s ease;
}
.year-group[open] summary::before { transform: rotate(90deg); }
.year-label { font-family: var(--font-mono); font-size: 1.1rem; color: var(--text); }
.year-count { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }
.year-group > .card-grid { padding: 4px 20px 20px; }

.tag-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--amber);
  border: 0.5px solid rgba(232, 163, 61, 0.4);
  padding: 2px 8px;
  border-radius: var(--radius);
  margin: 0 6px 10px 0;
}

/* Software cards */
.software-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 22px; }
.software-card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.software-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.28); }
.software-visual {
  position: relative;
  height: 160px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 0.5px solid var(--line);
}
.software-visual img { width: 100%; height: 100%; object-fit: contain; padding: 16px; box-sizing: border-box; background: #F5F6F7; }
.software-visual-placeholder { font-size: 2.5rem; color: var(--text-muted); }
.live-badge {
  position: absolute; top: 12px; right: 12px;
  background: var(--accent); color: #06201F;
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 600;
  padding: 3px 9px; border-radius: var(--radius);
  animation: pulse-glow 2.2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 182, 182, 0.5); }
  50% { box-shadow: 0 0 0 5px rgba(47, 182, 182, 0); }
}
.software-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.software-body .btn { align-self: flex-start; margin-top: 4px; }

/* Cards / project grid */
.project-group { margin-bottom: 56px; }
.group-title { font-family: var(--font-mono); font-size: 1rem; color: var(--text-muted); margin-bottom: 20px; text-transform: none; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; }
.card {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,0.28); }
.card-image {
  width: 100%;
  height: 180px;
  object-fit: contain;
  display: block;
  background: #FFFFFF;
  border-bottom: 0.5px solid var(--line);
  padding: 20px;
  box-sizing: border-box;
}
.card-body { padding: 20px; }
.card-text { font-size: 0.92rem; color: var(--text-muted); }
.card-highlight { font-size: 0.88rem; color: var(--amber); font-family: var(--font-mono); }
.card-link { font-family: var(--font-mono); font-size: 0.85rem; }

.data-list { display: flex; flex-direction: column; gap: 4px; margin: 12px 0; }
.data-list div { display: flex; gap: 8px; font-size: 0.85rem; }
.data-list dt { font-family: var(--font-mono); color: var(--text-muted); min-width: 60px; margin: 0; }
.data-list dd { margin: 0; }
.data-list.large { gap: 14px; margin: 24px 0; }
.data-list.large div { font-size: 1.05rem; }
.data-list.large dt { min-width: 90px; }

/* Articles */
.article-list { display: flex; flex-direction: column; }
.article-row {
  display: flex; gap: 20px; padding: 24px 0;
  border-bottom: 0.5px solid var(--line);
  color: var(--text);
}
.article-row:hover { text-decoration: none; }
.article-row:hover h2 { color: var(--accent); }
.article-thumb { width: 96px; height: 72px; object-fit: cover; border-radius: var(--radius); flex-shrink: 0; }
.article-date { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); }
.article-row-text h2 { margin: 4px 0 6px; font-size: 1.15rem; }
.article-row-text p { color: var(--text-muted); font-size: 0.92rem; margin: 0; }

.article-detail { max-width: 68ch; }
.back-link { font-family: var(--font-mono); font-size: 0.85rem; display: inline-block; margin-bottom: 24px; }
.article-cover { width: 100%; border-radius: var(--radius); margin: 24px 0; }
.article-body { font-size: 1.05rem; color: var(--text); }

.empty-state { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.9rem; }

/* Forms */
.form-stack { display: flex; flex-direction: column; gap: 16px; max-width: 560px; }
.form-row { display: flex; gap: 16px; }
.form-row label { flex: 1; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; color: var(--text-muted); font-family: var(--font-mono); }
input, textarea, select {
  font-family: var(--font-body);
  font-size: 0.95rem;
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.checkbox-label {
  flex-direction: row !important;
  align-items: center;
  gap: 10px !important;
  color: var(--text) !important;
  font-family: var(--font-body) !important;
  font-size: 0.92rem !important;
}
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.form-actions { display: flex; gap: 10px; }

/* Admin */
.field-preview {
  display: block;
  max-width: 200px;
  max-height: 120px;
  object-fit: contain;
  background: #FFFFFF;
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
  margin-top: -6px;
}
.admin-login { max-width: 380px; margin: 0 auto; }
.admin-section { margin-bottom: 56px; padding-top: 32px; border-top: 0.5px solid var(--line); }
.admin-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.admin-item {
  background: var(--surface);
  border: 0.5px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.admin-item summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
}
.admin-item form { margin-top: 18px; }
.admin-item-new { border-style: dashed; border-color: var(--accent-dim); }
.admin-item-new summary { color: var(--accent); }

/* Footer */
.site-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 48px; border-top: 0.5px solid var(--line);
  font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted);
}
.coord { letter-spacing: 0.02em; }
.admin-link { color: var(--text-muted); }
.admin-link:hover { color: var(--accent); }

@media (max-width: 720px) {
  .site-header, main, .site-footer { padding-left: 20px; padding-right: 20px; }
  .site-nav { gap: 16px; font-size: 0.85rem; }
  .hero-title { font-size: 2.1rem; }
  .form-row { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
