/* ============================================================
   Marius Tudor: modern editorial theme (light + dark)
   Rounded, warm, tactile. Display type + film grain + 3D hero.
   ============================================================ */

:root {
  /* warm paper, not sterile white */
  --bg: #f5f2ec;
  --bg-soft: #efeae1;
  --surface: #fffefb;
  --surface-2: #f1ece3;
  --border: #e2dccf;
  --border-strong: #d3cbb9;
  --text: #1c1a17;
  --muted: #6c6459;
  --accent: #0f8f5f;         /* deep emerald */
  --accent-ink: #04160e;
  --accent-2: #1f7a99;
  --accent-soft: rgba(15,143,95,0.10);
  --shadow-sm: 0 1px 2px rgba(28,26,23,0.05);
  --shadow: 0 2px 4px rgba(28,26,23,0.04), 0 12px 34px rgba(28,26,23,0.09);
  --shadow-lg: 0 30px 70px rgba(28,26,23,0.14);
  --radius: 24px;
  --radius-lg: 32px;
  --radius-sm: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --maxw: 960px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e0d;
    --bg-soft: #121514;
    --surface: #161a18;
    --surface-2: #1c211e;
    --border: #262c28;
    --border-strong: #333b36;
    --text: #ece9e2;
    --muted: #9aa39a;
    --accent: #2ee6a0;
    --accent-ink: #052018;
    --accent-2: #45d6f0;
    --accent-soft: rgba(46,230,160,0.12);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow: 0 2px 4px rgba(0,0,0,0.4), 0 14px 40px rgba(0,0,0,0.5);
    --shadow-lg: 0 40px 90px rgba(0,0,0,0.6);
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* organic ambient wash: soft, off-centre, not the generic centred blob */
body::before {
  content: "";
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 620px;
  background:
    radial-gradient(48% 60% at 78% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(40% 55% at 12% 12%, color-mix(in srgb, var(--accent-2) 9%, transparent), transparent 72%);
  pointer-events: none;
  z-index: 0;
  filter: blur(4px);
}

/* film grain: the premium, not-flat, not-AI texture */
.grain {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.035;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { .grain { mix-blend-mode: screen; opacity: 0.05; } }

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

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 14px;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  max-width: var(--maxw);
  margin: 14px auto 0;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.nav-brand { font-family: var(--display); font-weight: 700; color: var(--text); letter-spacing: -0.02em; font-size: 1.05rem; }
.nav-dot { color: var(--accent); }
.nav-links { display: flex; gap: 6px; font-size: 0.92rem; }
.nav-links a {
  color: var(--muted); padding: 6px 12px; border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}
.nav-links a:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.nav-links a.active { color: var(--accent-ink); background: var(--accent); }
@media (prefers-color-scheme: dark) { .nav-links a.active { color: var(--accent-ink); } }

/* ---------- Layout ---------- */
.main {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px 22px 24px;
}
.section { margin: 68px 0; }
.section-title {
  font-family: var(--mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  margin: 0 0 20px;
  font-weight: 500;
  display: flex; align-items: center; gap: 12px;
}
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* scroll reveal */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.25fr 0.85fr;
  align-items: center;
  gap: 32px;
  padding: 34px 0 20px;
}
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0 0 16px;
  display: inline-flex; align-items: center; gap: 9px;
}
.ping { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); position: relative; box-shadow: 0 0 0 0 var(--accent); }
.ping::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--accent); animation: ping 2s cubic-bezier(0,0,.2,1) infinite; }
@keyframes ping { 0% { transform: scale(1); opacity: .6; } 80%,100% { transform: scale(2.6); opacity: 0; } }

