/* Shared chrome for every page on miiiics.com.
   Lives at /assets/, so url() paths here are relative to /assets/. */

@font-face {
  font-family: 'Coolvetica';
  src: url('fonts/Coolvetica Rg.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }

html { background: #1c1c1c; }

body {
  margin: 0;
  overflow-x: hidden;
  background: transparent;
  color: #e8e8e8;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 18px;
  line-height: 1.7;
}

a {
  color: #e8e8e8;
  text-decoration: none;
}

a:hover {
  color: #38b038;
  text-decoration: underline;
}

/* ── Site header ── */
.site-header {
  background: linear-gradient(to bottom, #1c1c1c, #050505);
  border-bottom: 2px solid #2d8c2d;
  padding: 2.1rem calc(1.5rem + env(safe-area-inset-right)) 0 calc(1.5rem + env(safe-area-inset-left));
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85), 0 2px 6px rgba(0, 0, 0, 0.6), 0 -300px 0 300px #1c1c1c;
  transition: padding 0.25s ease, background 0.25s ease;
}

.site-header-inner {
  max-width: 720px;
  margin: 0 auto;
}

.site-title {
  margin: 0;
  line-height: 1;
}

.site-logo {
  height: 3rem;
  width: auto;
  display: block;
  transition: height 0.25s ease;
}

.site-title a:hover {
  text-decoration: none;
}

.site-tagline {
  margin: 0.25rem 0 0.45rem;
  font-size: 0.95rem;
  color: #777;
  font-style: italic;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  overflow: hidden;
  max-height: 3rem;
  opacity: 1;
  transition: max-height 0.25s ease, opacity 0.2s ease, margin 0.25s ease;
}

.site-header.header-compact {
  padding: 0.1rem calc(1.5rem + env(safe-area-inset-right)) 0.1rem calc(1.5rem + env(safe-area-inset-left));
  background: linear-gradient(to bottom, #111111, #020202);
}

.site-header.header-compact .site-header-inner {
  display: flex;
  align-items: center;
  max-width: none;
  margin: 0;
}

.site-header.header-compact .site-title {
  padding-right: 0.75rem;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  background: inherit;
}

.site-header.header-compact .site-logo {
  height: 1.4rem;
}

.site-header.header-compact .site-tagline {
  max-height: 0;
  opacity: 0;
  margin: 0;
}

.site-header.header-compact .site-nav {
  margin-top: 0;
  flex: 1;
  justify-content: flex-start;
  min-width: 0;
}

.site-header.header-compact .site-nav a:first-child {
  margin-left: auto;
}

.site-header.header-compact .site-nav a {
  padding: 0.25rem 0.75rem;
}

.site-header::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  background: radial-gradient(ellipse var(--blip-spread, 22%) 100% at var(--blip-pct, -10%) 100%, rgba(45, 140, 45, 0.15) 0%, rgba(45, 140, 45, 0.05) 50%, transparent 90%);
  opacity: var(--blip-alpha, 0);
  pointer-events: none;
  z-index: -1;
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 12%;
  height: 2px;
  background: linear-gradient(to right, transparent 0%, rgba(56, 210, 56, 0.8) 100%);
  transform: translateX(calc(var(--blip-tx, -100) * 1%));
  opacity: var(--blip-alpha, 0);
  pointer-events: none;
}

/* ── Nav ── */
.site-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 0.25rem;
  overflow-x: auto;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 3px;
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black var(--fade-l, 0%), black calc(100% - var(--fade-r, 0%)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black var(--fade-l, 0%), black calc(100% - var(--fade-r, 0%)), transparent 100%);
}

.site-nav::-webkit-scrollbar { display: none; }

/* Separates the non-category links (Home, Projects) from the category list.
   Deliberately low-contrast — a hint of structure, not a visible rule. */
.nav-divider {
  align-self: center;
  flex-shrink: 0;
  color: #333;
  font-size: 0.8rem;
  line-height: 1;
  user-select: none;
  pointer-events: none;
  transition: color 0.25s ease;
}

.site-header.header-compact .nav-divider {
  font-size: 0.75rem;
}

.site-nav a {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9rem;
  font-weight: 500;
  color: #888;
  padding: 0.6rem 1rem;
  text-decoration: none;
  position: relative;
  transform: translateY(0);
  transition:
    color 0.22s ease,
    transform 0.18s ease,
    text-shadow 0.22s ease;
}

.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 1rem;
  right: 1rem;
  height: 3px;
  background: #38b038;
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.site-nav a:hover {
  color: #5fd65f;
  text-decoration: none;
  transform: translateY(-2px);
  text-shadow:
    0 0 12px rgba(56, 176, 56, 0.45),
    0 0 24px rgba(56, 176, 56, 0.18);
}

.site-nav a:hover::after {
  transform: scaleX(1);
}

.site-nav a.nav-active {
  color: #2d8c2d;
  font-weight: 700;
  text-decoration: none;
  transform: translateY(0);
  text-shadow: none;
  transition:
    color 0.22s ease,
    transform 0.18s ease,
    text-shadow 0.22s ease;
}

.site-nav a.nav-active::after {
  transform: scaleX(1);
  background: #2d8c2d;
  transition: none;
}

/* ── Main content ── */
main {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

/* ── Page heading (category and project pages) ── */
.page-heading {
  margin: 0 0 2rem;
  font-size: 1.1rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #777;
  font-weight: 400;
  border-bottom: 1px solid #2a2a2a;
  padding-bottom: 1rem;
}

.page-heading strong {
  color: #e8e8e8;
  font-weight: 700;
}

/* Masked SVG glyph inside a page heading; the mask-image url is set inline per page. */
.heading-icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  vertical-align: middle;
  margin-right: 0.2em;
  margin-bottom: 0.1em;
}

/* ── Post card ── */
.post {
  padding-bottom: 2.25rem;
  margin-bottom: 2.25rem;
  border-bottom: 1px solid #2a2a2a;
}

.post:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  color: #777;
  margin-bottom: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  text-decoration: none;
}

.badge:hover {
  opacity: 0.8;
  text-decoration: none;
}

.badge-svg-icon {
  display: inline-block;
  width: 11px;
  height: 11px;
  background-color: currentColor;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  vertical-align: middle;
  margin-right: 3px;
  margin-bottom: 1px;
}

.badge-music    { background: #3d1a2e; color: #d4699a; }
.badge-art      { background: #1e1535; color: #9b7ed4; }
.badge-pokemon  { background: #2e2100; color: #c49a3c; }
.badge-misc     { background: #1a1f2e; color: #7a93c4; }
.badge-youtube  { background: #2a0d0d; color: #c45c5c; }
.badge-dev      { background: #0d1f2e; color: #4f9fd4; }

/* ── Project badge (orthogonal to categories; always last) ── */
.badge-divider {
  color: #3a3a3a;
  font-size: 0.85rem;
  line-height: 1;
  user-select: none;
  margin: 0 -0.15rem;
}

.badge-project {
  background: #0d2318;
  color: #3aa87a;
  white-space: nowrap;
  max-width: 100%;
}

.badge-project:hover {
  opacity: 1;
  background: #113020;
}

.badge-project .project-name {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  vertical-align: bottom;
  opacity: 0;
  transition:
    max-width 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s ease;
}

.badge-project:hover .project-name,
.badge-project:focus-visible .project-name {
  max-width: 24rem;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .badge-project .project-name { transition: none; }
}

.post-title {
  margin: 0 0 0.6rem;
  font-family: 'Coolvetica', sans-serif;
  font-size: 1.45rem;
  font-weight: normal;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.post-title a {
  color: #e8e8e8;
}

.post-title a:hover {
  color: #38b038;
  text-decoration: none;
}

.post-excerpt {
  font-size: 0.97rem;
  color: #888;
  margin: 0;
  line-height: 1.65;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* ── Video embed ── */
.video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  margin-bottom: 1rem;
  border: 2px solid #252525;
  border-top-color: #3a3a3a;
  border-left-color: #3a3a3a;
  border-bottom-color: #111111;
  border-right-color: #111111;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.8),
    0 1px 4px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4);
  border-radius: 2px;
}

.video-wrapper iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: 0;
}

/* ── Image embed ── */
.image-wrapper {
  display: block;
  max-width: 75%;
  margin: 0 auto 1rem;
  border: 2px solid #252525;
  border-top-color: #3a3a3a;
  border-left-color: #3a3a3a;
  border-bottom-color: #111111;
  border-right-color: #111111;
  box-shadow:
    0 4px 16px rgba(0, 0, 0, 0.8),
    0 1px 4px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4);
  border-radius: 2px;
}

.image-wrapper img {
  display: block;
  width: 100%;
  height: auto;
}

.image-wrapper + .image-caption { margin-top: -0.75rem; max-width: 75%; margin-left: auto; margin-right: auto; }

/* Images with their own transparency get no frame — the inset border and drop shadow
   read as a floating box around nothing. Set `transparent: true` on the block. */
.image-wrapper.image-plain {
  border: none;
  box-shadow: none;
  border-radius: 0;
  background: none;
}

.image-caption {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  color: #666;
  text-align: left;
  padding: 0.35rem 0.5rem 0.1rem;
  font-style: italic;
}

/* ── Gallery ──
   The image area is a flex row — [prev] [image] [next] — so the arrows sit OUTSIDE the
   image instead of overlaying it. The gallery therefore spans the full content column
   while the image itself stays at 75%, leaving room for the buttons either side. */
.gallery { margin: 0 auto 1rem; max-width: 100%; }

.gallery-image-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.gallery .image-wrapper {
  flex: 0 1 75%;
  width: auto;
  max-width: 75%;
  margin: 0;
}

.gallery-btn {
  flex: 0 0 34px;
  height: 34px;
  background: rgba(0,0,0,0.55);
  color: #e8e8e8;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.gallery-btn:hover {
  background: rgba(0,0,0,0.82);
  border-color: #2d8c2d;
  color: #5fd65f;
}

/* Hidden with visibility, not display, so the row keeps its width and the image does
   not jump sideways when an arrow disappears at either end. */
.gallery-btn[hidden],
.gallery-btn.is-hidden {
  visibility: hidden;
}

/* Keep the caption aligned to the image rather than the wider gallery box. */
.gallery .image-caption {
  max-width: 75%;
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 480px) {
  .gallery-image-area { gap: 0.3rem; }
  .gallery-btn { flex-basis: 28px; height: 28px; font-size: 1.1rem; }
}
.gallery-dots {
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 20px;
  margin: 4px 0;
}
.gallery-dots-track {
  display: flex;
  align-items: center;
  gap: 11px;
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.gallery-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #38b038;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.45s ease;
}

.post-body {
  margin-top: 0.75rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  padding: 1rem 1.25rem;
}

/* ── Show More ── */
.post-body-collapsed {
  max-height: 320px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 45%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 45%, transparent 100%);
}
.show-more-btn {
  display: block;
  width: 100%;
  background: none;
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #666;
  cursor: pointer;
  font-family: 'Coolvetica', sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  padding: 7px;
  margin-top: 6px;
  transition: color 0.15s, border-color 0.15s;
}
.show-more-btn:hover { color: #e8e8e8; border-color: #666; }

.post-body p:not(.image-caption) {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.97rem;
  color: #b0b0b0;
  margin: 0 0 0.9rem;
  line-height: 1.65;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.post-body p:last-child { margin-bottom: 0; }

.post-body a {
  color: #38b038;
  text-decoration: none;
}

.post-body a:hover {
  color: #5fd65f;
  text-decoration: none;
  text-shadow: 0 0 8px rgba(56, 176, 56, 0.6);
}

/* ── Sort control ── */
.sort-row {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 1.5rem;
}

.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid #3a3a3a;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.75rem;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.sort-btn:hover {
  color: #e8e8e8;
  border-color: #2d8c2d;
  background: rgba(13, 35, 24, 0.4);
}

.sort-arrow {
  color: #3aa87a;
  font-size: 0.9rem;
  line-height: 1;
}

/* ── "About this project" (collapsed intro post on a project page) ── */
.project-about {
  margin-bottom: 2.25rem;
  padding-bottom: 2.25rem;
  border-bottom: 1px solid #2a2a2a;
}

.project-about-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  color: #999;
  cursor: pointer;
  /* Matches .post-title — same family, weight, and no letter-spacing. */
  font-family: 'Coolvetica', sans-serif;
  font-size: 1.45rem;
  font-weight: normal;
  line-height: 1.25;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  text-align: left;
  padding: 0.7rem 1rem;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.project-about-toggle:hover {
  color: #e8e8e8;
  border-color: #2d8c2d;
  background: rgba(13, 35, 24, 0.4);
}

.project-about-toggle.open {
  color: #e8e8e8;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.project-about-chevron {
  display: inline-block;
  font-size: 1rem;
  color: #3aa87a;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.project-about-toggle.open .project-about-chevron {
  transform: rotate(90deg);
}

.project-about-panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1);
}

/* The panel supplies the framing, so the post inside drops its own separator. */
.project-about-panel .post {
  border-bottom: none;
  margin-bottom: 0;
  padding: 1rem 1rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: rgba(0, 0, 0, 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .project-about-panel { transition: none; }
  .project-about-chevron { transition: none; }
}

/* ── Project index (/projects/) ── */
.project-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.project-card {
  display: block;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.project-card:hover {
  text-decoration: none;
  border-color: #2d8c2d;
  background: rgba(13, 35, 24, 0.45);
  transform: translateY(-2px);
}

.project-card h2 {
  margin: 0 0 0.35rem;
  font-family: 'Coolvetica', sans-serif;
  font-size: 1.25rem;
  font-weight: normal;
  color: #e8e8e8;
}

.project-card:hover h2 { color: #5fd65f; }

.project-card p {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.92rem;
  color: #999;
  line-height: 1.6;
}

.project-card .project-count {
  display: block;
  margin-top: 0.5rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Footer ── */
.site-footer {
  border-top: 1px solid #2a2a2a;
  padding: 1.5rem;
  text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.8rem;
  color: #555;
}

.site-footer a {
  color: #555;
}

.site-footer a:hover {
  color: #38b038;
}

.empty-state {
  color: #555;
  font-style: italic;
  margin-top: 2rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}
