/* ============================================================
   기준 해상도 1920×1080 — 세로 높이 비례 스케일 (--ui-scale)
   페이지 높이: --design-height (js/layout.js, 최소 비율 4:3)
   ============================================================ */
:root {
  --ui-scale: 1;
  --design-height: 100vh;
  --page-solid: #14161e;
  --page-gradient-url: url('../assets/backgrounds/subpage-bg.png');
  --page-gradient-fallback: #041428;
  --glass-bg: rgba(24, 26, 32, 0.88);
  --glass-blur: calc(26 * var(--ui-scale) * 1px);
  --glow-accent: #e8e8e8;
  --glow-soft: rgba(255, 255, 255, 0.22);
  --glow-mid: rgba(255, 255, 255, 0.62);
  --glow-strong: rgba(255, 255, 255, 0.92);
  --glow-skeuo-full:
    inset 0 calc(1 * var(--ui-scale) * 1px) 0 rgba(255, 255, 255, 0.35),
    inset 0 calc(-2 * var(--ui-scale) * 1px) calc(8 * var(--ui-scale) * 1px) rgba(0, 0, 0, 0.4),
    inset 0 0 calc(36 * var(--ui-scale) * 1px) rgba(255, 255, 255, 0.72),
    inset 0 0 calc(64 * var(--ui-scale) * 1px) rgba(255, 255, 255, 0.42),
    0 0 calc(6 * var(--ui-scale) * 1px) rgba(255, 255, 255, 0.22),
    0 0 calc(14 * var(--ui-scale) * 1px) rgba(255, 255, 255, 0.1);
  --glow-text-on: #0a0a0a;
  --glow-text-muted-on: rgba(0, 0, 0, 0.72);
  --glow-on-dur: 0.12s;
  --glow-off-dur: 0.68s;
  --spot-bright: #ffffff;
  --spot-mid: #e0e0e0;
  --spot-dim: #b0b0b0;
  --spot-dark: #707070;
  --home-panel-gap: calc(14 * var(--ui-scale) * 1px);

  --surface: rgba(22, 26, 36, 0.82);
  --border: rgba(255, 255, 255, 0.12);
  --border-active: rgba(255, 255, 255, 0.9);
  --text: #f0f2f5;
  --text-muted: rgba(240, 242, 245, 0.65);
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* 세로 9단위 비율 (1080px 기준): 0.65 + 1.78 + 4.3 + 2.27 = 9 */
  --top-height: calc(0.65 / 9 * 1080 * var(--ui-scale) * 1px);
  --tile-gap-top: calc(1.78 / 9 * 1080 * var(--ui-scale) * 1px);
  --tile-height: calc(4.3 / 9 * 1080 * var(--ui-scale) * 1px);
  --bottom-zone-h: calc(2.27 / 9 * 1080 * var(--ui-scale) * 1px);
  --tile-width: calc(360 * var(--ui-scale) * 1px);
  --tile-gap: calc(30 * var(--ui-scale) * 1px);
  --tile-focus-scale: 1.12;
  --tile-title-height: calc(103 * var(--ui-scale) * 1px);
  --tile-title-size: calc(24 * var(--ui-scale) * 1px);

  --nav-btn-width: calc(204 * var(--ui-scale) * 1px);
  --nav-btn-height: calc(1.2 / 9 * 1080 * var(--ui-scale) * 1px);
  --nav-btn-gap: calc(60 * var(--ui-scale) * 1px);
  --nav-gap-top: calc(0.64 / 9 * 1080 * var(--ui-scale) * 1px);
  --nav-bottom-space: calc(0.43 / 9 * 1080 * var(--ui-scale) * 1px);
  --nav-icon-size: calc(28 * var(--ui-scale) * 1px);
  --nav-label-size: calc(12.8 * var(--ui-scale) * 1px);

  --side-padding: calc(60 * var(--ui-scale) * 1px);
  --radius: calc(6 * var(--ui-scale) * 1px);
  --radius-lg: calc(10 * var(--ui-scale) * 1px);
  --top-bar-font: calc(12.8 * var(--ui-scale) * 1px);
  --nav-btn-gap-inner: calc(5.6 * var(--ui-scale) * 1px);
  --nav-btn-padding: calc(6.4 * var(--ui-scale) * 1px);
  --top-bar-item-gap: calc(20 * var(--ui-scale) * 1px);
  --top-nav-btn-gap: calc(32 * var(--ui-scale) * 1px);
  --top-nav-btn-font: calc(18 * var(--ui-scale) * 1px);
  --top-nav-btn-padding-x: calc(16 * var(--ui-scale) * 1px);
  --top-nav-btn-padding-y: calc(8 * var(--ui-scale) * 1px);
  --card-hover-lift: calc(-3 * var(--ui-scale) * 1px);

  /* Brand Central — 16×9 목업 (0.65 + 5.5 + 2.85 = 9) */
  --brand-main-h: calc(660 * var(--ui-scale) * 1px);
  --brand-nav-h: calc(342 * var(--ui-scale) * 1px);
  --brand-hero-w: 62.5%;
  --brand-panel-w: 37.5%;
  --brand-section-btn-w: calc(312 * var(--ui-scale) * 1px);
  --brand-section-btn-h: calc(192 * var(--ui-scale) * 1px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: #000;
}

.viewport {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewport__frame {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  overflow: hidden;
  background: var(--page-solid);
}

.background {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.stage {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.background__slides {
  position: absolute;
  inset: 0;
  transition: opacity 1.1s ease;
}

.background__static {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 1.1s ease;
}

.background--ssanmai .background__static {
  background-image: url('../assets/backgrounds/ssanmai-bg.png');
  opacity: 1;
}

.background--ssanmai .background__slides {
  opacity: 0;
}

.background--news .background__static {
  background-image: url('../assets/news/shelf-bg.png');
  opacity: 1;
}

.background--news .background__slides {
  opacity: 0;
}

.background--services .background__static {
  background-image: url('../assets/backgrounds/services-bg.png');
  opacity: 1;
}

.background--services .background__slides {
  opacity: 0;
}

.background--solid .background__static {
  background-image: var(--page-gradient-url);
  background-color: var(--page-gradient-fallback);
  opacity: 1;
}

.background--solid .background__slides {
  opacity: 0;
}

.background__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  overflow: hidden;
  transition: opacity 1.1s ease-in;
  will-change: opacity;
}

.background__slide--active {
  opacity: 1;
  z-index: 1;
}

.background__media-wrap {
  width: 100%;
  height: 100%;
  animation-duration: 8s;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

.background__media-wrap--origin-tl {
  transform-origin: 0% 0%;
}

.background__media-wrap--origin-tr {
  transform-origin: 100% 0%;
}

.background__media-wrap--origin-bl {
  transform-origin: 0% 100%;
}

.background__media-wrap--origin-br {
  transform-origin: 100% 100%;
}

.background__media-wrap--zoom-in {
  animation-name: bg-kenburns-in;
}

.background__media-wrap--zoom-out {
  animation-name: bg-kenburns-out;
}

@keyframes bg-kenburns-in {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.06);
  }
}

@keyframes bg-kenburns-out {
  from {
    transform: scale(1.06);
  }
  to {
    transform: scale(1);
  }
}

.background__media {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.background__shade {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.7) 14%,
    rgba(0, 0, 0, 0.45) 32%,
    rgba(0, 0, 0, 0.2) 52%,
    rgba(0, 0, 0, 0.07) 68%,
    transparent 82%
  );
}

.stage--brand-open .top-bar,
.stage--history-open .top-bar {
  z-index: 120;
  background: #181a20;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.stage--brand-open .content {
  visibility: hidden;
}

.top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  width: 100%;
  height: var(--top-height);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 var(--side-padding);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.top-bar__left,
.top-bar__nav,
.top-bar__right {
  position: relative;
  z-index: 1;
}

.top-bar__brand {
  display: flex;
  align-items: center;
  gap: calc(14 * var(--ui-scale) * 1px);
}

.top-bar__logo-btn {
  display: flex;
  align-items: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: calc(4 * var(--ui-scale) * 1px);
  transition: opacity 0.2s ease;
}

.top-bar__logo-btn:hover {
  opacity: 0.85;
}

.top-bar__logo-btn:focus-visible {
  outline: calc(2 * var(--ui-scale) * 1px) solid var(--glow-accent);
  outline-offset: calc(2 * var(--ui-scale) * 1px);
}

.top-bar__logo {
  display: block;
  height: calc(44 * var(--ui-scale) * 1px);
  width: auto;
}

.top-bar__location {
  font-family: Papyrus, fantasy, serif;
  font-size: calc(28 * var(--ui-scale) * 1px);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.03em;
  line-height: 1.1;
}

.top-bar__left,
.top-bar__right {
  display: flex;
  gap: var(--top-bar-item-gap);
}

.top-bar__left {
  justify-self: start;
}

.top-bar__right {
  justify-self: end;
}

.top-bar__nav {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  height: 100%;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  overflow: hidden;
}

.top-nav-btn,
.home-feature,
.home-news,
.nav-btn,
.card-hscroll__btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition:
    color var(--glow-off-dur) ease-out,
    background var(--glow-off-dur) ease-out,
    border-color var(--glow-off-dur) ease-out,
    box-shadow var(--glow-off-dur) ease-out,
    transform var(--glow-off-dur) ease-out,
    text-shadow var(--glow-off-dur) ease-out,
    filter var(--glow-off-dur) ease-out;
}

