/* ============================================================
   dipinonline.com — design system
   Dark, security-engineering aesthetic. No external assets.
   ============================================================ */

:root {
  --bg: #05080f;
  --bg-raise: #0b1220;
  --panel: rgba(13, 21, 38, 0.72);
  --panel-border: rgba(96, 165, 250, 0.14);
  --text: #dbe4f3;
  --text-dim: #8b9cb8;
  --accent: #22d3ee;
  --accent-2: #818cf8;
  --accent-soft: rgba(34, 211, 238, 0.12);
  --danger: #f87171;
  --mono: "Cascadia Code", "JetBrains Mono", Consolas, "SF Mono", monospace;
  --sans: "Segoe UI Variable", "Segoe UI", Inter, system-ui, -apple-system, sans-serif;
  --radius: 14px;
  --maxw: 1080px;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
}

::selection { background: rgba(34, 211, 238, 0.3); }

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

/* ---------- animated background canvas ---------- */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  display: block;
}

.bg-vignette {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(129, 140, 248, 0.10), transparent 60%),
    radial-gradient(900px 500px at 10% 110%, rgba(34, 211, 238, 0.08), transparent 60%),
    linear-gradient(180deg, rgba(5, 8, 15, 0.25), rgba(5, 8, 15, 0.7));
}

/* ---------- page transition overlay ---------- */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: linear-gradient(115deg, #060b16 40%, #0b1626 60%, #060b16 80%);
  transform: translateX(-102%);
  will-change: transform;
}
.page-transition::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: -2px;
  width: 3px;
  background: linear-gradient(180deg, transparent, var(--accent), transparent);
  filter: blur(1px);
}
.page-transition.enter { animation: sweep-in 0.42s cubic-bezier(0.7, 0, 0.3, 1) forwards; }
.page-transition.exit  { animation: sweep-out 0.5s cubic-bezier(0.7, 0, 0.3, 1) forwards; }

@keyframes sweep-in  { from { transform: translateX(-102%); } to { transform: translateX(0); } }
@keyframes sweep-out { from { transform: translateX(0); } to { transform: translateX(102%); } }

main { animation: page-enter 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes page-enter {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(6, 10, 20, 0.72);
  border-bottom: 1px solid var(--panel-border);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .prompt { color: var(--accent); }
.brand .cursor {
  display: inline-block;
  width: 0.55em; height: 1.05em;
  background: var(--accent);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.site-nav { display: flex; gap: 0.25rem; }
.site-nav a {
  color: var(--text-dim);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: color 0.2s, background 0.2s;
}
.site-nav a:hover { color: var(--text); background: var(--accent-soft); text-decoration: none; }
.site-nav a.active { color: var(--accent); background: var(--accent-soft); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1.2rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
}

@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: rgba(6, 10, 20, 0.97);
    border-bottom: 1px solid var(--panel-border);
    padding: 0.75rem 1.25rem 1rem;
  }
  .site-nav.open { display: flex; }
}

/* ---------- layout ---------- */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.section { margin-bottom: 4rem; }

.section-title {
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--panel-border), transparent);
}

/* ---------- hero ---------- */
.hero { padding: 5rem 0 4.5rem; }
.hero .kicker {
  font-family: var(--mono);
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(100deg, #f1f6ff 30%, #9fd6e8 70%, var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .typed-line {
  font-family: var(--mono);
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--text-dim);
  margin-top: 1.2rem;
  min-height: 1.8em;
}
.hero .typed-line .typed { color: var(--text); }
.hero .typed-line .caret {
  display: inline-block;
  width: 0.55em; height: 1.15em;
  background: var(--accent);
  vertical-align: text-bottom;
  animation: blink 0.9s steps(1) infinite;
}
.hero p.lede {
  max-width: 640px;
  margin-top: 1.4rem;
  color: var(--text-dim);
  font-size: 1.08rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2.2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.98rem;
  transition: transform 0.18s, box-shadow 0.18s, background 0.18s;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn-primary {
  background: linear-gradient(120deg, var(--accent), #38bdf8);
  color: #04121a;
  box-shadow: 0 8px 26px rgba(34, 211, 238, 0.25);
}
.btn-primary:hover { box-shadow: 0 12px 32px rgba(34, 211, 238, 0.38); }
.btn-ghost {
  border-color: var(--panel-border);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
.btn-ghost:hover { background: var(--accent-soft); border-color: rgba(34, 211, 238, 0.35); }

/* ---------- stat strip ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  backdrop-filter: blur(8px);
}
.stat .num {
  font-family: var(--mono);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
}
.stat .label { color: var(--text-dim); font-size: 0.9rem; margin-top: 0.2rem; }

/* ---------- cards ---------- */
.grid { display: grid; gap: 1.2rem; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }

.card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.6rem;
  backdrop-filter: blur(8px);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, 0.35);
  box-shadow: 0 18px 40px rgba(2, 8, 20, 0.55);
}
.card:hover::before { opacity: 1; }
.card h3 { font-size: 1.15rem; margin-bottom: 0.6rem; }
.card h3 a { color: var(--text); }
.card p { color: var(--text-dim); font-size: 0.97rem; }
.card .card-meta {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.7rem;
  letter-spacing: 0.06em;
}

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(34, 211, 238, 0.2);
  border-radius: 999px;
  padding: 0.15rem 0.65rem;
  margin: 0.15rem 0.25rem 0.15rem 0;
}

