/* ============================================================
   PAGE-SPECIFIC — Overrides and unique page layouts
   ============================================================ */

/* ── Home ────────────────────────────────────────────────── */
.home-hero {
  padding-top: var(--s-4);
  margin-bottom: var(--s-8);
}

.home-bio {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-2);
  max-width: 52ch;
  margin-top: var(--s-4);
}

.home-bio a {
  color: var(--color-accent);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease-out);
}

.home-bio a:hover {
  border-bottom-color: var(--color-link-underline);
}

.home-section {
  margin-bottom: var(--s-8);
}

.home-about-link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
}

/* ── About ───────────────────────────────────────────────── */
.about-bio {
  margin-bottom: var(--s-6);
}

/* ── 404 ─────────────────────────────────────────────────── */
.not-found-page {
  display: flex;
  flex-direction: column;
  min-height: 60vh;
  justify-content: center;
  gap: var(--s-6);
  padding-top: var(--s-7);
}

.not-found-page .page-label {
  margin-bottom: var(--s-3);
}

.not-found-message {
  font-family: var(--font-serif);
  font-size: var(--text-md);
  color: var(--color-text-2);
  font-style: italic;
  max-width: 38ch;
}

/* ── Collection page panels ──────────────────────────────── */
.collection-panel[hidden] { display: none; }

/* ── Writing page ────────────────────────────────────────── */
.writing-intro {
  margin-bottom: var(--s-7);
}

.series-prefix {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--s-1);
  font-weight: 600;
}

.series-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-4);
}

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

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

.series-card {
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  padding: var(--s-5);
  border-radius: var(--radius-md);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out),
              background-color var(--t-fast) var(--ease-out);
}

.series-card:hover,
.series-card.active {
  border-color: var(--color-accent);
  transform: translateY(-2px);
}

.series-card.active {
  background-color: var(--color-code-bg);
}

.series-card__count {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: var(--s-2);
}

.series-card__title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-1);
  margin-bottom: var(--s-2);
}

.series-card__desc {
  font-size: var(--text-sm);
  color: var(--color-text-2);
  line-height: var(--leading-normal);
}


/* ── Contact page ────────────────────────────────────────── */
.contact-prose {
  margin-top: var(--s-6);
  margin-bottom: var(--s-5);
  font-family: var(--font-serif);
  font-size: var(--text-base);
  color: var(--color-text-2);
  line-height: var(--leading-relaxed);
  max-width: 46ch;
}

/* ── Uses page why-linux section ─────────────────────────── */
.why-linux {
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: var(--border-width) solid var(--color-border);
}

.why-linux__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 400;
  margin-bottom: var(--s-4);
}

.why-linux__body {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  color: var(--color-text-2);
  line-height: var(--leading-relaxed);
  max-width: 56ch;
}

/* ── Simple static sections (Collection page) ───────────── */
.simple-section {
  margin-bottom: var(--s-7);
}

.simple-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border-top: 1px solid var(--color-border);
}

.simple-list li {
  font-size: var(--text-base);
  color: var(--color-text-1);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--color-border);
  line-height: var(--leading-normal);
}

.simple-list .item-author {
  color: var(--color-text-3);
  font-size: var(--text-sm);
}

.simple-list a {
  color: var(--color-text-1);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-fast) var(--ease-out), color var(--t-fast) var(--ease-out);
}

.simple-list a:hover {
  color: var(--color-accent);
  border-bottom-color: var(--color-link-underline);
}

/* ── Right Panel (Projects/Home page) ───────────────────── */
.right-panel {
  display: block;
  background-color: var(--color-surface);
  border-top: var(--border-width) solid var(--color-border);
  padding: var(--s-8) var(--s-5) var(--s-9);
}

.right-panel__title,
.right-panel__list {
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 1023px) {
  .site-wrapper.has-right-panel {
    flex-direction: row; /* prevent column stack since right panel is fixed drawer */
  }
  
  .right-panel {
    position: fixed;
    top: 54px;
    right: 0;
    width: 100%;
    max-width: 320px;
    height: calc(100vh - 54px);
    z-index: 250;
    background-color: var(--color-surface);
    border-top: none;
    border-left: var(--border-width) solid var(--color-border);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.05);
    transform: translateX(100%);
    transition: transform var(--t-mid) var(--ease-out), background-color var(--t-fast) var(--ease-out);
    overflow-y: auto;
    padding: var(--s-5) var(--s-4) var(--s-8);
  }

  .right-panel.is-open {
    transform: translateX(0);
  }
}

@media (max-width: 600px) {
  .right-panel {
    max-width: 280px; /* slightly narrower drawer on small phones */
  }
}