.top-nav-btn::before,
.home-feature::before,
.home-news::before,
.nav-btn::before,
.card-hscroll__btn::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0;
  border-radius: inherit;
  background:
    radial-gradient(
      ellipse 140% 160% at 50% 42%,
      rgba(255, 255, 255, 0.72) 0%,
      rgba(255, 255, 255, 0.38) 42%,
      transparent 74%
    ),
    linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.42) 0%,
      rgba(255, 255, 255, 0.22) 48%,
      rgba(180, 180, 180, 0.28) 100%
    );
  pointer-events: none;
  transition: opacity var(--glow-off-dur) ease-out;
}

.top-nav-btn:hover::before,
.home-feature:hover::before,
.home-news:hover::before,
.nav-btn:hover::before,
.card-hscroll__btn:hover:not(:disabled)::before {
  opacity: 1;
  transition: opacity var(--glow-on-dur) ease-in;
}

.top-nav-btn:hover,
.home-feature:hover,
.home-news:hover,
.nav-btn:hover,
.card-hscroll__btn:hover:not(:disabled) {
  color: var(--glow-text-on);
  border-color: var(--glow-strong);
  box-shadow: var(--glow-skeuo-full);
  text-shadow: none;
  z-index: 5;
  transition:
    color var(--glow-on-dur) ease-in,
    background var(--glow-on-dur) ease-in,
    border-color var(--glow-on-dur) ease-in,
    box-shadow var(--glow-on-dur) ease-in,
    transform var(--glow-on-dur) ease-in,
    text-shadow var(--glow-on-dur) ease-in,
    filter var(--glow-on-dur) ease-in;
}

