/* CONTAINERS */
.container {
  width: min(100% - (var(--gutter) * 2), var(--content-max));
  margin-inline: auto;
}

.container-fluid {
  width: 100%;
  margin-inline: 0;
  padding-inline: var(--gutter);
}

.container-narrow {
  width: min(100% - (var(--gutter) * 2), var(--content-narrow));
  margin-inline: auto;
}

.form-narrow {
  max-width: 640px;
}

/* SECTIONS */
.section,
.section-alt,
.section-elevated {
  padding: var(--section-pad-y) var(--gutter);
}

.section {
  background-color: var(--surface);
  background-image: var(--surface-texture);
  background-size: auto, var(--fx-noise-size);
  background-blend-mode: overlay, normal;
  color: var(--on-surface);
}

.section-alt {
  background-color: var(--surface-container);
  background-image: var(--surface-texture);
  background-size: auto, var(--fx-noise-size);
  background-blend-mode: overlay, normal;
  color: var(--on-surface);
}

.section-elevated {
  background: var(--ink);
  color: var(--paper);
  border-right: 1px solid var(--accent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--on-surface);
  border-radius: var(--ui-radius-md);
  box-shadow: none;
}

/* SECTION RHYTHM */
.section,
.section-alt,
.section-elevated {
  scroll-margin-top: calc(var(--header-height, 64px) + var(--space-3));
}

.section + .section,
.section + .section-alt,
.section + .section-elevated,
.section-alt + .section,
.section-alt + .section-alt,
.section-alt + .section-elevated,
.section-elevated + .section,
.section-elevated + .section-alt,
.section-elevated + .section-elevated {
  margin-top: var(--space-6);
}


@media (min-width: 600px) {
  .section,
  .section-alt,
  .section-elevated {
    padding-block: calc(var(--section-pad-y) * 1.05);
  }

  .section .container,
  .section-alt .container,
  .section-elevated .container {
    width: min(100% - (var(--gutter) * 2), var(--content-max));
  }
}

/* COLUMNS/ROWS */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-left: -0.75rem;
  margin-right: -0.75rem;
}

[class^="col-"],
[class*=" col-"] {
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  flex: 0 0 100%;
  max-width: 100%;
}

@media (min-width: 600px) {
  .col-1  { flex-basis: 8.3333%;  max-width: 8.3333%; }
  .col-2  { flex-basis: 16.6667%; max-width: 16.6667%; }
  .col-3  { flex-basis: 25%;      max-width: 25%; }
  .col-4  { flex-basis: 33.3333%; max-width: 33.3333%; }
  .col-5  { flex-basis: 41.6667%; max-width: 41.6667%; }
  .col-6  { flex-basis: 50%;      max-width: 50%; }
  .col-7  { flex-basis: 58.3333%; max-width: 58.3333%; }
  .col-8  { flex-basis: 66.6667%; max-width: 66.6667%; }
  .col-9  { flex-basis: 75%;      max-width: 75%; }
  .col-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
  .col-11 { flex-basis: 91.6667%; max-width: 91.6667%; }
  .col-12 { flex-basis: 100%;     max-width: 100%; }
}

.row-center  { justify-content: center; }
.row-between { justify-content: space-between; }
.row-around  { justify-content: space-around; }

.row-middle { align-items: center; }
.row-top    { align-items: flex-start; }
.row-bottom { align-items: flex-end; }

@media (min-width: 600px) {
  .col-sm-1  { flex-basis: 8.3333%;  max-width: 8.3333%; }
  .col-sm-2  { flex-basis: 16.6667%; max-width: 16.6667%; }
  .col-sm-3  { flex-basis: 25%;      max-width: 25%; }
  .col-sm-4  { flex-basis: 33.3333%; max-width: 33.3333%; }
  .col-sm-5  { flex-basis: 41.6667%; max-width: 41.6667%; }
  .col-sm-6  { flex-basis: 50%;      max-width: 50%; }
  .col-sm-7  { flex-basis: 58.3333%; max-width: 58.3333%; }
  .col-sm-8  { flex-basis: 66.6667%; max-width: 66.6667%; }
  .col-sm-9  { flex-basis: 75%;      max-width: 75%; }
  .col-sm-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
  .col-sm-11 { flex-basis: 91.6667%; max-width: 91.6667%; }
  .col-sm-12 { flex-basis: 100%;     max-width: 100%; }
}