@media (min-width: 1024px) {
  .right-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width); /* 240px */
    height: 100vh;
    border-top: none;
    border-left: var(--border-width) solid var(--color-border);
    padding: var(--s-9) var(--s-4) var(--s-6);
    overflow-y: auto;
    overflow-x: hidden;
    transform: none !important;
  }
  
  .right-panel__title,
  .right-panel__list {
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
  
  .has-right-panel .main-content {
    margin-right: var(--sidebar-width);
  }
}

.right-panel__title {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-1);
  margin-bottom: var(--s-5);
  display: block;
}

.right-panel__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}

.right-panel__item {
  display: block;
  text-decoration: none;
}

.right-panel__item .pet-title {
  display: block;
  font-family: var(--font-serif);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-1);
  margin-bottom: var(--s-1);
  transition: color var(--t-fast) var(--ease-out);
  line-height: var(--leading-tight);
}

a.right-panel__item:hover .pet-title {
  color: var(--color-accent);
}

.right-panel__item .pet-desc {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-2);
  line-height: var(--leading-normal);
}

.nowrap {
  white-space: nowrap;
}

/* ── Gallery (Pinterest Masonry Layout) ────────────────────── */
.gallery-masonry {
  column-count: 1;
  column-gap: var(--s-5);
  margin-top: var(--s-6);
}

@media (min-width: 640px) {
  .gallery-masonry {
    column-count: 2;
  }
}

@media (min-width: 1024px) {
  .gallery-masonry {
    column-count: 3;
  }
}

.gallery-item {
  display: inline-block;
  width: 100%;
  margin-bottom: var(--s-5);
  break-inside: avoid;
  text-decoration: none;
  color: inherit;
}

.gallery-item__wrapper {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background-color: var(--color-surface);
  border: var(--border-width) solid var(--color-border);
  transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}

.gallery-item:hover .gallery-item__wrapper {
  border-color: var(--color-accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* For dark theme active shadows */
[data-theme="dark"] .gallery-item:hover .gallery-item__wrapper {
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.gallery-item__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--t-mid) var(--ease-out);
}

/* Aspect Ratio Modifiers for Masonry staggering */
.gallery-item--landscape .gallery-item__wrapper {
  aspect-ratio: 4 / 3;
}

.gallery-item--portrait .gallery-item__wrapper {
  aspect-ratio: 2 / 3;
}

.gallery-item--square .gallery-item__wrapper {
  aspect-ratio: 1 / 1;
}

.gallery-item--tall .gallery-item__wrapper {
  aspect-ratio: 3 / 5;
}

.gallery-item:hover .gallery-item__img {
  transform: scale(1.02);
}

.gallery-item__details {
  padding: var(--s-3) var(--s-1) var(--s-1);
}

.gallery-item__title {
  font-family: var(--font-serif);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-1);
  margin: 0 0 4px 0;
  line-height: var(--leading-normal);
}

.gallery-item__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gallery-item__date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-3);
}

.gallery-item__tag {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}


/* ============================================================
   DARK MODE — Page-specific border & text lifts
   ============================================================ */
html[data-theme="dark"] .simple-list,
html[data-theme="dark"] .simple-list li {
  border-color: #333333;
}

html[data-theme="dark"] .why-linux {
  border-top-color: #333333;
}

html[data-theme="dark"] .right-panel {
  border-left-color: #2e2e2e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .simple-list,
  :root:not([data-theme]) .simple-list li {
    border-color: #333333;
  }

  :root:not([data-theme]) .why-linux {
    border-top-color: #333333;
  }

  :root:not([data-theme]) .right-panel {
    border-left-color: #2e2e2e;
  }
}

/* Dark mode: gallery card wrapper resting border */
html[data-theme="dark"] .gallery-item__wrapper {
  border-color: #333333;
}

html[data-theme="dark"] .gallery-item:hover .gallery-item__wrapper {
  border-color: #555555;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .gallery-item__wrapper {
    border-color: #333333;
  }

  :root:not([data-theme]) .gallery-item:hover .gallery-item__wrapper {
    border-color: #555555;
  }
}

/* ── External Link Icon ───────────────────────────────────── */
a[target="_blank"]::after {
  content: " ↗";
  font-size: 0.85em;
  display: inline-block;
  margin-left: 0.15em;
  vertical-align: middle;
  line-height: 1;
}

/* Exclude navigation sidebars, social lists, and custom project link buttons */
.sidebar a[target="_blank"]::after,
.sidebar__social a[target="_blank"]::after,
.mobile-nav-social a[target="_blank"]::after,
.project-link[target="_blank"]::after,
.project-links a[target="_blank"]::after,
.gallery-card a[target="_blank"]::after {
  content: none !important;
}


