/* ==========================================================================
   황금나이 — 공통 스타일
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;   /* iOS 가로 회전 시 글자 확대 방지 */
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;      /* 당겨서 새로고침 차단 */
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* 키보드 접근성 — 포커스가 반드시 보여야 합니다 */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--c-orange);
  outline-offset: 2px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* PC에서도 모바일 폭 유지 */
.wrap {
  max-width: var(--content-w);
  margin: 0 auto;
  background: var(--c-bg);
  min-height: 100vh;
}

/* --- 헤더 ------------------------------------------------------------ */
.hd {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3);
  height: var(--header-h);
  padding: 0 var(--sp-4);
  background: var(--c-bg);
  border-bottom: 1px solid var(--c-line);
}

.hd__logo {
  font-size: var(--fs-xl);
  font-weight: 700;
  color: var(--c-orange);
  letter-spacing: -0.4px;
}

.hd__right { display: flex; align-items: center; gap: var(--sp-2); }

.hd__fs {
  display: inline-flex; align-items: center;
  min-height: 38px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--c-text-sub);
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
}
.hd__fs:active { background: var(--c-bg-gap); }

.hd__bell {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  font-size: 24px; line-height: 1;
  background: none; border: 0;
}
.hd__bell-dot {
  position: absolute; top: 7px; right: 8px;
  width: 9px; height: 9px;
  background: var(--c-danger);
  border: 2px solid var(--c-bg);
  border-radius: 50%;
}

/* --- 섹션 ------------------------------------------------------------ */
.gap { height: 8px; background: var(--c-bg-gap); }

.sec__hd {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: var(--sp-5) var(--sp-4) var(--sp-3);
}
.sec__title { font-size: var(--fs-lg); font-weight: 700; }
.sec__more  { font-size: var(--fs-sm); color: var(--c-text-mute); }

/* --- 오늘의 좋은글 --------------------------------------------------- */
.feat {
  display: block;
  padding: var(--sp-4);
  background: var(--c-orange-bg);
  border-bottom: 1px solid var(--c-line);
}
.feat__badge {
  display: inline-block;
  margin-bottom: var(--sp-3);
  padding: 4px 10px;
  font-size: var(--fs-sm);
  color: #fff;
  background: var(--c-orange);
  border-radius: var(--radius-sm);
}
.feat__title {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-xl);
  font-weight: 700;
  line-height: var(--lh-tight);
}
.feat__excerpt {
  margin: 0;
  font-size: var(--fs-base);
  color: var(--c-text-sub);
  line-height: var(--lh-base);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- 글 목록 행 ------------------------------------------------------ */
.row {
  display: flex; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-height: var(--tap-min);
}
.row + .row { border-top: 1px solid var(--c-line); }
.row:active { background: var(--c-bg-gap); }

.row__thumb {
  flex: 0 0 78px;
  width: 78px; height: 78px;
  background: var(--c-bg-thumb);
  border-radius: var(--radius);
  object-fit: cover;
}
.row__body { flex: 1; min-width: 0; }
.row__title {
  margin: 0 0 var(--sp-1);
  font-size: var(--fs-md);
  font-weight: 500;
  line-height: var(--lh-tight);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.row__meta {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--c-text-mute);
}

/* --- 사진 그리드 ----------------------------------------------------- */
.grid2 {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2);
  padding: 0 var(--sp-4) var(--sp-5);
}
.grid2 img, .grid2 .ph {
  width: 100%; aspect-ratio: 4 / 3;
  background: var(--c-bg-thumb);
  border-radius: var(--radius);
  object-fit: cover;
}

/* --- 유튜브 ---------------------------------------------------------- */
.vid { display: flex; gap: var(--sp-3); padding: 0 var(--sp-4) var(--sp-5); }
.vid__thumb {
  position: relative;
  flex: 0 0 124px; width: 124px; aspect-ratio: 16 / 9;
  background: var(--c-bg-thumb);
  border-radius: var(--radius);
  object-fit: cover;
}
.vid__play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: var(--c-orange);
}

/* --- 놀이터 ---------------------------------------------------------- */
.game {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  min-height: var(--tap-min);
}
.game + .game { border-top: 1px solid var(--c-line); }
.game:active { background: var(--c-bg-gap); }

.game__ico {
  flex: 0 0 48px;
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px;
  font-size: 25px; color: var(--c-orange);
  background: var(--c-orange-soft);
  border-radius: var(--radius-lg);
}
.game__name { flex: 1; font-size: var(--fs-md); font-weight: 500; }
.game__count {
  padding: 5px 11px;
  font-size: var(--fs-sm);
  color: var(--c-orange);
  background: var(--c-orange-soft);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}
.game__count--empty { color: var(--c-text-mute); background: var(--c-bg-gap); }

/* --- 하단 탭 --------------------------------------------------------- */
.tab {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-template-columns: repeat(6, 1fr);
  max-width: var(--content-w);
  margin: 0 auto;
  background: var(--c-bg);
  border-top: 1px solid var(--c-line-strong);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab__item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 3px;
  height: var(--tabbar-h);
  color: var(--c-text-sub);
}
.tab__item i { font-size: 24px; line-height: 1; }
.tab__label { font-size: var(--fs-xs); }
.tab__item.is-on { color: var(--c-orange); }
.tab__item.is-on .tab__label { font-weight: 700; }

/* --- 빈 상태 --------------------------------------------------------- */
.empty {
  padding: var(--sp-7) var(--sp-4);
  text-align: center;
  color: var(--c-text-sub);
  font-size: var(--fs-base);
}

/* --- 글자크기 선택 시트 ---------------------------------------------- */
.sheet {
  position: fixed; inset: 0; z-index: 100;
  display: none;
  align-items: flex-end;
  background: rgba(0, 0, 0, .45);
}
.sheet.is-open { display: flex; }
.sheet__panel {
  width: 100%; max-width: var(--content-w); margin: 0 auto;
  padding: var(--sp-5) var(--sp-4) calc(var(--sp-5) + env(safe-area-inset-bottom));
  background: var(--c-bg);
  border-radius: 16px 16px 0 0;
}
.sheet__title {
  margin: 0 0 var(--sp-4);
  font-size: var(--fs-lg); font-weight: 700; text-align: center;
}
.sheet__opt {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; min-height: 56px;
  margin-bottom: var(--sp-2); padding: 0 var(--sp-4);
  background: var(--c-bg); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: var(--radius-lg);
  text-align: left;
}
.sheet__opt.is-on { border-color: var(--c-orange); color: var(--c-orange); }
.sheet__opt span:first-child { font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
