/* 메인 페이지 공용 스타일 (루트, apps/, apps/<앱>/, about/, support/)
   색·글꼴·여백 변수는 theme.css. 브레이크포인트는 900 / 768 / 480px.

   1. 기본          2. 레이아웃      3. 글자         4. 버튼·전환 버튼
   5. 홈            6. 페이지 머리    7. 앱 목록      8. 지원
   9. 소개          10. 앱 상세      11. 스크린샷 줄  12. 라이트박스 */

/* ---------- 1. 기본 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 한국어는 Pretendard + 단어 단위 줄바꿈 (일본어에 keep-all을 걸면 줄바꿈이 깨지므로 ko에만) */
:lang(ko) {
  font-family: var(--font-ko);
  word-break: keep-all;
}

:lang(ja) {
  font-family: var(--font-ja);
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: var(--ink);
  text-underline-offset: 4px;
}

a:hover {
  color: var(--link-hover);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- 2. 레이아웃 ---------- */
/* 파셜이 들어오기 전에도 헤더 자리를 잡아 두어 내용이 밀리지 않게 함 */
#site-header {
  min-height: var(--header-h);
}

main {
  flex: 1;
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

/* 헤더 다음 큰 제목으로 시작하는 페이지(앱 목록·지원·소개) */
.page {
  display: flex;
  flex-direction: column;
  gap: 72px;
  padding-top: 96px;
  padding-bottom: 112px;
}

/* 위에 구분선이 있는 두 단 (제목 4 : 내용 8) */
.split {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

@media (max-width: 900px) {
  .page {
    gap: 56px;
    padding-top: 64px;
    padding-bottom: 88px;
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
}

/* ---------- 3. 글자 ---------- */
.g-display,
.g-title,
.g-h2 {
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

/* 홈 한 문장 */
.g-display {
  font-size: clamp(48px, 9.4vw, 136px);
}

/* 페이지 제목 (앱 목록·지원·앱 이름) */
.g-title {
  font-size: clamp(46px, 7.2vw, 104px);
}

/* 긴 페이지 제목 (소개) */
.g-title--long {
  font-size: clamp(42px, 6.1vw, 88px);
  line-height: 1;
  max-width: 1100px;
}

.g-h2 {
  font-size: clamp(34px, 3.6vw, 52px);
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.g-h2--sm {
  font-size: clamp(28px, 2.4vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

/* 한글 제목은 글자 폭이 넓어 자간을 덜 줄임 */
.g-display:lang(ko),
.g-title:lang(ko),
.g-h2:lang(ko) {
  letter-spacing: -0.035em;
  line-height: 1.12;
}

.g-lede {
  max-width: 620px;
  color: var(--text-body);
  font-size: 19px;
  line-height: 1.6;
}

.g-text {
  color: var(--text-body);
  font-size: 17px;
  line-height: 1.6;
}

.g-text a,
.g-lede a {
  font-weight: 500;
}

/* 작은 회색 소제목 (지원 페이지 정보 칸 등) */
.g-label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

@media (max-width: 768px) {
  .g-lede {
    font-size: 17px;
  }
}

/* ---------- 4. 버튼·전환 버튼 ---------- */
.g-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 26px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: #ffffff;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.g-btn:hover {
  border-color: var(--link-hover);
  background: var(--link-hover);
  color: #ffffff;
}

.g-btn--outline {
  border-color: var(--border-button);
  background: transparent;
  color: var(--ink);
}

.g-btn--outline:hover {
  border-color: var(--link-hover);
  background: transparent;
  color: var(--link-hover);
}

/* 언어·기기 전환 버튼 묶음: 고른 버튼은 aria-pressed="true" */
.g-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-segment);
  font-size: 15px;
}

.g-seg button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-body);
  font: inherit;
  cursor: pointer;
}

.g-seg button:hover {
  color: var(--ink);
}

.g-seg button[aria-pressed="true"] {
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 25, 30, 0.12);
}

/* ---------- 5. 홈: 한 문장과 두 갈래 길 ---------- */
.home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 48px;
  padding-top: 56px;
  padding-bottom: 56px;
}

