/* ==========================================================================
   Minimal projects page — shared shell
   A three-pane master/detail layout:
     left   : the existing site panel
     middle : the project list
     right  : the case study, opened by a list item
   Each variant supplies its own geometry and typography in variants/*.css.
   ========================================================================== */

:root {
  --nav-w: 210px;
  --list-w: 340px;
  --list-pad: clamp(22px, 2.6vw, 34px);
  --detail-pad: clamp(28px, 4.6vw, 64px);
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

html,
body {
  height: 100%;
}

body {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

.app {
  display: grid;
  grid-template-columns: var(--nav-w) var(--list-w) minmax(0, 1fr);
  height: 100vh;
  height: 100svh;
}

/* ---- left site panel --------------------------------------------------- */

.site-nav {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 40px 26px 24px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.site-nav .brand {
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--fg);
  border: 0;
}

.site-nav .brand:hover {
  color: var(--brass);
}

.site-nav nav {
  display: grid;
  gap: 11px;
  margin-top: 52px;
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-nav nav a {
  width: fit-content;
  padding: 2px 0;
  border: 0;
  color: var(--muted);
}

.site-nav nav a:hover {
  color: var(--brass);
}

.site-nav nav a[aria-current] {
  color: var(--fg);
}

.site-nav .site-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- middle project panel --------------------------------------------- */

.list-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.list-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: var(--list-pad);
  border-bottom: 1px solid var(--line);
}

.list-head .kicker {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.list-head h1 {
  font-family: var(--serif);
  font-size: 34px;
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.list-head .count {
  align-self: start;
  padding-top: 3px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

.list {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.list::-webkit-scrollbar {
  width: 4px;
}

.list::-webkit-scrollbar-thumb {
  background: var(--line);
}

.item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 13px;
  gap: 11px;
  align-items: start;
  width: 100%;
  padding: 17px var(--list-pad);
  border: 0;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease),
    padding 0.25s var(--ease);
}

.item:hover {
  background: rgba(233, 227, 214, 0.025);
}

.item:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: -1px;
}

.item-num {
  padding-top: 4px;
  font-family: var(--mono);
  font-size: 8px;
  line-height: 1.6;
  letter-spacing: 0.06em;
  color: var(--faint);
  transition: color 0.2s var(--ease);
}

.item-name {
  display: block;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.1;
  letter-spacing: -0.01em;
  transition: color 0.2s var(--ease);
}

.item-meta {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.55;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.item-mark {
  position: relative;
  justify-self: end;
  width: 11px;
  height: 11px;
  margin-top: 5px;
  opacity: 0;
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease);
}

.item-mark::before,
.item-mark::after {
  content: "";
  position: absolute;
  background: var(--brass);
}

.item-mark::before {
  left: 0;
  right: 0;
  top: 5px;
  height: 1px;
}

.item-mark::after {
  top: 0;
  bottom: 0;
  left: 5px;
  width: 1px;
}

.item.is-open .item-name {
  color: var(--brass);
}

.item.is-open .item-num {
  color: var(--brass-dim);
}

.item.is-open .item-mark {
  opacity: 1;
  transform: rotate(45deg);
}

.list-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px var(--list-pad);
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 7px;
  line-height: 1.6;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- right detail panel ------------------------------------------------ */

.detail-panel {
  position: relative;
  min-width: 0;
  overflow-y: auto;
  background: var(--bg);
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.detail-panel::-webkit-scrollbar {
  width: 5px;
}

.detail-panel::-webkit-scrollbar-thumb {
  background: var(--line);
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 100%;
  padding: 40px;
  text-align: center;
}

.empty .empty-mark {
  font-family: var(--serif);
  font-size: clamp(84px, 12vw, 190px);
  line-height: 0.78;
  letter-spacing: -0.05em;
  color: transparent;
  -webkit-text-stroke: 1px rgba(200, 167, 101, 0.17);
}

.empty p {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.5;
  color: var(--faint);
}

.detail {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(32px, 4.6vw, 64px) var(--detail-pad) 88px;
  animation: detail-in 0.35s var(--ease) both;
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.detail-head {
  position: relative;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.detail-kicker {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.detail-head h2 {
  margin: 0 64px 11px 0;
  font-family: var(--serif);
  font-size: clamp(38px, 4.8vw, 62px);
  line-height: 0.94;
  letter-spacing: -0.03em;
}

.detail-sub {
  max-width: 52ch;
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.55;
  color: var(--muted);
}

.close {
  position: absolute;
  right: 0;
  top: 24px;
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font: 18px/1 var(--serif);
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}

.close:hover {
  color: var(--brass);
  border-color: var(--brass-dim);
}

.close:focus-visible {
  outline: 1px solid var(--brass);
  outline-offset: 3px;
}

.detail-figure {
  margin: 0 0 26px;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}

.detail-figure img,
.detail-figure .detail-cover {
  display: block;
  width: 100%;
  aspect-ratio: 1.55;
  object-fit: cover;
  object-position: top;
}

.detail-figure .detail-cover {
  aspect-ratio: 1.55;
}

.detail-figure .text-plate {
  min-height: 0;
}

.detail-figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 8px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 12px;
  line-height: 1.45;
  color: var(--faint);
}

.detail-figure figcaption span:last-child {
  flex: 0 0 auto;
  padding-top: 2px;
  font-family: var(--mono);
  font-style: normal;
  font-size: 7px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: clamp(24px, 3.4vw, 44px);
  align-items: start;
}

.detail-text p {
  margin: 0 0 15px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.72;
  color: var(--muted);
}

.detail-text p:first-child {
  font-size: 20px;
  line-height: 1.6;
  color: var(--fg);
}

.detail-meta {
  display: grid;
  gap: 11px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.detail-meta div {
  display: grid;
  gap: 2px;
}

.detail-meta dt {
  font-family: var(--mono);
  font-size: 7px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
}

.detail-meta dd {
  font-family: var(--sans);
  font-size: 9px;
  line-height: 1.5;
  color: var(--muted);
}

.detail-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-top: 26px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.detail-index {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
  color: var(--faint);
}

/* ---- mobile ------------------------------------------------------------ */

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app {
    display: block;
    height: auto;
    min-height: 100vh;
  }

  .site-nav {
    flex-direction: row;
    align-items: center;
    gap: 18px;
    height: auto;
    padding: 15px 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .site-nav .brand {
    font-size: 19px;
  }

  .site-nav nav {
    display: flex;
    gap: 14px;
    margin: 0 0 0 auto;
    font-size: 9px;
  }

  .site-nav .site-foot {
    display: none;
  }

  .list-panel {
    height: auto;
    min-height: calc(100vh - 57px);
    border-right: 0;
  }

  .list {
    overflow: visible;
  }

  .list-head {
    padding: 28px 20px 18px;
  }

  .item {
    padding: 15px 20px;
  }

  .list-foot {
    padding: 14px 20px 64px;
  }

  .detail-panel {
    position: fixed;
    inset: 0;
    z-index: 60;
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 0.36s var(--ease), visibility 0s 0.36s;
  }

  body.has-open .detail-panel {
    transform: none;
    visibility: visible;
    transition: transform 0.36s var(--ease), visibility 0s;
  }

  .empty {
    display: none;
  }

  .detail {
    max-width: none;
    padding: 24px 20px 72px;
  }

  .detail-head h2 {
    margin-right: 44px;
    font-size: clamp(36px, 11vw, 54px);
  }

  .detail-sub {
    font-size: 17px;
  }

  .detail-figure {
    padding: 5px;
  }

  .detail-figure img,
  .detail-figure .detail-cover {
    aspect-ratio: 1.5;
  }

  .detail-body {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .detail-meta {
    grid-template-columns: 1fr 1fr;
    gap: 12px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .detail {
    animation: none;
  }

  .item,
  .detail-panel,
  .item-mark {
    transition-duration: 0.01ms !important;
  }
}