@media (min-width: 900px) {
  .col-md-1  { flex-basis: 8.3333%;  max-width: 8.3333%; }
  .col-md-2  { flex-basis: 16.6667%; max-width: 16.6667%; }
  .col-md-3  { flex-basis: 25%;      max-width: 25%; }
  .col-md-4  { flex-basis: 33.3333%; max-width: 33.3333%; }
  .col-md-5  { flex-basis: 41.6667%; max-width: 41.6667%; }
  .col-md-6  { flex-basis: 50%;      max-width: 50%; }
  .col-md-7  { flex-basis: 58.3333%; max-width: 58.3333%; }
  .col-md-8  { flex-basis: 66.6667%; max-width: 66.6667%; }
  .col-md-9  { flex-basis: 75%;      max-width: 75%; }
  .col-md-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
  .col-md-11 { flex-basis: 91.6667%; max-width: 91.6667%; }
  .col-md-12 { flex-basis: 100%;     max-width: 100%; }
}

@media (min-width: 1200px) {
  .col-lg-1  { flex-basis: 8.3333%;  max-width: 8.3333%; }
  .col-lg-2  { flex-basis: 16.6667%; max-width: 16.6667%; }
  .col-lg-3  { flex-basis: 25%;      max-width: 25%; }
  .col-lg-4  { flex-basis: 33.3333%; max-width: 33.3333%; }
  .col-lg-5  { flex-basis: 41.6667%; max-width: 41.6667%; }
  .col-lg-6  { flex-basis: 50%;      max-width: 50%; }
  .col-lg-7  { flex-basis: 58.3333%; max-width: 58.3333%; }
  .col-lg-8  { flex-basis: 66.6667%; max-width: 66.6667%; }
  .col-lg-9  { flex-basis: 75%;      max-width: 75%; }
  .col-lg-10 { flex-basis: 83.3333%; max-width: 83.3333%; }
  .col-lg-11 { flex-basis: 91.6667%; max-width: 91.6667%; }
  .col-lg-12 { flex-basis: 100%;     max-width: 100%; }
}

/* GRID */
.card-grid,
.grid {
  gap: var(--space-4);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.grid {
  display: grid;
}

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

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

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

.grid--start { 
  align-items: flex-start; 
}

.archive-grid--posts {
	display: grid;
	gap: var(--space-6);
}

@media (min-width: 768px) {
	.archive-grid--posts {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (min-width: 1024px) {
	.archive-grid--posts {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 600px) {
  .card-grid,
  .grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .card-grid,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* DIVIDER */
.divider {
  width: 100%;
  height: 1px;
  background: var(--outline-variant);
  margin-block: 1rem;
}

/* STACK / CLUSTER */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, var(--space-3));
}

.stack-lg {
  --stack-gap: 1.25rem;
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cluster-gap, 0.75rem);
  align-items: center;
}

.cluster-sm {
  --cluster-gap: 0.5rem;
}

.cluster--between {
  justify-content: space-between;
  width: 100%;
}

/* WRAPPERS */
/* Sidebar is fixed; layout reserves space for it only on >=900px via padding-left.
   IMPORTANT: use border-box so padding does NOT create horizontal overflow. */

*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }

.layout{
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  padding-left: 0;
  min-height: calc(100vh - var(--header-height, 64px));
}

.layout main{
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}

/* Desktop/tablet: reserve space for fixed sidebar WITHOUT double offset */
@media (min-width: 900px) {
  .layout{
    min-height: 100vh;
    padding-left: 0; /* no sidebar */
  }

  .layout main{
    padding: 1.75rem 2rem;
  }

  .layout main.page-content{
    margin-left: 0;
  }
}

/* MOBILE FIXES */
@media (max-width: 899px) {
  .layout { padding-left: 0; }
  .layout main.page-content { margin-left: 0; padding: 1rem; }
}

/* SIDEBAR */

sidebar,
.sidebar,
aside.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  max-width: 100vw;

  background-color: var(--surface-container-high);
  background-image: var(--fx-grid), var(--fx-noise);
  background-size: auto, var(--fx-noise-size);
  background-blend-mode: overlay, normal;
  border-right: 1px solid color-mix(in srgb, var(--ink) 14%, transparent);

  box-shadow: 0 12px 30px rgba(0,0,0,0.22);
  z-index: 40;

  overflow-y: auto;

  /* breathing room + safe areas */
  padding: clamp(1rem, 4vw, 2rem);
  padding-top: calc(clamp(1rem, 4vw, 2rem) + var(--header-height, 64px));
  padding-left: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-left));
  padding-right: max(clamp(1rem, 4vw, 2rem), env(safe-area-inset-right));

  transform: translateX(-100%);
  transition: transform .28s ease;
}

