/* =========================================================
   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;
  padding:
    max(12px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    0
    max(10px, env(safe-area-inset-left));
}

/* 테두리 없는 회색 글자 링크 — 누르는 자리는 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;
  padding: 5px 14px 6px;
  background: var(--hsh-lilac);
  font-family: var(--hsh-arc-mono);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--hsh-lilac-ink);
  rotate: -2deg;
}

/* ---------- 가운데 — 꾸러미 ---------- */

.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;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  max-width: 480px;
}

/* 종이 라벨 — 테두리 · 둥근 캡슐 없이 단색 네모 + 작은 그림 + 이름. 라벨마다 조금씩 기울여 붙임.
   누르는 자리는 44px(보이는 종이는 그 안에 조금 작게 — ::before) */
.hsh-arc__chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  background: none;
  font-family: var(--hsh-arc-mono);
  font-size: 14px;
  color: var(--hsh-text);
  cursor: pointer;
  rotate: var(--tilt, 0deg);
  transition: rotate 200ms ease-out, translate 200ms ease-out;
}
.hsh-arc__chip::before {
  content: "";
  position: absolute;
  inset: 6px 0;
  z-index: -1;
  background: var(--c);
  transition: background-color 200ms ease-out;
}
.hsh-arc__chips { isolation: isolate; } /* 라벨 종이(::before)가 줄 뒤로 빠지지 않게 */

.hsh-arc__name { white-space: nowrap; }

/* 고름 — 살짝 더 기울고 들리며 색이 조금 짙어진다(열쇠를 눌러 골라도 같이) */
.hsh-arc__chip[aria-pressed="true"] {
  rotate: calc(var(--tilt, 0deg) * 2.2);
  translate: 0 -2px;
}
.hsh-arc__chip[aria-pressed="true"]::before { background: color-mix(in srgb, var(--c) 82%, var(--hsh-line)); }

@media (hover: hover) {
  .hsh-arc__chip:hover { rotate: calc(var(--tilt, 0deg) * 1.8); }
}

.hsh-arc__icon {
  flex: none;
  width: 18px;
  height: 18px;
  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; }
}

@media (prefers-reduced-motion: reduce) {
  .hsh-arc,
  .hsh-arc__canvas,
  .hsh-arc__home,
  .hsh-arc__home > span,
  .hsh-arc__chip,
  .hsh-arc__chip::before,
  .hsh-arc__link,
  .hsh-star { transition: none; }
}
