:root {
  color-scheme: light dark;
  --bg: #f6f3ed;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --text: #1d1b18;
  --muted: #6a6257;
  --accent: #b04a2b;
  --accent-strong: #8b3318;
  --border: rgba(34, 29, 24, 0.12);
  --shadow: 0 18px 48px rgba(47, 35, 23, 0.12);
  --radius: 20px;
  --content-width: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171411;
    --surface: rgba(35, 31, 27, 0.82);
    --surface-strong: rgba(43, 38, 34, 0.94);
    --text: #f5ede3;
    --muted: #c5b8aa;
    --accent: #ff8d67;
    --accent-strong: #ffb49a;
    --border: rgba(255, 243, 231, 0.11);
    --shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(176, 74, 43, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.site-shell {
  min-height: 100vh;
}

.site-header,
.site-footer {
  padding: 1.25rem 1.5rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}

.header-inner,
.footer-inner,
.page-main {
  width: min(calc(100% - 2rem), var(--content-width));
  margin: 0 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.header-banner-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.85rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  padding-top: 0.35rem;
}

.brand-logo {
  width: 60px;
  height: 60px;
  object-fit: contain;
  border-radius: 18px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  padding: 0.3rem;
}

.brand-banner {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.brand-row.banner-only {
  justify-content: flex-end;
}

.brand-row.banner-only .brand {
  display: none;
}

.brand-name {
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.nav-links {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.24rem;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.nav-toggle-bar {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.brand-row.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.brand-row.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.brand-row.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-link {
  text-decoration: none;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.nav-link:hover,
.nav-link[aria-current="page"] {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 38%, var(--border));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}

.page-main {
  padding: 2.4rem 0 3rem;
}

.hero,
.section-card,
.blog-entry-card,
.blog-detail,
.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(1.5rem, 3vw, 2.6rem);
  margin-bottom: 1.8rem;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
}

.hero h1,
.section-card h2,
.section-card h3,
.blog-detail h1 {
  margin: 0.2rem 0 0.9rem;
  line-height: 1.15;
}

.hero-copy,
.markdown-content,
.excerpt {
  color: var(--text);
}

.muted {
  color: var(--muted);
}

.social-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.4rem;
  justify-content: center;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 999px;
}

.social-icon {
  width: 30px;
  height: 30px;
  object-fit: cover;
  border-radius: 10px;
}

.stack {
  display: grid;
  gap: 1.5rem;
}

.section-card {
  padding: clamp(1.2rem, 2.4vw, 2rem);
}

.grid {
  display: grid;
  gap: 1.15rem;
}

.grid.playlists-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.grid.video-grid,
.grid.portfolio-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 6px);
  overflow: hidden;
}

.portfolio-card {
  display: flex;
  flex-direction: column;
}

.tutorial-playlist-card {
  display: flex;
  flex-direction: column;
}

.card-media {
  aspect-ratio: 16 / 9;
  object-fit: cover;
  width: 100%;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.card-media-contain {
  object-fit: contain;
  padding: 0.85rem;
}

.tutorials-channel-callout,
.inline-image-callout {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}

.youtube-channel-description,
.callout-description {
  margin: 0;
  flex: 1 1 280px;
  align-self: center;
}

.youtube-channel-link,
.youtube-channel-link:visited,
.inline-image-link,
.inline-image-link:visited {
  display: inline-block;
  line-height: 0;
  text-decoration: none;
}

.youtube-channel-icon,
.inline-callout-image {
  width: auto;
  height: auto;
  max-width: 160px;
  object-fit: contain;
  display: block;
}

.kit-callout-image {
  max-height: 44px;
}

.card-body {
  padding: 1rem;
}

.portfolio-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.tutorial-playlist-card .card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.button-row {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.portfolio-button-row {
  gap: 0.55rem;
  flex-wrap: nowrap;
  margin-top: auto;
  padding-top: 1rem;
}

.tutorial-playlist-button-row {
  margin-top: auto;
  padding-top: 1rem;
}

.button,
.video-card {
  cursor: pointer;
  border: 0;
}

.button,
.button:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  text-decoration: none;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.portfolio-button-row .button,
.portfolio-button-row .button:visited {
  padding: 0.55rem 0.8rem;
  font-size: 0.92rem;
  white-space: nowrap;
  flex: 0 0 auto;
}

.button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

.source-section + .source-section {
  margin-top: 1.8rem;
}

.video-card {
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.video-date {
  padding: 0.7rem 0.85rem 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.tutorials-browser {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  align-items: start;
  margin-top: 1rem;
}

.tutorials-sidebar {
  display: grid;
  gap: 0.8rem;
  max-height: 78vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.tutorial-item {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr);
  gap: 0.85rem;
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-strong);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.tutorial-item:hover,
.tutorial-item.selected {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent) 36%, var(--border));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-strong));
}

.tutorial-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.tutorial-thumb-placeholder {
  min-height: 64px;
}

.tutorial-item-body {
  min-width: 0;
}

.tutorial-item-title {
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.35rem;
}

.tutorial-item-meta,
.tutorial-detail-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.tutorial-detail {
  padding: 1rem;
}

.tutorial-detail-body {
  padding: 1rem 0.2rem 0.2rem;
}

.tutorial-detail-title {
  margin: 0.35rem 0 0;
  line-height: 1.2;
}

.tutorial-placeholder {
  display: grid;
  place-items: center;
  min-height: 280px;
  border-radius: 18px;
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
  padding: 1rem;
}

.tutorial-hero,
.tutorial-player {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
}

.tutorial-hero {
  position: relative;
  display: block;
  cursor: pointer;
}

.tutorial-hero img,
.tutorial-player iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 18px;
  background: black;
  object-fit: cover;
}

.tutorial-play-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.18);
}

.tutorial-play-badge {
  width: 74px;
  height: 74px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  position: relative;
}

.tutorial-play-badge::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 52%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-top: 14px solid transparent;
  border-bottom: 14px solid transparent;
  border-left: 22px solid #fff;
}

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

.blog-entry-card {
  padding: 1rem;
}

.blog-listing {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
  align-items: start;
}

.blog-listing img,
.blog-hero-image {
  border-radius: 16px;
  border: 1px solid var(--border);
}

.blog-meta {
  color: var(--muted);
  font-size: 0.95rem;
}

.blog-detail {
  padding: clamp(1.2rem, 3vw, 2.4rem);
}

.blog-detail .blog-hero-image {
  margin: 1rem 0 1.4rem;
}

.site-footer {
  border-top: 1px solid var(--border);
}

.footer-inner {
  color: var(--muted);
  font-size: 0.95rem;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal.is-visible {
  display: flex;
}

.modal-content {
  width: min(100%, 920px);
  padding: 1rem;
}

.modal-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 16px;
  background: black;
}

.modal-close {
  display: inline-flex;
  margin-left: auto;
  margin-bottom: 0.8rem;
}

@media (max-width: 900px) {
  .brand-row,
  .brand-row.banner-only {
    align-items: center;
    justify-content: space-between;
  }

  .brand-row {
    flex-wrap: wrap;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.9rem;
  }

  .brand-row.nav-open .nav-links {
    display: flex;
  }

  .nav-link {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 720px) {
  .page-main {
    padding-top: 1.4rem;
  }

  .blog-listing {
    grid-template-columns: 1fr;
  }

  .tutorials-browser {
    grid-template-columns: 1fr;
  }

  .tutorial-detail {
    order: -1;
  }

  .tutorials-sidebar {
    max-height: none;
  }

  .tutorial-item {
    grid-template-columns: 92px minmax(0, 1fr);
  }
}
