:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface2: #22263a;
    --border: #2e3348;
    --accent: #7c6af7;
    --accent2: #4fa3e0;
    --green: #3dd68c;
    --red: #f97b7b;
    --yellow: #f5c542;
    --text: #e2e6f3;
    --muted: #7a82a6;
    --code-bg: #141720;
    --font: 'Inter', system-ui, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', monospace;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.7;
  }

  .container {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 0;
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(15, 17, 23, 0.92);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(14px);
  }

  .site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    min-height: 80px;
  }

  .brand {
    font-size: 1rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: flex-end;
  }

  .nav a {
    color: var(--muted);
    padding: 0.65rem 0.95rem;
    border-radius: 10px;
    transition: background 0.18s ease, color 0.18s ease;
  }

  .nav a:hover,
  .nav a.active {
    background: rgba(79, 163, 224, 0.12);
    color: var(--text);
  }

  main {
    padding: 2.5rem 0 4rem;
  }

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

  /* -- Typography -- */
  h1 { font-size: 2rem; font-weight: 700; margin-bottom: 0.5rem; color: var(--text); }
  h2 { font-size: 1.35rem; font-weight: 600; margin: 3rem 0 1rem; color: var(--text); padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
  h3 { font-size: 1.05rem; font-weight: 600; margin: 2rem 0 0.75rem; color: var(--accent2); }
  h4 { font-size: 0.95rem; font-weight: 600; margin: 1.5rem 0 0.5rem; color: var(--text); }
  p { margin-bottom: 1rem; color: var(--text); }

  .subtitle { color: var(--muted); font-size: 1rem; margin-bottom: 2rem; }
  .meta { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
  .meta-item { font-size: 0.8rem; color: var(--muted); }
  .meta-item strong { color: var(--text); }

  /* -- Code -- */
  pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1rem 0 1.5rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 1.6;
  }

  code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--code-bg);
    border: 1px solid var(--border);
    padding: 0.15em 0.4em;
    border-radius: 4px;
    color: #c9d1f5;
  }

  pre code { background: none; border: none; padding: 0; font-size: inherit; }

  .kw  { color: #c792ea; }
  .fn  { color: #82aaff; }
  .str { color: #c3e88d; }
  .cm  { color: #546e7a; font-style: italic; }
  .num { color: #f78c6c; }
  .ty  { color: #ffcb6b; }

  /* -- Callouts -- */
  .callout {
    border-radius: 8px;
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    border-left: 3px solid;
    font-size: 0.9rem;
  }
  .callout.info    { background: #1a2a3a; border-color: var(--accent2); }
  .callout.warn    { background: #2a2314; border-color: var(--yellow); }
  .callout.success { background: #132a1f; border-color: var(--green); }
  .callout.danger  { background: #2a1414; border-color: var(--red); }
  .callout-title   { font-weight: 600; margin-bottom: 0.35rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; }
  .callout.info .callout-title    { color: var(--accent2); }
  .callout.warn .callout-title    { color: var(--yellow); }
  .callout.success .callout-title { color: var(--green); }
  .callout.danger .callout-title  { color: var(--red); }

  /* -- Tables -- */
  table { width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem; font-size: 0.875rem; }
  th { background: var(--surface2); text-align: left; padding: 0.6rem 1rem; color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; border-bottom: 1px solid var(--border); }
  td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); vertical-align: top; }
  tr:last-child td { border-bottom: none; }

  /* -- Endpoint cards -- */
  .endpoint {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    overflow: hidden;
  }
  .endpoint-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
  }
  .method {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 52px;
    text-align: center;
  }
  .method.get    { background: #1a3a2a; color: var(--green); }
  .method.post   { background: #1e2a4a; color: #82aaff; }
  .method.put    { background: #2e2a14; color: var(--yellow); }
  .method.delete { background: #2a1414; color: var(--red); }
  .path { font-family: var(--mono); font-size: 0.875rem; color: var(--text); flex: 1; }
  .auth-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--surface2);
    color: var(--muted);
    white-space: nowrap;
  }
  .auth-badge.required { background: #2a1f3a; color: #c792ea; }
  .auth-badge.admin    { background: #2a1414; color: var(--red); }
  .endpoint-body { padding: 0 1rem 1rem; border-top: 1px solid var(--border); font-size: 0.875rem; color: var(--muted); }

  /* -- Architecture diagram -- */
  .arch {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
    margin: 1.5rem 0;
    text-align: center;
    font-family: var(--mono);
    font-size: 0.8rem;
    line-height: 2;
    color: var(--muted);
  }
  .arch .layer {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin: 0.25rem 0;
  }
  .arch .box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.4rem 1rem;
    color: var(--text);
  }
  .arch .box.accent { border-color: var(--accent); color: var(--accent); }
  .arch .box.green  { border-color: var(--green);  color: var(--green);  }
  .arch .box.blue   { border-color: var(--accent2); color: var(--accent2); }
  .arch .arrow { color: var(--border); font-size: 1.2rem; line-height: 1; }

  /* -- Threat table badges -- */
  .risk { display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0.15rem 0.5rem; border-radius: 4px; text-transform: uppercase; }
  .risk.high   { background: #3a1414; color: var(--red); }
  .risk.medium { background: #2a2014; color: var(--yellow); }
  .risk.low    { background: #132a1f; color: var(--green); }

  /* -- Hero header -- */
  .hero {
    background: linear-gradient(135deg, #1a1d27 0%, #1e1a3a 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2.5rem;
    margin-bottom: 2.5rem;
  }

  .hero .container {
    max-width: 760px;
  }

  .hero-title {
    font-size: clamp(2.2rem, 4.5vw, 4rem);
    margin: 0 0 1rem;
    line-height: 1.08;
    color: var(--text);
  }

  .hero-sub {
    color: var(--muted);
    font-size: 1.05rem;
    margin: 0 0 1.8rem;
    max-width: 46rem;
  }

  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.95rem 1.75rem;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: var(--bg);
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 18px 36px rgba(76, 110, 255, 0.18);
    transition: transform 0.22s ease, filter 0.22s ease;
  }

  .btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
  }

  .section {
    padding: 2.75rem 0;
  }

  .section-title {
    margin: 0 0 1.5rem;
    font-size: 1.1rem;
    color: var(--text);
  }

  .projects {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
  }

  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.14);
  }

  .card h4 {
    margin-top: 0;
    margin-bottom: 0.85rem;
  }

  .card p {
    color: var(--muted);
    margin: 0;
  }

  .timeline-list {
    display: grid;
    gap: 1rem;
  }

  .timeline-item {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .timeline-dot {
    width: 0.8rem;
    height: 0.8rem;
    border-radius: 50%;
    margin-top: 0.45rem;
    background: var(--accent);
    box-shadow: 0 0 18px rgba(124, 106, 247, 0.28);
  }

  .timeline-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.55rem;
  }

  .timeline-card h4 {
    margin-top: 0;
    margin-bottom: 0.65rem;
  }

  .timeline-card .meta {
    margin: 0 0 1rem;
    color: var(--muted);
    font-size: 0.92rem;
  }

  .read-more {
    color: var(--accent2);
    text-decoration: none;
    font-weight: 600;
  }

  .contact-form {
    display: grid;
    gap: 1rem;
    max-width: 680px;
  }

  .contact-form label {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
  }

  .contact-form input,
  .contact-form textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    background: var(--surface);
    color: var(--text);
  }

  .contact-form input::placeholder,
  .contact-form textarea::placeholder {
    color: rgba(226, 230, 243, 0.55);
  }

  .contact-form input:focus,
  .contact-form textarea:focus {
    outline: none;
    border-color: rgba(79, 163, 224, 0.6);
    box-shadow: 0 0 0 3px rgba(79, 163, 224, 0.12);
  }

  .form-message {
    color: var(--text);
    min-height: 1.2rem;
  }

  .site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--muted);
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
  }

  .footer-links a {
    color: var(--accent2);
  }

  .footer-links a:hover {
    text-decoration: underline;
  }

  @media (max-width: 860px) {
    .site-header .container {
      justify-content: center;
    }
    .nav {
      justify-content: center;
    }
    main {
      padding: 2rem 0 4rem;
    }
  }

  @media (max-width: 640px) {
    .hero {
      padding: 2rem 1.5rem;
    }
    .section {
      padding: 2rem 0;
    }
    .projects {
      grid-template-columns: 1fr;
    }
    .timeline-item {
      grid-template-columns: 1fr;
    }
    nav {
      width: 100%;
    }
  }

  .tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.5rem; }
  .tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--muted);
  }

  /* -- Section -- */
  section { margin-bottom: 1rem; }
  .anchor { display: block; position: relative; top: -80px; visibility: hidden; }
