/* ========================================
   Layout & Grid
   ======================================== */
.page-shell {
  max-width: calc(var(--maxw) + var(--rail-width));
  margin: 0 auto;
  width: 100%;
  border-left: var(--border) solid var(--c-fg);
  border-right: var(--border) solid var(--c-fg);
}

.rail {
  position: sticky;
  top: 0;
  flex: 0 0 var(--rail-width);
  border-right: var(--border) solid var(--c-fg);
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background-color: var(--c-bg);
}

.rail__inner {
  position: relative;
  flex: 1;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  padding: 1.5rem 0.8rem;
  gap: 1.5rem;
}

.rail__label {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
}

.rail__name {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.4rem);
  line-height: 1;
  text-transform: uppercase;
  font-weight: 600;
}

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

.rail__caption {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-size: 0.75rem;
}

.rail__toggle {
  justify-self: start;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background-color: var(--c-bg);
  border-radius: 0;
}

.main {
  flex: 1;
  min-height: calc(var(--vh, 1vh) * 100);
  background-color: var(--c-bg);
  padding: var(--gutter);
  display: grid;
  align-items: center;
}

.hero {
  border: var(--border) solid var(--c-fg);
  padding: calc(var(--gutter) * 2);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gutter);
  position: relative;
}

.hero::before {
  content: "";
  position: absolute;
  inset: calc(var(--border) * -1);
  border: var(--border) solid var(--c-fg);
  pointer-events: none;
  mix-blend-mode: multiply;
}

.hero__header {
  grid-column: 2 / span 10;
  border-bottom: var(--border) solid var(--c-fg);
  padding-bottom: var(--gutter);
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}

.hero__badge {
  font-family: var(--font-mono);
  letter-spacing: 0.24em;
  font-size: 0.75rem;
  text-transform: uppercase;
  align-self: flex-start;
  border: var(--border) solid var(--c-fg);
  padding: 0.35rem 0.7rem;
}

.hero__subtitle {
  grid-column: 4 / span 6;
  font-size: clamp(1rem, 0.9rem + 0.6vw, 1.5rem);
  margin-top: calc(var(--gutter) * 1.5);
}

.hero__meta {
  grid-column: 10 / span 2;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  justify-self: end;
  align-self: end;
}

.hero__link {
  border-bottom: var(--border) solid currentColor;
  text-decoration: none;
  padding-bottom: 0.2rem;
}

.hero--compact {
  margin-block: 15vh;
}

@media (max-width: 1200px) {
  .hero {
    grid-template-columns: repeat(12, minmax(0, 1fr));
  }

  .hero__header {
    grid-column: 1 / span 12;
  }

  .hero__subtitle {
    grid-column: 2 / span 10;
  }

  .hero__meta {
    grid-column: 9 / span 4;
  }
}

@media (max-width: 1023px) {
  :root {
    --rail-width: 100%;
  }

  .page-shell {
    flex-direction: column;
    border-left: none;
    border-right: none;
  }

  .rail {
    position: relative;
    min-height: auto;
    width: 100%;
    border-right: none;
    border-bottom: var(--border) solid var(--c-fg);
  }

  .rail__inner {
    grid-template-rows: auto;
    grid-auto-flow: column;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }

  .rail__name {
    writing-mode: horizontal-tb;
    transform: none;
    font-size: clamp(1.4rem, 1.2rem + 3vw, 2.5rem);
  }

  .rail__label {
    display: none;
  }

  .main {
    min-height: calc((var(--vh, 1vh) * 100) - 140px);
    padding: calc(var(--gutter) * 1.5) var(--gutter);
  }

  .hero {
    padding: calc(var(--gutter) * 1.5);
  }

  .hero__header,
  .hero__subtitle,
  .hero__meta {
    grid-column: 1 / -1;
  }

  .hero__meta {
    justify-self: flex-start;
  }
}

@media (max-width: 599px) {
  .hero {
    gap: calc(var(--gutter) * 0.75);
  }

  .hero__header {
    gap: calc(var(--gutter) * 0.75);
  }

  .hero__badge {
    font-size: 0.7rem;
  }

  .hero__subtitle {
    font-size: 1rem;
  }
}