.top-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-width: calc(96 * var(--ui-scale) * 1px);
  padding: 0 var(--top-nav-btn-padding-x);
  background: transparent;
  border: none;
  border-radius: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--top-nav-btn-font);
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
  isolation: isolate;
}

.top-nav-btn__label {
  position: relative;
  z-index: 1;
}

.top-nav-btn:last-child {
  border-right: none;
}

.top-nav-btn--active {
  color: var(--text);
  background: rgba(18, 20, 28, 0.82);
  box-shadow: inset 0 0 0 calc(2 * var(--ui-scale) * 1px) var(--border-active);
}

.top-nav-btn--active:hover {
  color: var(--glow-text-on);
  background: transparent;
  box-shadow: var(--glow-skeuo-full);
}

.top-bar__item {
  font-size: var(--top-bar-font);
  color: var(--text-muted);
  letter-spacing: 0.02em;
}

.content {
  position: absolute;
  inset: 0;
  z-index: 5;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.content::-webkit-scrollbar {
  display: none;
}

.page {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: var(--design-height);
  min-height: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  padding-top: calc(var(--top-height) + var(--tile-gap-top));
  padding-bottom: var(--bottom-zone-h);
  background: transparent;
  scroll-snap-align: start;
  scroll-snap-stop: normal;
}

#page-home {
  padding-top: var(--top-height);
  padding-bottom: 0;
}

