/* ============================================================
   maslanka.dev — Design System & Styles
   Security by design: no external resources loaded from CSS
   ============================================================ */

/* ── CSS Custom Properties ── */
:root {
  /* Dark theme (default) */
  --bg-base:        #0f0f13;
  --bg-surface:     #16161d;
  --bg-elevated:    #1e1e28;
  --bg-hover:       #252533;
  --border:         rgba(255, 255, 255, 0.08);
  --border-strong:  rgba(255, 255, 255, 0.15);

  --text-primary:   #f0f0f5;
  --text-secondary: #9898b0;
  --text-muted:     #5e5e78;

  --accent:         #7c6cf5;
  --accent-soft:    rgba(124, 108, 245, 0.15);
  --accent-glow:    rgba(124, 108, 245, 0.35);
  --accent-alt:     #5de6d0;

  --success:        #4ade80;
  --warning:        #fbbf24;
  --danger:         #f87171;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);

  --font-sans:  'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --nav-h: 64px;

  --transition: 0.2s ease;
  --transition-slow: 0.4s ease;
}

[data-theme="light"] {
  --bg-base:        #f8f8fc;
  --bg-surface:     #ffffff;
  --bg-elevated:    #f0f0f8;
  --bg-hover:       #e8e8f2;
  --border:         rgba(0, 0, 0, 0.08);
  --border-strong:  rgba(0, 0, 0, 0.14);

  --text-primary:   #111118;
  --text-secondary: #4a4a62;
  --text-muted:     #8888a0;

  --accent:         #5b4fd8;
  --accent-soft:    rgba(91, 79, 216, 0.1);
  --accent-glow:    rgba(91, 79, 216, 0.2);
  --accent-alt:     #0fa896;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.12);
}

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-primary);
  background: var(--bg-base);
  transition: background var(--transition-slow), color var(--transition-slow);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 9999;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus { top: 0; }

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ── Container ── */
.container {
  width: min(1100px, 100% - 2rem);
  margin-inline: auto;
}

/* ── Section typography ── */
.section-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.section-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 3rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}
.btn--primary:hover {
  background: color-mix(in srgb, var(--accent) 85%, white);
  transform: translateY(-2px);
  box-shadow: 0 4px 24px var(--accent-glow);
}

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  position: fixed;
  inset-block-start: 0;
  inset-inline: 0;
  height: var(--nav-h);
  z-index: 100;
  background: color-mix(in srgb, var(--bg-base) 85%, transparent);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-slow);
}

.navbar__inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2rem;
  width: min(1200px, 100% - 2rem);
  margin-inline: auto;
}

.navbar__logo {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.logo-accent { color: var(--accent); }

.navbar__nav { flex: 1; }

.nav-list {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-list a {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}
.nav-list a:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-list a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.navbar__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Language toggle */
.lang-toggle {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.lang-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.lang-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

[data-theme="dark"] .icon-moon  { display: none; }
[data-theme="dark"] .icon-sun   { display: block; }
[data-theme="light"] .icon-sun  { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* Hamburger */
.menu-toggle {
  display: none;
  width: 36px;
  height: 36px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}
.menu-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-block: calc(var(--nav-h) + 4rem) 5rem;
  overflow: hidden;
}

.hero__bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Subtle grid */
.grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 0%, transparent 70%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.35;
}
.glow--1 {
  width: 500px;
  height: 500px;
  background: var(--accent);
  top: -100px;
  right: -100px;
}
.glow--2 {
  width: 400px;
  height: 400px;
  background: var(--accent-alt);
  bottom: 0;
  left: -150px;
  opacity: 0.2;
}

.hero__content {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
  flex: 1;
}

.hero__greeting {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 0.5rem;
}

.hero__name {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.05;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--text-primary) 40%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero__tagline {
  font-size: 1rem;
  font-weight: 500;
  color: var(--accent-alt);
  font-family: var(--font-mono);
  margin-bottom: 1.25rem;
}

.hero__bio {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 48ch;
  margin-bottom: 2rem;
  line-height: 1.75;
}

.hero__cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Terminal widget */
.terminal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.terminal__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}
.dot--red    { background: #ff5f56; }
.dot--yellow { background: #ffbd2e; }
.dot--green  { background: #27c93f; }

.terminal__title {
  margin-left: auto;
  margin-right: auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.terminal__body {
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.terminal__line {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  color: var(--text-primary);
  line-height: 1.6;
}

.term-prompt {
  color: var(--accent);
  font-weight: 700;
  user-select: none;
}

.term-cmd { color: var(--text-primary); }

.term-output {
  padding-left: 1.8rem;
  color: var(--accent-alt);
}

.term-cursor {
  animation: blink 1s step-end infinite;
  color: var(--accent);
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Scroll indicator */
.hero__scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
}
.scroll-indicator {
  display: block;
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  border-radius: 2px;
  animation: scrollPulse 1.8s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills {
  padding-block: 6rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.skills__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}

.skill-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent-soft) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--transition);
}

.skill-card:hover {
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md), 0 0 0 1px var(--accent-soft);
}
.skill-card:hover::before { opacity: 1; }

.skill-card__icon {
  width: 52px;
  height: 52px;
  background: var(--accent-soft);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 1.25rem;
  position: relative;
}

.skill-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-primary);
  position: relative;
}

.skill-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.25rem;
  position: relative;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  position: relative;
}