/* Open states (mobile) — accept either data-open or .active */
sidebar[data-open="true"],
.sidebar[data-open="true"],
sidebar.active,
.sidebar.active,
aside.sidebar[data-open="true"],
aside.sidebar.active {
  transform: translateX(0);
}

/* Desktop: sidebar is always visible */
@media (min-width: 900px) {
  sidebar,
  .sidebar,
  aside.sidebar {
    transform: translateX(0);
  }
}

/* SIDEBAR NAV */
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-nav h2 {
  font-size: calc(var(--type-scale-base) * 0.75);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--on-surface-variant, var(--on-surface));
  margin-bottom: 0.25rem;
}

.sidebar-nav p {
  font-size: calc(var(--type-scale-base) * 0.9);
  color: var(--on-surface-variant, var(--on-surface));
  margin-bottom: 0.75rem;
}

.sidebar-nav .btn.btn-text {
  justify-content: space-between;
  border-radius: 999px;
  padding-block: 0.35rem;
  padding-inline: 0.75rem 0.5rem;
  font-size: calc(var(--type-scale-base) * 0.9);
}

/* SUBMENUS */
.submenu {
  list-style: none;
  margin-top: 0.25rem;
  padding: 0.35rem 0.5rem;
  display: none;
  flex-direction: column;
  gap: 0.15rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--surface-container) 90%, var(--surface) 10%);
  border: 1px solid color-mix(in srgb, var(--outline-variant) 50%, transparent);
  font-size: calc(var(--type-scale-base) * 0.85);
}

.submenu.open {
  display: flex;
}

.submenu a {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding-inline: 0.5rem;
}

.submenu a::before {
  content: "chevron_right";
  font-family: "Material Symbols Outlined";
  font-size: 18px;
  line-height: 1;
  color: var(--on-surface-variant);
  opacity: 0.9;
}

.submenu a:hover {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.submenu-icon {
  font-size: 16px;
  margin-left: 4px;
  transition: transform .25s ease;
}

.submenu-icon.rotated {
  transform: rotate(90deg);
}

/* EXTRA MOBILE COMFORT */
@media (max-width: 600px) {
  .row { margin-left: 0; margin-right: 0; }
  [class^="col-"],
  [class*=" col-"] { padding-left: 0; padding-right: 0; }

  .section,
  .section-alt,
  .section-elevated { padding: var(--space-4) var(--space-3); }
}

/* EMBED GRID */
.embed-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: start;
}

@supports (backdrop-filter: blur(8px)) {
  sidebar,
  .sidebar,
  aside.sidebar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: color-mix(in srgb, var(--surface-container-high) 70%, transparent);
  }
}


/* ZINE LINKS (inspired by maximumrocknroll.com) */
.sidebar a,
sidebar a,
aside.sidebar a{
  color: var(--paper);
  text-decoration-color: color-mix(in srgb, var(--hi) 65%, var(--paper));
}
.sidebar a:hover,
sidebar a:hover,
aside.sidebar a:hover{
  color: var(--hi);
}