.home-panel {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: var(--home-panel-gap);
  width: 100%;
  padding: 0 var(--home-panel-gap) var(--home-panel-gap);
  pointer-events: none;
}

.home-panel--hidden {
  visibility: hidden;
  pointer-events: none;
}

.home-panel > * {
  pointer-events: auto;
}

.home-news,
.home-features {
  position: relative;
}

.home-news > *,
.home-features > * {
  position: relative;
  z-index: 1;
}

.home-news {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-height: calc(52 * var(--ui-scale) * 1px);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(14 * var(--ui-scale) * 1px);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 calc(8 * var(--ui-scale) * 1px) calc(24 * var(--ui-scale) * 1px) rgba(0, 0, 0, 0.28);
}

.home-news__label {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0 calc(22 * var(--ui-scale) * 1px);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: calc(15 * var(--ui-scale) * 1px);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  transition:
    color var(--glow-off-dur) ease-out,
    background var(--glow-off-dur) ease-out,
    text-shadow var(--glow-off-dur) ease-out;
}

.home-news:hover .home-news__label {
  background: rgba(255, 255, 255, 0.14);
  color: var(--glow-text-on);
  transition:
    color var(--glow-on-dur) ease-in,
    background var(--glow-on-dur) ease-in,
    text-shadow var(--glow-on-dur) ease-in;
}