.home-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

.home-row .g-lede {
  max-width: 560px;
  line-height: 1.55;
}

/* 버튼 두 개는 한 줄로 두고 설명 문단이 줄어들게 함 */
.home-row .g-actions {
  flex: none;
}

/* 홈은 위 구분선이 이미 있어서 푸터 선을 지움 */
.is-home .g-footer-row {
  border-top-color: transparent;
}

@media (max-height: 700px) {
  .home {
    gap: 36px;
    padding-top: 32px;
    padding-bottom: 32px;
  }
}

@media (max-width: 768px) {
  .home-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---------- 6. 페이지 머리: 큰 제목 + 한두 문장 ---------- */
.page-head {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- 7. 앱 목록: 행 전체가 그 앱 페이지로 가는 링크 ---------- */
.app-list {
  border-top: 1px solid var(--rule);
}

.app-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 4fr) minmax(0, 6fr) minmax(0, 2fr);
  align-items: center;
  gap: 32px;
  padding: 28px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.app-row:hover {
  background: var(--bg-hover);
  color: var(--ink);
}

.app-row:hover .app-row-name {
  color: var(--link-hover);
}

.app-row-icon {
  width: 88px;
  height: 88px;
  border-radius: 22.5%;
}

.app-row-name {
  font-size: 34px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.app-row-name:lang(ko) {
  font-size: 31px;
  letter-spacing: -0.04em;
}

.app-row-desc {
  color: var(--text-body);
  font-size: 17px;
  line-height: 1.55;
}

.app-row-desc:lang(ko) {
  font-size: 16px;
  line-height: 1.65;
}

.app-row-platform {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.4;
  text-align: right;
}

@media (max-width: 900px) {
  .app-row {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 6px 18px;
    align-items: start;
  }

  .app-row-icon {
    grid-row: span 3;
    width: 64px;
    height: 64px;
  }

  .app-row > :not(.app-row-icon) {
    grid-column: 2;
  }

  .app-row-name,
  .app-row-name:lang(ko) {
    font-size: 26px;
  }

  .app-row-platform {
    text-align: left;
  }
}

@media (max-width: 480px) {
  .app-row {
    padding-left: 0;
    padding-right: 0;
  }
}

/* ---------- 8. 지원: 큰 메일 주소 + 정보 세 칸 ---------- */
.mail {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.mail-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 28px;
}

.mail-link {
  font-size: clamp(24px, 3.4vw, 48px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
  overflow-wrap: anywhere;
}

.mail-copy {
  min-height: 48px;
  padding: 0 22px;
}

.mail-copy.is-copied {
  border-color: var(--ink);
}

/* 위에 구분선이 있는 정보 칸 묶음 (지원 페이지, 미롱이 개인정보 요약) */
.facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--rule);
}

.facts p {
  font-size: 18px;
  line-height: 1.55;
}

.facts .facts-sub {
  margin-top: 6px;
  color: var(--text-body);
  font-size: 16px;
}

/* 서울 현재 시각 기준 지원 시간 여부 (support 페이지 스크립트가 채움) */
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-button);
}

.status[hidden] {
  display: none;
}

.status.is-open::before {
  background: var(--ok);
}

@media (max-width: 900px) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
}

/* ---------- 9. 소개: 만드는 곳 네 칸 ---------- */
.platforms {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
}

.platform {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--rule);
}

.platform svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.platform h3 {
  font-size: 21px;
  font-weight: 500;
  line-height: 1.3;
}

.platform p {
  color: var(--text-body);
  font-size: 16px;
  line-height: 1.6;
}

