/* Core Variables */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, sans-serif;
  --font-mono: "SF Mono", Monaco, Consolas, monospace;

  --bg-primary: #f5f5f7;
  --bg-surface: rgba(255, 255, 255, 0.72);
  --bg-card: rgba(255, 255, 255, 0.85);

  --text-main: #1d1d1f;
  --text-muted: #86868b;

  --accent: #0066cc;
  --accent-hover: #0077ed;

  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-glass: rgba(255, 255, 255, 0.4);

  --blur: blur(20px) saturate(180%);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);

  --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #000000;
    --bg-surface: rgba(28, 28, 30, 0.72);
    --bg-card: rgba(44, 44, 46, 0.85);

    --text-main: #f5f5f7;
    --text-muted: #86868b;

    --accent: #2997ff;
    --accent-hover: #47a3ff;

    --border-subtle: rgba(255, 255, 255, 0.12);
    --border-glass: rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

/* Base resets & typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 100%;
  line-height: 1.47;
  font-weight: 400;
  letter-spacing: -0.022em;
  background-color: var(--bg-primary);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Headings with optical tracking */
h1, h2, h3, h4 {
  font-weight: 600;
  color: var(--text-main);
}

p {
      line-height: 1.6;
}

ul li {
  margin-bottom: 8px;
}

.terminal-section {
    position: relative;
    max-width: 850px;
    margin: 3rem auto;
}

.terminal-section .layered-img {
    position: absolute;
    top: 370px;
    right: -140px;
    width: 480px;
    height: auto;
    z-index: 10;
    pointer-events: none;
}

.terminal-section .terminal-card {
    position: relative;
    z-index: 1;
}

.terminal-section pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.82rem;
    line-height: 1.45;
    border: none;
    background: transparent;
    padding: 0;
}

@media (max-width: 768px) {
    .terminal-section .layered-img {
        position: relative;
        right: 0;
        top: 0;
        display: block;
        margin: 0 auto 1rem auto;
        width: 160px;
    }
}

h1 {
  font-size: clamp(2.2rem, 5vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.003em;
  margin-bottom: 0.8rem;
}

h2 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  line-height: 1.18;
  letter-spacing: 0.007em;
  margin-bottom: 0.6rem;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.28;
  letter-spacing: 0.012em;
  margin-bottom: 0.4rem;
}

p {
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.47;
  letter-spacing: -0.022em;
  margin-bottom: 1.2rem;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 100ms ease-out;
}

a:hover {
  text-decoration: underline;
}

/* Navigation bar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  height: 52px;
  background: var(--bg-surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  max-width: 1024px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: transform 100ms var(--ease-out), opacity 100ms ease-out;
}

.brand-icon {
  height: 48px;
  width: auto;
  max-width: 220px;
  display: block;
  object-fit: contain;
}

.brand:active {
  transform: scale(0.96);
  opacity: 0.8;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.8rem;
}

.nav-links a {
  font-size: 0.85rem;
  color: var(--text-main);
  opacity: 0.8;
  transition: opacity 150ms ease-out, transform 100ms ease-out;
}

.nav-links a:hover {
  opacity: 1;
  text-decoration: none;
}

.nav-links a:active {
  transform: scale(0.95);
  opacity: 0.6;
}

/* Layout */
.content-container {
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  flex: 1;
}

.hero {
  text-align: center;
  padding: 4rem 1rem 3rem;
  max-width: 700px;
  margin: 0 auto;
}

.hero p {
  font-size: 1.3rem;
  line-height: 1.38;
}

/* Surface cards */
.card {
  background: var(--bg-card);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  padding: 2rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 300ms var(--ease-spring), box-shadow 300ms ease-out;
}

.card:hover {
  transform: translateY(-2px) scale(1.005);
  box-shadow: var(--shadow-md);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: 980px;
  border: none;
  cursor: pointer;
  outline: none;
  user-select: none;
  transition: transform 100ms var(--ease-out), background-color 150ms ease-out;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--accent-hover);
  text-decoration: none;
}

.btn:active {
  transform: scale(0.96);
}

/* Code blocks */
pre, code {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
}

pre {
  padding: 1rem;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
}

@media (prefers-color-scheme: dark) {
  pre, code {
    background: rgba(255, 255, 255, 0.1);
  }
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 2.5rem 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-content {
  max-width: 680px;
  margin: 0 auto;
}

.footer-content small {
  display: block;
  margin-top: 0.8rem;
  line-height: 1.4;
  opacity: 0.8;
}

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

  .card:hover {
    transform: none;
  }
}

.img-fluid {
  max-width: 100%;
  height: auto;
}

html.menu-open, body.menu-open {
  overflow: hidden;
  height: 100vh;
}

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 24px;
  position: relative;
  z-index: 1001;
}

.mobile-menu-btn span {
  display: block;
  position: absolute;
  height: 2px;
  width: 100%;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform 300ms var(--ease-out), top 300ms var(--ease-out), opacity 300ms ease-out;
}

.mobile-menu-btn span:nth-child(1) {
  top: 4px;
}

.mobile-menu-btn span:nth-child(2) {
  top: 18px;
}

.mobile-menu-btn.is-active span:nth-child(1) {
  top: 11px;
  transform: rotate(45deg);
}

.mobile-menu-btn.is-active span:nth-child(2) {
  top: 11px;
  transform: rotate(-45deg);
}

@keyframes slideDownFall {
  0% {
    transform: translateY(-100%);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes itemPureFade {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@media (max-width: 768px) {
  .mobile-menu-btn {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg-primary);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    z-index: 999;
  }

  .nav-links.is-open {
    visibility: visible;
    background-color: var(--bg-primary);
    animation: slideDownFall 400ms var(--ease-out) forwards;
  }

  .nav-links.is-open a {
    opacity: 0;
    animation: itemPureFade 400ms ease-out forwards;
  }

  .nav-links.is-open a:nth-child(1) { animation-delay: 120ms; }
  .nav-links.is-open a:nth-child(2) { animation-delay: 200ms; }
  .nav-links.is-open a:nth-child(3) { animation-delay: 280ms; }
  .nav-links.is-open a:nth-child(4) { animation-delay: 360ms; }

  .nav-links a {
    font-size: 1.5rem;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .site-header, .card {
    background: var(--bg-primary);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