.hero-name {
  font-family: var(--display);
  font-size: clamp(2.7rem, 8vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
  margin: 0 0 12px;
  font-weight: 800;
}
.hero-title { font-size: 1.12rem; color: var(--text); margin: 0 0 14px; font-weight: 500; }
.hero-tagline { font-family: var(--mono); font-size: 0.92rem; color: var(--muted); margin: 0 0 22px; min-height: 1.4em; }
.prompt { color: var(--accent); font-weight: 500; }
.caret { color: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-bio { font-size: 1.06rem; max-width: 54ch; color: var(--text); margin: 0 0 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 3D object */
.hero-3d { position: relative; aspect-ratio: 1; width: 100%; display: grid; place-items: center; }
.hero-3d-ring {
  position: absolute; inset: 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 62%);
  border: 1px dashed color-mix(in srgb, var(--accent) 30%, transparent);
  animation: spin 40s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#hero-canvas { position: relative; width: 100%; height: 100%; z-index: 1; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 8px; }
  .hero-3d { order: -1; max-width: 260px; margin: 0 auto 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .hero-3d-ring, .ping::after { animation: none; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center;
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem; font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn-primary:hover { filter: brightness(1.04); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-lg); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-head h3 { font-family: var(--display); margin: 0; font-size: 1.24rem; letter-spacing: -0.02em; font-weight: 700; }
.card-tag { font-family: var(--mono); font-size: 0.75rem; color: var(--accent); margin: 5px 0 14px; letter-spacing: 0.02em; }
.card p { margin: 0 0 12px; color: var(--text); }
.highlight { color: var(--muted); font-size: 0.92rem; }

.pill {
  font-family: var(--mono); font-size: 0.7rem;
  color: var(--muted); white-space: nowrap;
  padding: 4px 11px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2);
}

/* flagship stack */
.flagship .stack-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 9px; }
.flagship .stack-list li {
  display: grid; grid-template-columns: 104px 1fr auto; align-items: center; gap: 12px;
  font-size: 0.9rem; padding: 11px 15px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.stack-lang { font-family: var(--mono); font-weight: 500; }
.stack-role { color: var(--muted); }
.status {
  font-family: var(--mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 9px; border-radius: 999px;
}
.status-building { color: var(--accent); background: var(--accent-soft); }
.status-planned { color: var(--muted); background: var(--surface); border: 1px solid var(--border); }
@media (max-width: 480px) { .flagship .stack-list li { grid-template-columns: 1fr auto; } .stack-role { grid-column: 1 / -1; } }

/* ---------- Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }
.skill-group h4 { font-family: var(--mono); margin: 0 0 12px; font-size: 0.78rem; color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-size: 0.82rem;
  padding: 5px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, border-color .12s ease;
}
.chip:hover { transform: translateY(-1px); border-color: var(--accent); }
.chip-sm { font-size: 0.72rem; padding: 4px 9px; color: var(--muted); box-shadow: none; }
.chip-sm:hover { transform: none; }

/* ---------- Projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 18px; }

/* ---------- Timeline ---------- */
.timeline { display: grid; gap: 4px; border-left: 2px solid var(--border); padding-left: 24px; margin-left: 6px; }
.timeline-item { position: relative; padding: 14px 0; }
.timeline-item::before {
  content: ""; position: absolute; left: -31px; top: 20px;
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 5px var(--bg);
}
.timeline-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.timeline-head h3 { font-family: var(--display); margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.timeline-org { color: var(--muted); font-size: 0.9rem; margin: 3px 0 8px; }
.timeline-grade {
  display: inline-block; margin: 0 0 10px;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 500;
  color: var(--accent); background: var(--accent-soft);
  padding: 3px 11px; border-radius: 999px;
}
.timeline-item ul { margin: 0; padding-left: 18px; color: var(--text); }
.timeline-item li { margin: 5px 0; }

/* ---------- Leadership ---------- */
.leadership-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.lead-item {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px 18px; background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform .14s ease, border-color .14s ease;
}
.lead-item:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.lead-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.lead-head h3 { font-family: var(--display); margin: 0; font-size: 1.02rem; font-weight: 700; letter-spacing: -0.01em; }
.lead-org { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

/* ---------- Two column ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 44px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; gap: 28px; } }
.tick-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.tick-list li { position: relative; padding-left: 24px; font-size: 0.95rem; }
.tick-list li::before { content: "▹"; position: absolute; left: 0; color: var(--accent); }
.muted { color: var(--muted); }

/* ---------- Blog list ---------- */
.page-head { margin: 12px 0 30px; }
.page-head h1 { font-family: var(--display); font-size: clamp(2.1rem, 6vw, 3rem); margin: 0 0 8px; letter-spacing: -0.03em; font-weight: 800; }

.blog-controls {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; margin-bottom: 28px;
}
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter {
  font-family: inherit; font-size: 0.88rem; cursor: pointer;
  padding: 8px 15px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  box-shadow: var(--shadow-sm);
  transition: all .14s ease;
}
.filter:hover { color: var(--text); border-color: var(--accent); transform: translateY(-1px); }
.filter.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.filter .count { opacity: 0.7; font-size: 0.78rem; margin-left: 4px; }

.search-wrap { flex: 1; min-width: 200px; max-width: 300px; }
#search {
  width: 100%; font-family: inherit; font-size: 0.92rem;
  padding: 10px 16px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
}
#search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }

.post-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.post-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.post-card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); box-shadow: var(--shadow-lg); }
.post-card-link { display: block; padding: 22px 24px; color: inherit; }
.post-card-link:hover { text-decoration: none; }
.post-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.post-card-top time { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.post-card h3 { font-family: var(--display); margin: 0 0 7px; font-size: 1.28rem; letter-spacing: -0.02em; font-weight: 700; }
.post-card-excerpt { color: var(--muted); margin: 0 0 14px; font-size: 0.95rem; }

.badge {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-web-exploitation { color: var(--accent); background: var(--accent-soft); }
.badge-htb-writeups { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 14%, transparent); }
.badge-ai-security { color: #7c5cff; background: color-mix(in srgb, #7c5cff 13%, transparent); }
@media (prefers-color-scheme: dark) { .badge-ai-security { color: #b3a1ff; background: color-mix(in srgb, #b3a1ff 15%, transparent); } }

.empty { color: var(--muted); text-align: center; padding: 44px 0; }

/* ---------- Post ---------- */
.post { max-width: 720px; margin: 0 auto; }
.post-back a { font-family: var(--mono); font-size: 0.83rem; color: var(--muted); }
.post-back a:hover { color: var(--accent); text-decoration: none; }
.post-meta-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 20px 0 12px; font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }
.post h1 { font-family: var(--display); font-size: clamp(1.9rem, 5vw, 2.6rem); line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 14px; font-weight: 800; }
.post-tags { margin-bottom: 30px; }
.post-back-bottom { margin-top: 52px; padding-top: 22px; border-top: 1px solid var(--border); }

.post-body { font-size: 1.04rem; }
.post-body h2 { font-family: var(--display); font-size: 1.5rem; margin: 40px 0 14px; letter-spacing: -0.02em; font-weight: 700; }
.post-body h3 { font-family: var(--display); font-size: 1.2rem; margin: 28px 0 10px; font-weight: 700; }
.post-body p { margin: 0 0 16px; }
.post-body img { max-width: 100%; border-radius: var(--radius-sm); }
.post-body a { text-decoration: underline; text-underline-offset: 2px; }
.post-body ul, .post-body ol { padding-left: 22px; margin: 0 0 16px; }
.post-body li { margin: 6px 0; }
.post-body code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 1px 6px; border-radius: 6px;
}
.post-body pre {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 18px; overflow-x: auto; margin: 0 0 18px;
}
.post-body pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }
.post-body blockquote {
  margin: 0 0 18px; padding: 4px 18px;
  border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text);
}
.post-body table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 0.92rem; }
.post-body th, .post-body td { border: 1px solid var(--border); padding: 9px 13px; text-align: left; }
.post-body th { background: var(--surface-2); }

/* ---------- Footer ---------- */
.footer {
  position: relative; z-index: 1;
  max-width: var(--maxw); margin: 48px auto 0; padding: 26px 22px 44px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 0.85rem; color: var(--muted);
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); text-decoration: none; }