/* ---------- skills ---------- */
.skill-group h3 {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  font-family: var(--mono);
}
.skill-group { margin-bottom: 1.4rem; }

/* ---------- timeline ---------- */
.timeline { position: relative; padding-left: 1.8rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(129, 140, 248, 0.4), transparent);
}
.timeline-item { position: relative; padding-bottom: 2.2rem; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.8rem; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.6);
}
.timeline-item .period {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}
.timeline-item h3 { font-size: 1.15rem; margin: 0.25rem 0 0.15rem; }
.timeline-item .org { color: var(--text-dim); font-size: 0.92rem; font-style: italic; }
.timeline-item ul { margin: 0.7rem 0 0 1.1rem; color: var(--text-dim); font-size: 0.95rem; }
.timeline-item li { margin-bottom: 0.35rem; }

/* ---------- blog list ---------- */
.post-list { display: flex; flex-direction: column; gap: 1.2rem; }
.post-item {
  display: block;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 1.5rem 1.7rem;
  transition: transform 0.22s, border-color 0.22s;
  color: var(--text);
}
.post-item:hover {
  text-decoration: none;
  transform: translateX(6px);
  border-color: rgba(34, 211, 238, 0.4);
}
.post-item .post-date {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--accent);
}
.post-item h3 { margin: 0.3rem 0 0.4rem; font-size: 1.25rem; }
.post-item p { color: var(--text-dim); font-size: 0.96rem; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1.6rem; }
.filter-bar button {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 0.3rem 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}
.filter-bar button:hover, .filter-bar button.active {
  color: var(--accent);
  border-color: rgba(34, 211, 238, 0.4);
  background: var(--accent-soft);
}

/* ---------- article ---------- */
.article { max-width: 760px; margin: 0 auto; }
.article-header { margin-bottom: 2.5rem; }
.article-header h1 { font-size: clamp(1.9rem, 4.5vw, 2.7rem); line-height: 1.15; margin: 0.5rem 0 0.8rem; }
.article-header .meta {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--text-dim);
}
.article-body h2 { margin: 2.2rem 0 0.8rem; font-size: 1.5rem; }
.article-body h3 { margin: 1.8rem 0 0.6rem; font-size: 1.2rem; }
.article-body p { margin-bottom: 1.1rem; color: #c5d2e6; }
.article-body ul, .article-body ol { margin: 0 0 1.1rem 1.4rem; color: #c5d2e6; }
.article-body li { margin-bottom: 0.4rem; }
.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.4rem 0 0.4rem 1.1rem;
  margin: 1.4rem 0;
  color: var(--text-dim);
  font-style: italic;
}
.article-body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.15);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}
.article-body pre {
  background: #070d1a;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 1.1rem 1.3rem;
  overflow-x: auto;
  margin: 1.4rem 0;
}
.article-body pre code { background: none; border: none; padding: 0; font-size: 0.85rem; }
.article-body table { border-collapse: collapse; width: 100%; margin: 1.4rem 0; }
.article-body th, .article-body td {
  border: 1px solid var(--panel-border);
  padding: 0.55rem 0.8rem;
  font-size: 0.92rem;
  text-align: left;
}
.article-body th { background: rgba(34, 211, 238, 0.06); }
.back-link { font-family: var(--mono); font-size: 0.85rem; }

/* ---------- contact ---------- */
.contact-panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 2.4rem;
  text-align: center;
  max-width: 620px;
  margin: 0 auto;
}
.contact-email {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 3.5vw, 1.4rem);
  display: inline-block;
  margin: 1.2rem 0 1.6rem;
}

/* ---------- footer ---------- */
.site-footer {
  border-top: 1px solid var(--panel-border);
  padding: 2rem 1.25rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.87rem;
  background: rgba(6, 10, 20, 0.6);
}
.site-footer .foot-links { margin-bottom: 0.6rem; display: flex; justify-content: center; gap: 1.4rem; flex-wrap: wrap; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--accent); }

/* ---------- scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.reveal.visible { opacity: 1; transform: none; }

/* ---------- 404 ---------- */
.notfound { text-align: center; padding: 6rem 1rem; }
.notfound .code {
  font-family: var(--mono);
  font-size: clamp(4rem, 15vw, 8rem);
  font-weight: 800;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(34, 211, 238, 0.4);
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  main, .reveal, .page-transition { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
