:root {
  /* Light mode variables (default) — Apple-inspired neutral palette */
  --bg: #f5f5f7;
  --bg-alt: #e8e8ed;
  --bg-3: #e0e0e6;
  --accent: #1b7d3b;
  --ac-border: #2ac55e;
  --surface: #e8e8ed;
  --border: #d2d2d7;
  --text-main: #1d1d1f;
  --text-dim: #6e6e73;
}

/* Dark mode overrides */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151516;
    --bg-alt: #252525;
    --bg-3: #101010;
    --accent: #4ade80;
    --ac-border: #21663a;
    --surface: #1a1a1a;
    --border: #424245;
    --text-main: #f5f5f7;
    --text-dim: #86868b;
  }
}

html {
  color: var(--text-main);
  background: var(--bg);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  margin: auto;
  padding: 0 2rem;
  line-height: 1.6;
  max-width: clamp(360px, 85vw, 1200px);
}

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

/* main title style */
.nav .main-title {
  display: inline-block;
  font-size: 1rem;
  font-weight: 500;
  line-height: inherit;
  margin: 0;
  color: var(--text-main);
  transition: opacity 0.2s;
}

.nav .main-title:hover {
  opacity: 0.7;
}

.nav .main-title span {
  color: var(--accent);
}


/* buttons style  */
.btn {
  display: inline-block;
  padding: 0.5em 1.2em;
  color: var(--text-main);
  border-radius: var(--BrRadius);
  border: 1px solid var(--border);
  font-weight: normal;
  transition: filter 0.2s;
}

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


/* button with icon */
.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.btn-icon svg {
  width: 1.1em;
  height: 1.1em;
  fill: currentColor;
  flex-shrink: 0;
}


/* nav style */
.nav {
  margin: 0 auto;
  padding: 1.5rem 0 0.5rem;
  margin-bottom: 3rem;
  display: flex;
  align-items: baseline;
  gap: 2rem;
  flex-wrap: wrap;
}

.nav-row {
  display: flex;
  align-items: baseline;
  gap: 2rem;
}

.nav ul {
  display: flex;
  gap: 1.5rem;
  padding: 0;
  margin: 0;
}

.nav li {
  list-style: none;
}

.nav a {
  font-size: 0.9em;
  font-weight: 500;
  display: inline-block;
  color: var(--text-dim);
  transition: color 0.2s;
}

.nav a:hover {
  color: var(--text-main);
  text-decoration: none;
}

.nav a.active {
  color: var(--accent);
}

/* hamburger toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-direction: column;
  gap: 7px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: transform 0.3s ease-out;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  transform: translateY(-5px) rotate(-45deg);
}

/* footer */
.footer {
  margin-top: 5rem;
  padding: 2rem 0 3rem;
  text-align: center;
  font-size: 0.85em;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* markdown content styles */
h1,
h2,
h3,
h4 {
  margin-top: 1.4em;
}

pre {
  padding: 1em;
  overflow-x: auto;
  border-radius: var(--BrRadius);
}

code {
  background: var(--bg-alt);
  color: var(--text-main);
  padding: 0.1em 0.6em;
  margin: 1px;
  display: inline-block;
  border-radius: var(--BrRadius);
}

pre,
pre.chroma {
  background-color: var(--bg-alt) !important;
  border-radius: var(--BrRadius);
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

a strong {
  font-weight: inherit;
}

a:hover {
  text-decoration: underline;
  color: var(--accent);
  border-radius: var(--BrRadius);
}

picture,
img {
  width: 100%;
  border-radius: var(--BrRadius);
}

svg {
  width: auto;
  height: auto;
  border-radius: var(--BrRadius);
}

input {
  background-color: var(--bg-alt);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--BrRadius);
}

blockquote {
  border: 1px solid var(--ac-border);
  border-left: 4px solid var(--ac-border);
  background-color: var(--bg-3);
  border-radius: 0 var(--BrRadius) var(--BrRadius) 0;
  padding: 2px 10px 2px 20px;
  font-style: italic;
  margin: 1em auto;
}

hr {
  margin-bottom: 2vh;
  margin-top: 2vh;
}

/* table styling */
table {
  border-collapse: collapse;
}

table th,
table td {
  border: 1px solid var(--border);
  padding: 4px 8px;
  text-align: left;
  overflow-wrap: anywhere;
}

table th {
  background: var(--bg-alt);
}

iframe {
  width: 100%;
  /* height: auto; */
  aspect-ratio: 16/9;
  border: none;
  border-radius: var(--BrRadius);
}




@media (max-width: 580px) {
  .nav-row {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
  }

  .nav .main-title {
    font-size: 1.25rem;
  }

  .nav-toggle {
    display: flex;
  }

  #main-nav {
    width: 100%;
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.4s ease-out;
  }

  #main-nav.open {
    max-height: 400px;
  }

  #main-nav ul {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    padding: 1.2rem 0 0.5rem;
    width: 100%;
  }

  #main-nav ul li {
    opacity: 0;
    transform: translateY(-8px);
  }

  #main-nav.open ul li {
    animation: navItemIn 0.35s ease-out forwards;
  }

  #main-nav.open ul li:nth-child(1) { animation-delay: 0.08s; }
  #main-nav.open ul li:nth-child(2) { animation-delay: 0.14s; }
  #main-nav.open ul li:nth-child(3) { animation-delay: 0.20s; }
  #main-nav.open ul li:nth-child(4) { animation-delay: 0.26s; }
  #main-nav.open ul li:nth-child(5) { animation-delay: 0.32s; }

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

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