.home-news__headline {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  min-width: 0;
  padding: calc(12 * var(--ui-scale) * 1px) calc(24 * var(--ui-scale) * 1px);
  background: transparent;
  color: var(--text);
  font-size: calc(15 * var(--ui-scale) * 1px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.35;
  transition: color var(--glow-off-dur) ease-out;
}

.home-news:hover .home-news__headline {
  color: var(--glow-text-on);
  transition: color var(--glow-on-dur) ease-in;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  min-height: calc(168 * var(--ui-scale) * 1px);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(16 * var(--ui-scale) * 1px);
  overflow: hidden;
  box-shadow: 0 calc(8 * var(--ui-scale) * 1px) calc(28 * var(--ui-scale) * 1px) rgba(0, 0, 0, 0.28);
}

.home-feature {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(10 * var(--ui-scale) * 1px);
  min-width: 0;
  min-height: calc(168 * var(--ui-scale) * 1px);
  padding: calc(22 * var(--ui-scale) * 1px) calc(22 * var(--ui-scale) * 1px) calc(20 * var(--ui-scale) * 1px);
  background: transparent;
  border: none;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.home-feature:first-child {
  border-radius: calc(16 * var(--ui-scale) * 1px) 0 0 calc(16 * var(--ui-scale) * 1px);
}

.home-feature:last-child {
  border-radius: 0 calc(16 * var(--ui-scale) * 1px) calc(16 * var(--ui-scale) * 1px) 0;
  border-right: none;
}

.home-feature > * {
  position: relative;
  z-index: 1;
}

.home-feature:hover .home-feature__desc {
  color: var(--glow-text-muted-on);
  transition: color var(--glow-on-dur) ease-in;
}

.home-feature:hover .home-feature__cta {
  color: var(--glow-text-on);
  transition: color var(--glow-on-dur) ease-in;
}

.home-feature__title {
  font-size: calc(20 * var(--ui-scale) * 1px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.home-feature__desc {
  flex: 1 1 auto;
  font-size: calc(14 * var(--ui-scale) * 1px);
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  line-height: 1.4;
  transition: color var(--glow-off-dur) ease-out;
}

.home-feature__cta {
  margin-top: auto;
  font-size: calc(14 * var(--ui-scale) * 1px);
  font-weight: 600;
  color: rgba(240, 242, 245, 0.85);
  letter-spacing: -0.01em;
  transition: color var(--glow-off-dur) ease-out;
}

.page--cards {
  padding-top: calc(
    var(--top-height) + var(--home-panel-gap) * 2 + calc(52 * var(--ui-scale) * 1px)
  );
}

.card-hscroll--fixed,
.card-hscroll {
  position: absolute;
  top: var(--top-height);
  left: 0;
  right: 0;
  z-index: 200;
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  width: auto;
  min-height: calc(52 * var(--ui-scale) * 1px);
  margin: var(--home-panel-gap);
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: calc(14 * var(--ui-scale) * 1px);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  box-shadow: 0 calc(8 * var(--ui-scale) * 1px) calc(24 * var(--ui-scale) * 1px) rgba(0, 0, 0, 0.28);
  overflow: hidden;
  isolation: isolate;
  pointer-events: auto;
}

.card-hscroll.is-hidden {
  visibility: hidden;
  pointer-events: none;
}

.card-hscroll.is-history {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.card-hscroll.is-history .card-hscroll__btn {
  color: #fff;
}

.card-hscroll.is-history .card-hscroll__btn + .card-hscroll__btn {
  border-left-color: rgba(255, 255, 255, 0.55);
}

.card-hscroll.is-history .card-hscroll__btn:disabled {
  opacity: 0.35;
}

.card-hscroll.is-history .card-hscroll__btn::before {
  background: rgba(255, 255, 255, 0.12);
}

.card-hscroll.is-history .card-hscroll__btn:hover:not(:disabled) {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.85);
  box-shadow: none;
  text-shadow: none;
}

.card-hscroll.is-history.is-history-light {
  border-color: rgba(0, 0, 0, 0.75);
}

.card-hscroll.is-history.is-history-light .card-hscroll__btn {
  color: #111;
}

.card-hscroll.is-history.is-history-light .card-hscroll__btn + .card-hscroll__btn {
  border-left-color: rgba(0, 0, 0, 0.35);
}

.card-hscroll.is-history.is-history-light .card-hscroll__btn::before {
  background: rgba(0, 0, 0, 0.06);
}

.card-hscroll.is-history.is-history-light .card-hscroll__btn:hover:not(:disabled) {
  color: #000;
  border-color: rgba(0, 0, 0, 0.75);
}

.card-hscroll__btn {
  flex: 1 1 33.333%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: calc(10 * var(--ui-scale) * 1px);
  margin: 0;
  padding: 0 calc(16 * var(--ui-scale) * 1px);
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: calc(15 * var(--ui-scale) * 1px);
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.card-hscroll__btn + .card-hscroll__btn {
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.card-hscroll > *,
.card-hscroll__btn > * {
  position: relative;
  z-index: 1;
}

.card-hscroll__arrow {
  font-size: calc(22 * var(--ui-scale) * 1px);
  line-height: 1;
  font-weight: 500;
}

.card-hscroll__btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.card-hscroll.is-idle .card-hscroll__btn:not(.card-hscroll__btn--confirm) {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}

.card-page {
  flex: 1;
  width: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  overflow-x: hidden;
  scrollbar-width: none;
  touch-action: pan-y;
}

.card-page::-webkit-scrollbar {
  display: none;
}

.card-grid {
  display: flex;
  align-items: center;
  gap: var(--tile-gap);
  flex-shrink: 0;
  margin: 0;
  min-height: calc(var(--tile-height) * var(--tile-focus-scale));
  padding: 0 calc(var(--tile-gap) * 2.5);
  padding-right: max(var(--tile-gap), calc(100% - var(--tile-width) - var(--tile-gap) * 2.5));
}

.content-card {
  position: relative;
  flex: 0 0 auto;
  width: var(--tile-width);
  height: var(--tile-height);
  display: block;
  background: #111;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: default;
  color: var(--text);
  font-family: inherit;
  scroll-snap-align: start;
  transform: scale(1);
  transform-origin: center center;
  transition:
    transform 0.32s cubic-bezier(0.25, 0.1, 0.25, 1),
    border-color 0.2s ease,
    box-shadow 0.32s ease;
  z-index: 1;
}

.content-card.is-focus {
  transform: scale(var(--tile-focus-scale));
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 calc(28 * var(--ui-scale) * 1px) rgba(0, 0, 0, 0.35);
  z-index: 3;
  cursor: pointer;
}

.content-card:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.content-card__image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* 커버 카드: 기본=cover, 포커스(첫 슬롯)=image */
.content-card--cover,
.content-card--news {
  background: transparent;
}

.content-card--cover .content-card__glass,
.content-card--news .content-card__glass {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  transition: opacity 0.28s ease;
}

.content-card--cover .content-card__cover,
.content-card--news .content-card__cover {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.28s ease;
}

.content-card--cover .content-card__image,
.content-card--news .content-card__image {
  z-index: 2;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.content-card--cover.is-focus .content-card__image,
.content-card--news.is-focus .content-card__image {
  opacity: 1;
}

.content-card--cover.is-focus .content-card__glass,
.content-card--cover.is-focus .content-card__cover,
.content-card--news.is-focus .content-card__glass,
.content-card--news.is-focus .content-card__cover {
  opacity: 0;
}

.bottom-nav {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  width: 100%;
  height: var(--bottom-zone-h);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: var(--nav-btn-gap);
  padding: var(--nav-gap-top) var(--side-padding) var(--nav-bottom-space);
  pointer-events: none;
}

.bottom-nav .nav-btn {
  pointer-events: auto;
}

.nav-btn {
  flex: 0 0 auto;
  width: var(--nav-btn-width);
  height: var(--nav-btn-height);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--nav-btn-gap-inner);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: calc(2 * var(--ui-scale) * 1px) solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  padding: var(--nav-btn-padding);
}

.nav-btn > * {
  position: relative;
  z-index: 1;
}

.nav-btn--active {
  color: var(--text);
  background: rgba(18, 20, 28, 0.82);
  border-color: var(--border-active);
}

.nav-btn__icon {
  width: var(--nav-icon-size);
  height: var(--nav-icon-size);
  flex-shrink: 0;
}

.nav-btn__label {
  font-size: var(--nav-label-size);
  letter-spacing: 0.02em;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

/* ============================================================
   세로로 긴(좁은) 화면 — layout.js data-mode="narrow"
   페이지는 뷰포트 전체 높이, UI는 폭 기준 가독 스케일
   ============================================================ */
html[data-mode='narrow'] {
  --side-padding: max(14px, env(safe-area-inset-left, 0px));
  --home-panel-gap: max(10px, calc(10 * var(--ui-scale) * 1px));
  --top-height: calc(
    max(52px, calc(0.72 / 9 * 1080 * var(--ui-scale) * 1px)) +
      env(safe-area-inset-top, 0px)
  );
  --tile-gap-top: max(12px, calc(0.55 / 9 * 1080 * var(--ui-scale) * 1px));
  --card-hscroll-block: calc(
    var(--top-height) + var(--home-panel-gap) * 2 + calc(52 * var(--ui-scale) * 1px)
  );
  --tile-focus-scale: 1.02;
  --tile-gap: max(10px, calc(12 * var(--ui-scale) * 1px));
  --tile-title-size: max(15px, calc(20 * var(--ui-scale) * 1px));
  --bottom-zone-h: max(
    72px,
    calc(1.6 / 9 * 1080 * var(--ui-scale) * 1px) + env(safe-area-inset-bottom, 0px)
  );
  --nav-btn-width: min(28vw, calc(160 * var(--ui-scale) * 1px));
  --nav-btn-height: max(48px, calc(1.05 / 9 * 1080 * var(--ui-scale) * 1px));
  --nav-btn-gap: max(10px, calc(16 * var(--ui-scale) * 1px));
  --top-nav-btn-font: max(13px, calc(15 * var(--ui-scale) * 1px));
  --top-nav-btn-padding-x: max(10px, calc(12 * var(--ui-scale) * 1px));
}

html[data-mode='narrow'] .viewport,
html[data-mode='narrow'] .viewport__frame {
  width: 100%;
  height: 100%;
  height: 100dvh;
}

html[data-mode='narrow'] .background {
  height: 100%;
}

/* ── 상단 바: 로고 + 가로 스크롤 네비 ── */
html[data-mode='narrow'] .top-bar {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  column-gap: 10px;
  overflow: visible;
}

html[data-mode='narrow'] .top-bar__right:empty {
  display: none;
}

html[data-mode='narrow'] .top-bar__logo {
  height: max(28px, calc(36 * var(--ui-scale) * 1px));
}

html[data-mode='narrow'] .top-bar__nav {
  justify-self: stretch;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}

html[data-mode='narrow'] .top-bar__nav::-webkit-scrollbar {
  display: none;
}

html[data-mode='narrow'] .top-nav-btn {
  flex: 1 0 auto;
  min-width: max(56px, calc(64 * var(--ui-scale) * 1px));
  min-height: 44px;
  padding: 0 max(8px, var(--top-nav-btn-padding-x));
}

html[data-mode='narrow'] .card-hscroll--fixed,
html[data-mode='narrow'] .card-hscroll {
  margin-left: max(var(--home-panel-gap), env(safe-area-inset-left, 0px));
  margin-right: max(var(--home-panel-gap), env(safe-area-inset-right, 0px));
}

/* ── 홈 하단 패널 ── */
html[data-mode='narrow'] .home-panel {
  padding-bottom: max(
    var(--home-panel-gap),
    calc(env(safe-area-inset-bottom, 0px) + 8px)
  );
  padding-left: max(var(--home-panel-gap), env(safe-area-inset-left, 0px));
  padding-right: max(var(--home-panel-gap), env(safe-area-inset-right, 0px));
  max-height: min(58dvh, calc(100% - var(--top-height) - 12px));
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  pointer-events: auto;
}

html[data-mode='narrow'] .home-panel--hidden {
  pointer-events: none;
}

html[data-mode='narrow'] .home-panel::-webkit-scrollbar {
  display: none;
}

/* 뉴스: 좁은 폭에서는 라벨 위 + 헤드라인 아래 */
html[data-mode='narrow'] .home-news {
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  border-radius: max(10px, calc(12 * var(--ui-scale) * 1px));
}

html[data-mode='narrow'] .home-news__label {
  justify-content: flex-start;
  padding: max(8px, calc(10 * var(--ui-scale) * 1px))
    max(14px, calc(16 * var(--ui-scale) * 1px));
  border-right: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: max(12px, calc(13 * var(--ui-scale) * 1px));
}

html[data-mode='narrow'] .home-news__headline {
  padding: max(10px, calc(12 * var(--ui-scale) * 1px))
    max(14px, calc(16 * var(--ui-scale) * 1px));
  font-size: max(13px, calc(14 * var(--ui-scale) * 1px));
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* 피처: 2×2 — 곡률은 컨테이너, 구분선은 셀 border */
html[data-mode='narrow'] .home-features {
  --home-features-radius: max(12px, calc(14 * var(--ui-scale) * 1px));
  --home-features-line: rgba(255, 255, 255, 0.22);
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 0;
  min-height: 0;
  border-radius: var(--home-features-radius);
  overflow: hidden;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid rgba(255, 255, 255, 0.1);
}

html[data-mode='narrow'] .home-feature {
  min-height: max(112px, calc(118 * var(--ui-scale) * 1px));
  gap: max(6px, calc(8 * var(--ui-scale) * 1px));
  padding: max(14px, calc(16 * var(--ui-scale) * 1px))
    max(12px, calc(14 * var(--ui-scale) * 1px))
    max(12px, calc(14 * var(--ui-scale) * 1px));
  margin: 0;
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 0 solid var(--home-features-line) !important;
  border-radius: 0 !important;
  box-shadow: none;
}

html[data-mode='narrow'] .home-feature:nth-child(1 of .home-feature) {
  border-right-width: 1px !important;
  border-bottom-width: 1px !important;
}

html[data-mode='narrow'] .home-feature:nth-child(2 of .home-feature) {
  border-bottom-width: 1px !important;
}

html[data-mode='narrow'] .home-feature:nth-child(3 of .home-feature) {
  border-right-width: 1px !important;
}

html[data-mode='narrow'] .home-feature:hover,
html[data-mode='narrow'] .home-feature:active {
  border-color: var(--home-features-line) !important;
}

html[data-mode='narrow'] .home-feature__title {
  font-size: max(14px, calc(16 * var(--ui-scale) * 1px));
}

html[data-mode='narrow'] .home-feature__desc {
  font-size: max(12px, calc(12.5 * var(--ui-scale) * 1px));
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

html[data-mode='narrow'] .home-feature__cta {
  font-size: max(12px, calc(13 * var(--ui-scale) * 1px));
}

/* ── 카드 페이지 ── */
html[data-mode='narrow'] .page {
  padding-left: 0;
  padding-right: 0;
}

html[data-mode='narrow'] .page--cards {
  padding-top: var(--card-hscroll-block);
  padding-bottom: var(--narrow-home-panel-h, 0px);
  min-height: 100dvh;
  box-sizing: border-box;
  flex: 1 0 auto;
  overflow: hidden;
}

html[data-mode='narrow'] .card-page {
  flex: 0 0 auto;
  height: var(--narrow-card-slot-h, auto);
  max-height: var(--narrow-card-slot-h, auto);
  min-height: 0;
  align-items: center;
  overflow-x: hidden;
  overflow-y: hidden;
}

html[data-mode='narrow'] .card-grid {
  width: max-content;
  height: 100%;
  min-height: calc(var(--tile-height, 200px) * var(--tile-focus-scale));
  align-items: center;
  padding-left: calc((100% - var(--tile-width, 50vw)) / 2);
  padding-right: calc((100% - var(--tile-width, 50vw)) / 2);
}

html[data-mode='narrow'] .content-card {
  width: var(--tile-width, auto);
  height: var(--tile-height, auto);
}

html[data-mode='narrow'] .content-card.is-focus {
  z-index: 2;
  transform: scale(var(--tile-focus-scale));
}

/* ── 하단 네비 ── */
html[data-mode='narrow'] .bottom-nav {
  top: auto;
  bottom: 0;
  height: auto;
  min-height: var(--bottom-zone-h);
  padding: max(8px, var(--nav-gap-top))
    max(12px, env(safe-area-inset-left, 0px))
    max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px))
    max(12px, env(safe-area-inset-right, 0px));
  flex-wrap: wrap;
  gap: var(--nav-btn-gap);
  align-items: center;
}

html[data-mode='narrow'] .nav-btn {
  min-height: 48px;
}

/* 아주 좁은 폰: 피처 1열 */
@media (max-width: 360px) {
  html[data-mode='narrow'] .home-features {
    grid-template-columns: 1fr;
  }

  html[data-mode='narrow'] .home-feature {
    min-height: max(96px, calc(100 * var(--ui-scale) * 1px));
    border-right-width: 0 !important;
    border-bottom-width: 0 !important;
  }

  html[data-mode='narrow'] .home-feature:not(:last-child) {
    border-bottom-width: 1px !important;
  }
}

/* 터치 기기: 호버 글로우를 누르는 동안만 */
@media (hover: none) {
  .top-nav-btn:hover,
  .home-feature:hover,
  .home-news:hover,
  .nav-btn:hover {
    color: inherit;
    border-color: inherit;
    box-shadow: none;
  }

  .top-nav-btn:hover::before,
  .home-feature:hover::before,
  .home-news:hover::before,
  .nav-btn:hover::before {
    opacity: 0;
  }

  .top-nav-btn:active,
  .home-feature:active,
  .home-news:active,
  .nav-btn:active {
    color: var(--glow-text-on);
    border-color: var(--glow-strong);
    box-shadow: var(--glow-skeuo-full);
    transition:
      color var(--glow-on-dur) ease-in,
      border-color var(--glow-on-dur) ease-in,
      box-shadow var(--glow-on-dur) ease-in;
  }

  .top-nav-btn:active::before,
  .home-feature:active::before,
  .home-news:active::before,
  .nav-btn:active::before {
    opacity: 1;
    transition: opacity var(--glow-on-dur) ease-in;
  }

  .home-news:active .home-news__label {
    background: rgba(255, 255, 255, 0.14);
    color: var(--glow-text-on);
  }

  .home-news:active .home-news__headline {
    color: var(--glow-text-on);
  }

  .home-feature:active .home-feature__desc {
    color: var(--glow-text-muted-on);
  }

  .home-feature:active .home-feature__cta {
    color: var(--glow-text-on);
  }
}