.skill-tags li {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.skill-card:hover .skill-tags li {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ============================================================
   BLOG
   ============================================================ */
.blog {
  padding-block: 6rem;
}

.blog__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

.blog-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.blog-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.blog-card__meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.blog-card__date {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.blog-card__tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  font-family: var(--font-mono);
}

.blog-card__title {
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-primary);
}

.blog-card__excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
}

.blog-card__more {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.75;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  animation: fadeIn 0.3s ease;
}
.blog-card__more p { margin: 0; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.blog-card__toggle {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  background: var(--accent-soft);
  transition: all var(--transition);
}
.blog-card__toggle:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.blog-card__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact {
  padding-block: 6rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
}

.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: start;
}

.contact__links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.95rem;
  transition: all var(--transition);
}

.contact-item:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  background: var(--accent-soft);
  transform: translateX(4px);
}
.contact-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.contact-item svg { color: var(--accent); flex-shrink: 0; }

/* PGP block */
.pgp-block {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
}

.pgp-block__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.pgp-block__fingerprint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pgp-block__fingerprint code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-alt);
  word-break: break-all;
}

.pgp-details summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
  padding: 0.5rem 0;
  border-radius: var(--radius-sm);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: color var(--transition);
}
.pgp-details summary::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform var(--transition);
}
.pgp-details[open] summary::before {
  transform: rotate(90deg);
}
.pgp-details summary::-webkit-details-marker { display: none; }
.pgp-details summary:hover { color: var(--text-primary); }

.pgp-key {
  margin-top: 0.75rem;
  padding: 1rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--accent-alt);
  white-space: pre;
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem;
  background: var(--bg-base);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer__copy {
  font-size: 0.875rem;
  color: var(--text-muted);
}
.footer__sep { color: var(--border-strong); }

.footer__tech {
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .hero__content {
    grid-template-columns: 1fr;
    gap: 3rem;
  }
  .hero__visual { order: -1; }

  .contact__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .navbar__nav {
    display: none;
    position: fixed;
    inset: var(--nav-h) 0 0 0;
    background: var(--bg-base);
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    z-index: 99;
    overflow-y: auto;
  }
  .navbar__nav.open { display: block; }

  .nav-list {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
  }

  .nav-list a {
    padding: 0.75rem 1rem;
    font-size: 1rem;
  }

  .menu-toggle { display: flex; }

  .hero {
    padding-block: calc(var(--nav-h) + 2.5rem) 4rem;
  }

  .hero__cta { flex-direction: column; }
  .hero__cta .btn { justify-content: center; }

  .skills__grid,
  .blog__grid {
    grid-template-columns: 1fr;
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 400px) {
  .hero__name {
    font-size: 2rem;
  }
  .terminal {
    font-size: 0.78rem;
  }
}

/* ============================================================
   FOCUS / MOTION PREFERENCES
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
