:root {
  --bg: #ffffff;
  --paper: #ffffff;
  --ink: #182230;
  --muted: #526070;
  --line: #e4e7ec;
  --accent: #1b2a6b;
  --accent-ink: #ffffff;
  --danger: #8d2f2a;
  color-scheme: light;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  min-height: 100vh;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
.skip {
  position: absolute; left: 12px; top: -40px; background: var(--ink); color: var(--accent-ink);
  padding: 8px 12px; z-index: 5;
}
.skip:focus { top: 8px; }

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}
.top {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg);
  padding: 12px 16px 10px;
  padding-top: calc(12px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
}
.brand {
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-size: 1.15rem;
}
.brand-note { margin: 4px 0 0; color: var(--muted); font-size: 0.86rem; }
main { padding: 4px 16px 24px; }
main:focus { outline: none; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  text-align: center;
  text-decoration: none;
  min-height: 48px;
  padding: 14px 4px 12px;
  color: var(--muted);
  font-size: 0.95rem;
}
.tabs a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

.hero h1 {
  margin: 14px 0 4px;
  font-size: 1.45rem;
  letter-spacing: -0.04em;
  line-height: 1.25;
}
.lead { margin: 0 0 12px; color: var(--muted); line-height: 1.5; font-size: 0.92rem; }
.stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px;
}
.stat, .card, .item, .panel {
  background: var(--paper);
  border: 1px solid var(--line);
}
.stat { padding: 10px 12px; }
.stat b { display: block; font-size: 1.35rem; letter-spacing: -0.04em; }
.stat span { color: var(--muted); font-size: 0.82rem; }
.caption { color: var(--muted); font-size: 0.78rem; line-height: 1.45; margin: 6px 0 12px; }

.topics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px;
}
.topics button, .text-button, .primary, .bookmark {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}
.topics button { white-space: nowrap; flex: 0 0 auto; min-height: 40px; }
.topics button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--accent-ink);
  border-color: var(--ink);
}
.section-label {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 8px 0 10px;
}
.section-label h2 { margin: 0; font-size: 1rem; }
.section-label span, .meta { color: var(--muted); font-size: 0.8rem; }

.list { display: grid; gap: 10px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px; }
.item a { text-decoration: none; }
.item h3 { margin: 4px 0; font-size: 1.12rem; letter-spacing: -0.03em; line-height: 1.4; }
.item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.bookmark { min-height: 40px; padding: 8px 12px; align-self: start; font-size: 0.82rem; }
.bookmark[aria-pressed="true"] { background: var(--ink); color: var(--accent-ink); border-color: var(--ink); }
.mode { margin-left: 6px; }

.panel { padding: 16px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 6px; font-size: 1.05rem; }
.panel a { color: var(--accent); }
.panel p { margin: 0; color: var(--muted); line-height: 1.55; }
.follow {
  display: block;
  margin-top: 14px;
  padding: 14px 16px;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
}
.follow span { color: var(--muted); font-size: 0.8rem; }
.follow strong { display: block; margin-top: 4px; font-size: 1.02rem; letter-spacing: -0.03em; line-height: 1.4; }
.primary {
  display: inline-block;
  margin-top: 12px;
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  text-decoration: none;
  border-radius: 999px;
  min-height: 44px;
  padding: 10px 16px;
}
.channels { display: grid; gap: 10px; }
.channel {
  display: block;
  text-decoration: none;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 14px;
}
.channel strong { display: block; margin: 2px 0; }
.channel span { color: var(--muted); font-size: 0.82rem; }

.search {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 16px;
  padding: 14px;
  margin: 8px 0 14px;
}
.article h1 { font-size: 1.5rem; letter-spacing: -0.03em; line-height: 1.35; margin: 12px 0 8px; scroll-margin-top: 76px; }
.read-tools { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 14px; }
.read-tools .meta { margin: 0; }
.prose { font-size: 1.075rem; line-height: 1.8; }
.prose p { margin: 0 0 0.9em; }
.prose h2, .prose h3 { font-size: 1.08rem; margin: 1.2em 0 0.4em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose a { color: var(--accent); }
.back { color: var(--muted); text-decoration: none; font-size: 0.88rem; }
.stack { display: grid; gap: 10px; margin-top: 10px; }
.stack a.panel { text-decoration: none; display: block; }
.warn { color: var(--danger); }
.empty { color: var(--muted); line-height: 1.55; }
.item.is-current { border-color: var(--ink); }

/* 갤럭시 폴드7 접힘 412×960. 펼침은 750×832(DPR 2.625) 또는 984×1092(DPR 2). */
@media (min-width: 720px) and (min-height: 700px) {
  .shell { width: min(1040px, 100%); }
  .list { grid-template-columns: 1fr 1fr; }
  .fold-list .list { grid-template-columns: 1fr; }
  .channels { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 1.7rem; }
  .prose { max-width: 40rem; font-size: 1.125rem; }
}
@media (min-width: 900px) and (min-height: 700px) {
  .shell { width: min(1120px, 100%); }
  .fold {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
  }
  .fold-list {
    position: sticky;
    top: 76px;
    max-height: calc(100vh - 168px);
    overflow: auto;
  }
}
@media (horizontal-viewport-segments: 2) {
  .fold {
    display: grid;
    grid-template-columns: env(viewport-segment-width 0 0) minmax(0, 1fr);
    column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0));
    align-items: start;
  }
  .fold-list { max-height: calc(100vh - 168px); overflow: auto; }
}
