/* Mobile layout adjustments */
@media (max-width: 980px) {
  #panel-about.is-active {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .tab-panel[data-tab-panel="about"] .library-root {
    height: auto;
    grid-template-rows: none;
  }

  .tab-panel[data-tab-panel="about"] .library-row {
    height: auto;
    grid-template-rows: auto;
  }

  .tab-panel[data-tab-panel="about"] .library-viewport {
    height: var(--library-row-height);
  }

  #panel-journal.is-active {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .journal-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 100%;
    padding: var(--space-12);
    gap: var(--space-12);
  }

  .journal-photo-root {
    height: auto;
  }

  .journal-photo-root .library-row {
    height: auto;
    min-height: 0;
  }

  .journal-photo-root .library-viewport {
    --library-row-height: 120px;
    height: var(--library-row-height);
  }

  .journal-photo-root .library-row-label {
    --kicker-decor-start-x: 190px;
  }

  .journal-entries {
    overflow: visible;
  }

  .library-root {
    padding: var(--space-12);
    gap: var(--space-12);
  }

  .journal-photo-root {
    padding: 0;
    gap: 0;
  }

  .library-viewport {
    --library-row-height: 104px;
  }

  .library-item.is-hovered {
    transform: scale(1.1);
  }

  .library-modal-card {
    width: calc(100% - 20px);
    max-height: calc(100% - var(--library-modal-nav-safe-zone) - 10px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 1fr) auto;
  }

  .library-modal-copy {
    max-height: min(48dvh, 320px);
  }

  .journal-modal-card {
    width: calc(100% - 20px);
    max-height: calc(100% - 20px);
  }

  .journal-modal-scroll {
    padding: 12px;
  }

  .hobby-detail-panel.is-layout-double,
  .hobby-detail-panel.is-layout-single {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-auto-rows: auto;
  }

  .hobby-detail-copy {
    padding: var(--space-12);
    transform: none;
  }

  .hobby-detail-panel .hobby-detail-media img {
    grid-column: 1 !important;
    border-left: 0 !important;
    border-top: 3px solid var(--text-accent);
  }

  .hobby-detail-panel.is-layout-single .hobby-detail-media img:first-child {
    height: 220px;
  }

  .hobby-detail-panel.is-layout-double .hobby-detail-media img {
    height: 180px;
  }
}

@media (max-width: 640px) {
  :root {
    --header-row-size: 110px;
  }

  .site-shell {
    width: 100%;
    height: 100dvh;
    margin: 0 auto;
    padding: 0;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .site-header {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .site-nav {
    grid-column: 1 / -1;
    min-width: 0;
    width: auto;
  }

  .theme-selected-icon,
  .theme-option img {
    width: 52%;
    height: 52%;
  }

  .accent-rail {
    display: none;
  }

  .home-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
  }

  .library-viewport {
    --library-row-height: 86px;
  }

  .library-row-label {
    --kicker-decor-start-x: 170px;
    font-size: 0.68rem;
  }

  .journal-layout {
    padding: 10px;
    gap: 10px;
  }

  .journal-photo-root .library-row-label {
    --kicker-decor-start-x: 170px;
  }

  .library-item.is-hovered {
    transform: scale(1.1);
  }

  .library-item-title-chip {
    font-size: 0.58rem;
  }

  .library-modal-card {
    width: calc(100% - 14px);
    max-height: calc(100% - var(--library-modal-nav-safe-zone) - 8px);
    min-height: 0;
  }

  .library-modal-copy {
    padding: var(--space-12);
  }

  .journal-modal-card {
    width: calc(100% - 14px);
    max-height: calc(100% - 14px);
  }

  .journal-modal-scroll {
    padding: 10px;
  }

  .home-intro,
  .home-details,
  .home-signal,
  .home-facecard,
  .home-manifesto,
  .home-log,
  .home-links {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .home-intro {
    transform: none;
  }

  .home-facecard-media {
    min-height: 240px;
    max-height: 320px;
  }

  .kicker-decor-rail {
    --kicker-slot-width: 15px;
  }

  .home-kicker {
    --kicker-decor-start-x: 170px;
  }

  .kicker-barcode {
    width: var(--kicker-barcode-width, 42px);
  }

  .kicker-piece {
    height: 15px;
  }

  .kicker-icon-slot {
    width: 15px;
  }

  .home-tag-row {
    grid-template-columns: 1fr;
  }

  .hobbies-grid {
    --hobbies-row-height: auto;
    --hobby-card-height: 190px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-8);
    height: auto;
  }

  .hobby-card {
    height: var(--hobby-card-height);
    align-self: start;
    margin-top: 0;
  }

  .hobby-card:nth-child(4) {
    grid-column: 1 / -1;
  }

  .hobby-card-overlay {
    transform: translateY(0);
  }

  .hobby-detail-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .hobby-detail-panel.is-layout-single .hobby-detail-media img:first-child {
    height: 180px;
  }

  .hobby-detail-panel.is-layout-double .hobby-detail-media img {
    height: 150px;
  }
}
