/* =========================================================
   home sweet home — archive 열쇠꾸러미(src/archive/)
   평면도 속 열쇠꾸러미를 가까이 꺼내 본 화면. 바탕 · 선 · 파스텔 · 글꼴 · 별은 로딩 · 홈과 같은 공통 값(base.css).
   위에 ← home(회색 글자) · 노란 밑줄 제목, 아래에 사이트 흰 알약 줄과 '사이트 이름 ↗'.
   ========================================================= */

.hsh-arc {
  --hsh-arc-mono: var(--hsh-mono);
  --hsh-arc-font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", sans-serif;

  position: fixed;
  inset: 0 0 auto;
  height: 100vh;
  height: 100dvh;
  z-index: 60;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--hsh-paper);
  color: var(--hsh-text);
  opacity: 0;
  transition: opacity 200ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

.hsh-arc[hidden] { display: none; }
.hsh-arc:focus { outline: none; }
.hsh-arc.is-open { opacity: 1; }
.hsh-arc.is-closing { opacity: 0; pointer-events: none; }
.hsh-arc-on, .hsh-arc-on body { overflow: hidden; }

/* ---------- 여백 별(공통 .hsh-star — base.css) ---------- */

.hsh-arc__stars { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------- 위 — ← home · 제목 ---------- */

.hsh-arc__top {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  /* ← home 은 화면 가운데 1/3 구역 왼쪽 끝(base.css --hsh-band — neighbor 와 같은 규칙) */
  min-height: 44px;
  padding:
    var(--hsh-top) /* 위 줄 자리 — neighbor 와 같다(base.css) */
    max(10px, env(safe-area-inset-right), calc(50vw - var(--hsh-band)))
    0
    max(10px, env(safe-area-inset-left), calc(50vw - var(--hsh-band)));
}

/* 테두리 없는 회색 글자 링크 — 누르는 자리는 44px */
.hsh-arc__home {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font-family: var(--hsh-arc-mono);
  font-size: 14px;
  color: var(--hsh-link);
  cursor: pointer;
  transition: color 160ms ease-out;
}
.hsh-arc__home > span { display: inline-block; transition: translate 160ms ease-out; }
.hsh-arc__home:hover { color: var(--hsh-text); }
.hsh-arc__home:hover > span { translate: -2px 0; }
.hsh-arc__home:focus-visible,
.hsh-arc__chip:focus-visible,
.hsh-arc__link:focus-visible,
.hsh-arc__row:focus-visible { outline: 1.5px solid var(--hsh-line); outline-offset: 2px; }

/* 제목 — 영단어(첫 글자 대문자) + 밑줄은 홈 archive 버튼 색종이 색(하늘) */
.hsh-arc__title {
  margin: 0;
  font-family: var(--hsh-arc-mono);
  font-size: 26px;
  line-height: 44px; /* 위 줄 높이 — neighbor 제목과 같은 자리 */
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--hsh-text);
  text-decoration: underline 5px var(--hsh-sky);
  text-underline-offset: 6px;
  text-decoration-skip-ink: none;
}

/* ---------- 가운데 — 꾸러미 ---------- */

.hsh-arc__stage { position: relative; min-height: 0; }

.hsh-arc__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent; /* 바탕 아이보리가 그대로 — 캔버스 경계가 드러나지 않게 */
  touch-action: none; /* 끌어 돌리기 — 화면이 같이 스크롤되지 않게 */
  cursor: grab;
  opacity: 0;
  transition: opacity 260ms ease-out;
  user-select: none;
  -webkit-user-select: none;
}
.hsh-arc.is-ready .hsh-arc__canvas { opacity: 1; }
.hsh-arc__canvas.is-dragging { cursor: grabbing; }

/* 고른 열쇠 옆 이름표 — 그 사이트 색 작은 종이 조각 */
.hsh-arc__tag {
  position: absolute;
  left: 0;
  top: 0;
  padding: 4px 10px 5px;
  background: var(--c, var(--hsh-sky));
  font-family: var(--hsh-arc-mono);
  font-size: 15px;
  color: var(--hsh-text);
  white-space: nowrap;
  rotate: -3deg;
  pointer-events: none;
  will-change: translate;
}
.hsh-arc__tag[hidden] { display: none; }

/* ---------- 아래 — 사이트 알약 줄 · 이동 링크 ---------- */

.hsh-arc__foot {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding:
    4px
    max(16px, env(safe-area-inset-right))
    max(14px, calc(env(safe-area-inset-bottom) + 8px))
    max(16px, env(safe-area-inset-left));
}
.hsh-arc__foot[hidden] { display: none; }

/* 사이트 줄 — 한 줄에(몇 개든 다음 줄로 내려가지 않게) */
.hsh-arc__chips {
  display: flex;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
}