.statement {
  max-width: 720px;
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1.55;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

@media (max-width: 900px) {
  .platforms {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .statement {
    font-size: 19px;
  }
}

@media (max-width: 480px) {
  .platforms {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- 10. 앱 상세 ---------- */
/* 히어로: 왼쪽 이름·한 문장·받기 버튼, 오른쪽 대표 화면 하나 */
.app-hero {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
  align-items: center;
  gap: 72px;
  padding-top: 56px;
  padding-bottom: 96px;
}

/* 가로(4:3) 화면을 쓰는 앱(Hoverly)은 화면 칸을 넓게 */
.app-hero--landscape {
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
}

.app-hero-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 28px;
}

.app-topline {
  align-self: stretch;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-back {
  color: var(--text-body);
  font-size: 15px;
}

.app-icon {
  width: 104px;
  height: 104px;
  border-radius: 22.5%;
}

/* Hoverly 아이콘은 원래 원형 */
.app-icon--round,
.app-row-icon--round {
  border-radius: 50%;
}

.app-sub {
  max-width: 600px;
  color: var(--text-strong);
  font-size: 22px;
  line-height: 1.5;
}

.app-get {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.store-badge {
  width: auto;
  height: 52px;
}

.store-badge--lg {
  height: 56px;
}

.app-platform {
  color: var(--text-muted);
  font-size: 15px;
}

.app-hero-shot {
  width: 100%;
  border-radius: 28px;
  /* 흰 바탕 스크린샷(HabitLog 등)도 가장자리가 보이도록 아주 옅은 테두리 */
  box-shadow: 0 0 0 1px rgba(23, 25, 30, 0.08);
}

.app-hero--landscape .app-hero-shot {
  border-radius: 24px;
}

/* 본문 구역: 아래 여백으로 구분 */
.app-section {
  display: flex;
  flex-direction: column;
  gap: 40px;
  padding-bottom: 96px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
}

.section-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* 기능: 이름과 한두 문장, 두 단 */
.features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 64px;
}

.feature {
  min-width: 0;
  padding: 24px 0 28px;
  border-top: 1px solid var(--rule);
}

.feature h3 {
  margin-bottom: 8px;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.3;
}

.feature p {
  color: var(--text-body);
  font-size: 17px;
  line-height: 1.6;
}

.app-note {
  max-width: 760px;
}

.app-note--small {
  font-size: 14px;
  color: var(--text-muted);
}

/* 받기: 위 구분선 + 한 문장 + 큰 배지 */
.app-download {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding-top: 64px;
  padding-bottom: 72px;
  border-top: 1px solid var(--rule);
}

.app-download-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.app-download-copy p {
  color: var(--text-body);
  font-size: 18px;
}

/* 이 앱의 개인정보처리방침·약관 (기존 경로 그대로 연결) */
.legal {
  padding-top: 56px;
  padding-bottom: 88px;
}

.legal-rows {
  display: flex;
  flex-direction: column;
}

.legal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
  text-decoration: none;
}

.legal-row-title {
  font-size: 21px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}

.legal-row-desc {
  color: var(--text-body);
  font-size: 16px;
}

.legal-row:hover .legal-row-title {
  color: var(--link-hover);
}

.legal-rows .g-text {
  margin-top: 20px;
  font-size: 16px;
}

@media (max-width: 900px) {
  .app-hero,
  .app-hero--landscape {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
    padding-top: 32px;
    padding-bottom: 72px;
  }

  .app-hero-shot {
    max-width: 320px;
  }

  .app-hero--landscape .app-hero-shot {
    max-width: 640px;
  }

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

  .app-section {
    gap: 32px;
    padding-bottom: 72px;
  }

  .app-download {
    padding-top: 48px;
    padding-bottom: 56px;
  }

  .legal {
    padding-top: 40px;
    padding-bottom: 64px;
  }
}

@media (max-width: 768px) {
  .legal-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .app-icon {
    width: 88px;
    height: 88px;
  }

  .app-sub {
    font-size: 19px;
  }

  .app-hero-shot {
    max-width: 260px;
  }
}

/* ---------- 11. 스크린샷 줄: 가로로 넘겨 보기 ---------- */
/* --fit: 한 화면에 꽉 차게 보이는 장 수. 세로 화면 4장, 가로(Duo·iPad·visionOS) 화면 2장
   --peek: 스크린샷이 더 있을 때 다음 장이 오른쪽 끝에 보이는 만큼 (site.js가 .has-more를 붙임)
   --per: 실제로 한 화면에 들어가는 장 수 */
.shots {
  --fit: 4;
  --peek: 0.4;
  --per: var(--fit);
  --gap: 16px;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: calc((100% - (var(--per) - 1) * var(--gap)) / var(--per));
  align-items: start;
  gap: var(--gap);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  padding-bottom: 12px;
  scrollbar-width: thin;
}

.shots[data-device="duo"],
.shots[data-device="ipad"],
.shots--landscape {
  --fit: 2;
  --peek: 0.22;
}

.shots.has-more {
  --per: calc(var(--fit) + var(--peek));
}

/* site.js가 아래 진행 막대를 붙이면 기본 스크롤바는 숨긴다 (JS가 없으면 기본 스크롤바 그대로) */
.shots.is-enhanced {
  padding-bottom: 2px;
  scrollbar-width: none;
}

.shots.is-enhanced::-webkit-scrollbar {
  display: none;
}

.shots > figure {
  min-width: 0;
  scroll-snap-align: start;
}

.shots > figure[hidden] {
  display: none;
}

.shots img {
  width: 100%;
  border-radius: 20px;
  background: var(--bg-segment);
  box-shadow: 0 0 0 1px rgba(23, 25, 30, 0.08);
}

/* 넘기기 버튼 (넘칠 때만 site.js가 보여 줌) */
.shots-nav {
  display: flex;
  gap: 8px;
}

.shots-nav[hidden] {
  display: none;
}

@media (hover: none) {
  .shots-nav {
    display: none;
  }
}

.shots-nav button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--border-button);
  border-radius: 50%;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

.shots-nav button:hover:not(:disabled) {
  border-color: var(--link-hover);
  color: var(--link-hover);
}

.shots-nav button:disabled {
  opacity: 0.35;
  cursor: default;
}

/* 진행 막대: 전체 중 지금 보이는 부분과 위치. 스크린샷이 더 있다는 걸 터치 기기에서도 보여 준다 */
.shots-progress {
  position: relative;
  height: 3px;
  margin-top: 20px;
  border-radius: 3px;
  background: var(--rule);
  overflow: hidden;
}

.shots-progress[hidden] {
  display: none;
}

.shots-progress > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: var(--ink);
}

.shot {
  cursor: zoom-in;
}

/* 좁은 화면은 원래부터 다음 장이 걸쳐 보이도록 장 수를 소수로 둔다 */
@media (max-width: 900px) {
  .shots {
    --fit: 2.4;
    --peek: 0;
  }

  .shots[data-device="duo"],
  .shots[data-device="ipad"],
  .shots--landscape {
    --fit: 1.25;
    --peek: 0;
  }

  .shots img {
    border-radius: 16px;
  }
}

@media (max-width: 480px) {
  .shots {
    --fit: 1.6;
    --gap: 12px;
  }

  .shots[data-device="duo"],
  .shots[data-device="ipad"],
  .shots--landscape {
    --fit: 1.1;
  }

  .shots-progress {
    margin-top: 16px;
  }
}

/* ---------- 12. 라이트박스 (site.js가 만듦) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(23, 25, 30, 0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  cursor: zoom-out;
}

.lightbox.open {
  opacity: 1;
  pointer-events: auto;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
}

@media (prefers-reduced-motion: reduce) {
  .g-btn,
  .app-row,
  .lightbox {
    transition: none;
  }
}