/* 흰 알약 — 꾸러미 · 집과 같은 부드러운 회색 선, 왼쪽에 사이트 색 동그라미 + 그림, 오른쪽에 이름 */
.hsh-arc__chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 4px 16px 4px 5px;
  border: 1.3px solid var(--hsh-line);
  border-radius: 999px;
  background: #fff;
  font-family: var(--hsh-arc-mono);
  font-size: 14px;
  color: var(--hsh-text);
  cursor: pointer;
  transition: translate 180ms ease-out, background-color 180ms ease-out, border-color 180ms ease-out;
}

.hsh-arc__dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--c);
}

.hsh-arc__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 고름 — 살짝 들리고 선이 짙어지며 바탕에 사이트 색이 옅게(열쇠를 눌러 골라도 같이) */
.hsh-arc__chip[aria-pressed="true"] {
  translate: 0 -2px;
  border-color: var(--hsh-text);
  background: color-mix(in srgb, var(--c) 30%, #fff);
}

@media (hover: hover) {
  .hsh-arc__chip:hover { translate: 0 -1px; }
  .hsh-arc__chip[aria-pressed="true"]:hover { translate: 0 -2px; }
}

.hsh-arc__icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--hsh-text);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.hsh-arc__icon .dot { fill: var(--hsh-text); stroke: none; }
.hsh-arc__icon .fill { fill: #f6b9cb; }

/* 고른 사이트로 가는 링크 자리 */
.hsh-arc__go {
  min-height: 40px;
  margin: 0;
  display: flex;
  align-items: center;
}

/* 고른 사이트 링크 — 테두리 없는 타자기 글자, 아래에 사이트 색 형광펜 */
.hsh-arc__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 4px;
  font-family: var(--hsh-arc-mono);
  font-size: 14px;
  letter-spacing: 0.01em;
  color: var(--hsh-text);
  text-decoration: none;
  background: linear-gradient(var(--c, var(--hsh-sky)), var(--c, var(--hsh-sky))) center calc(100% - 9px) / 100% 7px no-repeat;
  cursor: pointer;
  transition: rotate 160ms ease-out;
}
.hsh-arc__link:hover { rotate: -1.5deg; }

.hsh-arc__arrow-dot { font-size: 13px; line-height: 1; }

.hsh-arc__link.is-off {
  background: none;
  color: var(--hsh-note);
  cursor: default;
  rotate: none;
}

.hsh-arc__soon {
  padding: 2px 8px;
  border: 1px dashed var(--hsh-line);
  border-radius: 999px;
  font-family: var(--hsh-arc-font);
  font-size: 11.5px;
  color: var(--hsh-note);
}

/* ---------- 3D 를 쓸 수 없을 때 — 같은 데이터로 목록(종이 라벨처럼) ---------- */

.hsh-arc__list {
  position: relative;
  list-style: none;
  margin: 0 auto;
  padding: 24px 20px;
  max-width: 360px;
  display: grid;
  gap: 10px;
  align-content: center;
  height: 100%;
}
.hsh-arc__list[hidden] { display: none; }

.hsh-arc__row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 16px 0 14px;
  background: var(--c);
  font-family: var(--hsh-arc-mono);
  font-size: 15px;
  color: var(--hsh-text);
  text-decoration: none;
}
.hsh-arc__list li:nth-child(odd) .hsh-arc__row { rotate: -0.8deg; }
.hsh-arc__list li:nth-child(even) .hsh-arc__row { rotate: 0.8deg; }
.hsh-arc__row > span:nth-of-type(1) { flex: 1; }
.hsh-arc__row.is-off { color: var(--hsh-note); }
.hsh-arc__arrow { color: var(--hsh-link); }

/* ---------- 휴대폰 ---------- */

@media (max-width: 560px) {
  .hsh-arc__tag { font-size: 16px; }

  /* 사이트 줄 — 열쇠 꼬리표처럼 세로로 선 알약을 한 줄에 칸을 똑같이 나눠서(동그라미 위 · 이름 아래) */
  .hsh-arc__chips {
    display: grid;
    grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
    gap: 8px;
    width: min(420px, 100%);
  }
  .hsh-arc__chip {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 5px 4px 7px;
    font-size: 12px;
  }
  .hsh-arc__dot { width: 28px; height: 28px; }
  .hsh-arc__icon { width: 18px; height: 18px; }
  .hsh-arc__name { max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .hsh-arc,
  .hsh-arc__canvas,
  .hsh-arc__home,
  .hsh-arc__home > span,
  .hsh-arc__chip,
  .hsh-arc__link,
  .hsh-star { transition: none; }
}
