/* morven common — fonts, corners, nav, lang toggle */

@font-face {
    font-family: 'Cormorant Garamond';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/CormorantGaramond-Italic.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/CormorantGaramond-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'Cormorant Garamond';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/fonts/CormorantGaramond-SemiBold.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/JetBrainsMono-Regular.woff2') format('woff2');
}
@font-face {
    font-family: 'DM Sans';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/DMSans-Regular.woff2') format('woff2');
}
/* Cairn 5-stack — 한글 serif (body·essay) MaruBuri · 한글 sans (UI·table) NanumSquareNeo · all self-host /fonts/ (CSP font-src 'self') */
@font-face {
    font-family: 'MaruBuri';
    font-style: normal;
    font-weight: 300;
    font-display: swap;
    src: url('/fonts/MaruBuri-Light.woff2') format('woff2');
    unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+3000-303F, U+FF00-FFEF;
}
@font-face {
    font-family: 'MaruBuri';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/MaruBuri-Regular.woff2') format('woff2');
    unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+3000-303F, U+FF00-FFEF;
}
@font-face {
    font-family: 'MaruBuri';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/MaruBuri-Bold.woff2') format('woff2');
    unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+3000-303F, U+FF00-FFEF;
}
@font-face {
    font-family: 'NanumSquareNeo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/fonts/NanumSquareNeo-Regular.woff2') format('woff2');
    unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+3000-303F, U+FF00-FFEF;
}
@font-face {
    font-family: 'NanumSquareNeo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/fonts/NanumSquareNeo-Bold.woff2') format('woff2');
    unicode-range: U+AC00-D7A3, U+1100-11FF, U+3130-318F, U+3000-303F, U+FF00-FFEF;
}

:root { 
    --bg:#0F1511; --text:#EDE6D6; --accent:#6B7A5A; --line:rgba(107,122,90,0.22); --muted:rgba(237,230,214,0.55); 
    /* Apollo R1 §1 verbatim — design tokens */
    --paper-tint: rgba(237, 230, 214, 0.07);
    --hairline: rgba(237, 230, 214, 0.15);
    --serif: 'Cormorant Garamond', 'MaruBuri', Georgia, serif;
    --serif-kr: 'MaruBuri', Georgia, serif;
    --sans-kr: 'NanumSquareNeo', 'DM Sans', sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
    --grain-opacity: 0.03;
    --tr-instant: 150ms ease-out;
    --tr-subtle: 400ms ease-out;
    --radius: 2px;
}

/* corner labels */
.corner {
    position: fixed;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.35em;
    color: var(--text);
    opacity: 0.5;
    z-index: 5;
    text-transform: uppercase;
}
.top-left { top: 32px; left: 32px; }

/* foot-nav — preview/index.html inline과 byte-identical (morven 기준 nav) */
.foot-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
    font-size: 12px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    align-items: center;
    padding: 14px 28px calc(14px + env(safe-area-inset-bottom));
    background: rgba(237, 230, 214, 0.08);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-top: 1px solid rgba(107, 122, 90, 0.28);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .foot-nav { background: rgba(15, 21, 17, 0.92); }
}
.foot-nav a {
    color: #6B7A5A;
    text-decoration: none;
    opacity: 0.82;
    transition: opacity 150ms ease-out, color 150ms ease-out;
    padding: 6px 2px;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
}
.foot-nav a:hover { color: #EDE6D6; opacity: 1; }
.foot-nav a.active { color: #EDE6D6; opacity: 1; pointer-events: none; }
.foot-nav .sep {
    color: rgba(107, 122, 90, 0.4);
    font-size: 9px;
    letter-spacing: 0.4em;
}

/* Apollo R1 §1 verbatim — components */
.gutter-line { position: fixed; top: 0; left: 28px; width: 1px; height: 100dvh; background: var(--text); opacity: 0.1; z-index: 1; pointer-events: none; }
.corner-serif { position: fixed; top: 28px; left: 28px; font-family: var(--serif); font-style: italic; font-size: 13px; letter-spacing: 0.02em; color: var(--text); opacity: 0.7; z-index: 20; pointer-events: none; }
.toolbar { position: sticky; top: 0; z-index: 10; background: rgba(237, 230, 214, 0.08); backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2); padding: 56px 28px 10px; border-bottom: 1px solid var(--line); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .toolbar { background: var(--bg); } }
.toolbar-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.toolbar-row + .toolbar-row { margin-top: 6px; }
.chip { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; background: transparent; color: var(--muted); border: 1px solid rgba(107, 122, 90, 0.28); padding: 6px 12px; border-radius: var(--radius); cursor: pointer; transition: border-color var(--tr-instant), color var(--tr-instant); min-height: 32px; min-width: 36px; white-space: nowrap; }
.chip:hover { color: var(--text); border-color: rgba(237, 230, 214, 0.4); }
.chip.active { color: var(--text); border-color: var(--accent); border-width: 1.5px; }
.search-wrap { position: relative; flex: 1; min-width: 120px; }
.search-wrap input { width: 100%; background: transparent; border: none; border-bottom: 1px solid rgba(107, 122, 90, 0.28); color: var(--text); font-family: var(--serif); font-style: italic; font-size: 16px; padding: 6px 0; outline: none; transition: border-color var(--tr-instant); letter-spacing: 0.01em; box-sizing: border-box; }
.search-wrap input::placeholder { color: var(--text); opacity: 0.45; font-style: italic; }
.search-wrap input:focus { border-color: rgba(237, 230, 214, 0.5); border-width: 1.5px; }
.section { margin-bottom: 32px; }
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; padding-left: 4px; }
.section-label { font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--text); opacity: 0.8; line-height: 1.6em; letter-spacing: 0.01em; }
.time-mark { display: inline-block; background: var(--text); flex-shrink: 0; }
.count-badge { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--text); opacity: 0.6; }
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 480px) { .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; } }
@media (min-width: 768px) { .card-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 1024px) { .card-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 1280px) { .card-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; } }
.card-preview { display: flex; flex-direction: column; text-decoration: none; color: inherit; position: relative; border-radius: var(--radius); overflow: hidden; background: var(--paper-tint); min-height: 120px; }
.card-preview:hover .card-grain { opacity: var(--grain-opacity); }
.card-thumb-wrap { width: 100%; aspect-ratio: 16/10; background: var(--paper-tint); overflow: hidden; position: relative; flex-shrink: 0; }
.card-thumb { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.85; transition: opacity var(--tr-subtle); position: absolute; inset: 0; }
.card-thumb.loaded { opacity: 1; }
.card-glyph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 16px; color: var(--muted); letter-spacing: 0.08em; }
.card-grain { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s ease-out; filter: url(#grain-svg); }
.card-meta { padding: 6px 8px 7px; position: relative; }
.card-slug { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--text); line-height: 1.3; display: block; overflow: hidden; white-space: nowrap; -webkit-mask-image: linear-gradient(to right, black 80%, transparent); mask-image: linear-gradient(to right, black 80%, transparent); }
.card-meta-line { display: flex; align-items: center; justify-content: space-between; margin-top: 3px; border-top: 1px solid rgba(237, 230, 214, 0.15); }
.card-kind { font-family: var(--mono); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--muted); opacity: 0.7; padding-top: 3px; }
.card-ver { font-family: var(--serif); font-style: italic; font-size: 10px; color: var(--text); opacity: 0.5; padding-top: 3px; }
.toast { position: fixed; bottom: calc(24px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--paper-tint); border: 1px solid var(--line); color: var(--text); font-family: var(--serif); font-style: italic; font-size: 13px; padding: 8px 16px; border-radius: var(--radius); pointer-events: none; opacity: 0; z-index: 100; transition: none; backdrop-filter: blur(8px) saturate(1.2); -webkit-backdrop-filter: blur(8px) saturate(1.2); }
.empty-state { padding: 80px 28px; text-align: center; }
.empty-main { font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--text); opacity: 0.7; }
.empty-sub { font-family: var(--mono); font-size: 11px; color: var(--muted); opacity: 0.5; margin-top: 16px; letter-spacing: 0.04em; }
.empty-sub a { color: var(--accent); text-decoration: none; font-style: italic; border-bottom: 1px solid transparent; transition: border-color var(--tr-instant); }
.empty-sub a:hover { border-color: var(--accent); }
.section[data-bucket="archive"] .card-preview { opacity: 0.92; }
.section[data-bucket="archive"] .card-grain { opacity: var(--grain-opacity); }
.section[data-bucket="past30"] .card-preview { opacity: 0.94; }
.section[data-bucket="past7"] .card-preview { opacity: 0.96; }
.section[data-bucket="yesterday"] .card-preview { opacity: 0.98; }
.grid-wrap { padding: 0 28px 160px; margin-top: 24px; position: relative; }
.catalog-footer { padding: 0 28px 48px; text-align: left; }
.catalog-footer p { font-family: var(--serif); font-style: italic; font-size: 13px; color: var(--text); opacity: 0.5; letter-spacing: 0.01em; }

@media (max-width: 479px) {
    .toolbar { padding-top: 48px; padding-left: 16px; padding-right: 16px; }
    .grid-wrap { padding-left: 16px; padding-right: 16px; }
    .corner-serif { top: 16px; left: 16px; }
    .gutter-line { left: 16px; }
}

@media (max-width: 479px) {
    .foot-nav { font-size: 10.5px; gap: 8px 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
    .corner { font-size: 10px; }
    .top-left { top: 20px; left: 20px; }
}

/* lang toggle — top-right fixed */
.lang-fixed {
    position: fixed;
    top: 32px;
    right: 32px;
    z-index: 6;
    display: flex;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.35em;
    text-transform: uppercase;
    align-items: baseline;
}
.lang-fixed a {
    color: var(--text);
    opacity: 0.5;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s, color 0.2s;
}
.lang-fixed a:hover { opacity: 1; }
.lang-fixed .sep {
    color: rgba(107, 122, 90, 0.35);
    font-size: 9px;
    user-select: none;
}
html[data-lang="en"] .lang-fixed a[data-lang-btn="en"],
html[data-lang="ko"] .lang-fixed a[data-lang-btn="ko"] {
    opacity: 1;
}
@media (max-width: 600px) {
    .lang-fixed { top: 20px; right: 20px; font-size: 10px; letter-spacing: 0.28em; }
}

/* lang visibility */
html[data-lang="en"] [data-l="ko"] { display: none; }
html[data-lang="ko"] [data-l="en"] { display: none; }

/* Apollo R2 SSOT — admin frontier tokens (Phase A-2 · 2026-05-12) */

/* P0: Tokens & Utilities (Verbatim) */
/* §2.3 — modular scale 정합 */
:root {
  --fs-9:  9px;
  --fs-11: 11px;
  --fs-13: 13px;
  --fs-15: 15px;
  --fs-16: 16px;
}

/* §3.1 — paper depth layer */
:root {
  --surface-0: var(--bg);
  --surface-1: rgba(237, 230, 214, 0.04);
  --surface-2: rgba(237, 230, 214, 0.07);
}

/* §3.3 — opacity token system */
:root {
  --o-primary:    1.0;
  --o-secondary:  0.78;
  --o-tertiary:   0.56;
  --o-quaternary: 0.40;
}

/* §4.5 — 4-grid SSOT token */
:root {
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;
  --space-12: 48px;
  --space-14: 56px;
  --space-16: 64px;
}

/* §5.4 — motion duration token */
:root {
  --tr-instant: 150ms ease-out;
  --tr-subtle:  400ms ease-out;
  --tr-reveal:  480ms ease-out;
  --tr-stagger:  60ms;
}

/* §3.2 — focus-visible ring (UI-checklist C-01 BLOCK 해소) */
:where(button, a, input, [tabindex]):focus-visible {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius);
  transition: outline-offset var(--tr-instant);
}
.chip:focus-visible {
  outline-offset: 3px;
}
.search-wrap input:focus-visible {
  outline: none;
  border-bottom-color: var(--accent);
  border-bottom-width: 1.5px;
}

/* §5.1 — prefers-reduced-motion override (UI-checklist N-01 해소) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card-thumb { opacity: 1; }
}

/* §2.5 — sr-only utility */
.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;
}

/* P1: Layout & Stagger (Verbatim) */
/* §1.1 — section vertical rhythm 위계 (32px → bucket별 차등) */
.section { margin-bottom: 48px; }
.section[data-bucket="today"]      { margin-bottom: 56px; }
.section[data-bucket="yesterday"]  { margin-bottom: 48px; }
.section[data-bucket="past7"]      { margin-bottom: 44px; }
.section[data-bucket="past30"]     { margin-bottom: 40px; }
.section[data-bucket="archive"]    { margin-bottom: 32px; }

/* §1.2 — time-mark 명시 dimension (DESIGN.md §9.2 hairline glyph) */
.time-mark {
  width: 1px;
  height: 10px;
  display: inline-block;
  background: var(--text);
  opacity: 0.6;
  flex-shrink: 0;
  transform: translateY(1px);
}

/* §2.1 — tabular-nums 강제 */
.count-badge,
.card-ver,
#footer-count,
.card-kind {
  font-variant-numeric: tabular-nums lining-nums;
}

/* §5.2 — entry stagger (DESIGN.md §8 verbatim "stagger 80ms") */
@keyframes morven-fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}.card-grid > .card {
  animation: morven-fade-up 480ms ease-out backwards;
}
.card-grid > .card:nth-child(1)  { animation-delay:   0ms; }
.card-grid > .card:nth-child(2)  { animation-delay:  60ms; }
.card-grid > .card:nth-child(3)  { animation-delay: 120ms; }
.card-grid > .card:nth-child(4)  { animation-delay: 180ms; }
.card-grid > .card:nth-child(5)  { animation-delay: 240ms; }
.card-grid > .card:nth-child(6)  { animation-delay: 300ms; }
.card-grid > .card:nth-child(n+7) { animation-delay: 360ms; }

/* P2: Interaction & Depth (Verbatim) */
/* §5.3 — tap feedback (button:active) */
.chip:active,
.share-btn:active,
.foot-nav a:active {
  transform: translateY(0.5px);
  opacity: 0.75;
}
.chip,
.share-btn,
.foot-nav a {
  transition:
    border-color var(--tr-instant),
    color var(--tr-instant),
    transform 80ms ease-out,
    opacity var(--tr-instant);
}

/* §3.1 — paper depth layer */
:root {
  --surface-0: var(--bg);
  --surface-1: rgba(237, 230, 214, 0.04);
  --surface-2: rgba(237, 230, 214, 0.07);
}
/* .toolbar gradient 제거 — Glass V3 parchment 0.08 단일 (line 153 SSOT, 중복 cleanup 2026-05-29) */
.card {
  background: var(--surface-1);
}
.card-thumb-wrap {
  background: var(--surface-1);
}

/* === Page Hero Typography (cycle 1 · Apollo R1 2026-05-12) === */

h1.page-title,
.page-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(72px, 11vw, 144px);
  line-height: 0.9;
  letter-spacing: -0.015em;
  color: var(--text);
  margin: 0;
}

.eyebrow,
.hero-eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px 0;
  display: block;
}

.hero-sub {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(15px, 1.4vw, 18px);
  line-height: 1.6;
  letter-spacing: 0.01em;
  color: var(--text);
  opacity: 0.7;
  margin: 14px 0 0 0;
  max-width: 56ch;
}

.page-hero {
  margin-bottom: 80px;
}

@media (max-width: 768px) {
  .page-hero {
    margin-bottom: 60px;
  }
  h1.page-title,
  .page-title {
    font-size: clamp(56px, 13vw, 96px);
  }
}

/* ============================================================
   public site nav — SSOT (홈·about·now·writing·card 공용 컴포넌트)
   site-nav.js가 #site-nav에 inject. 모든 공개 페이지 완전 동일 위치.
   admin은 별도 (.foot-nav / foot-nav.js).
   ============================================================ */
.site-nav {
  position: fixed;
  bottom: 8%;
  right: 8%;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}
.site-nav .nav-row {
  display: flex;
  flex-direction: row;
  gap: 18px;
  align-items: baseline;
}
.site-nav .sep {
  color: rgba(107, 122, 90, 0.35);
  font-size: 9px;
  letter-spacing: 0.4em;
  user-select: none;
}
.site-nav a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}
.site-nav .nav-row.primary a { color: var(--text); opacity: 0.82; }
.site-nav .nav-row.primary a:hover { opacity: 1; }
.site-nav .nav-row.primary a.active { opacity: 1; pointer-events: none; cursor: default; }
.site-nav .nav-row.secondary a { color: var(--accent); opacity: 0.78; font-size: 10px; letter-spacing: 0.22em; }
.site-nav .nav-row.secondary a:hover { color: var(--text); opacity: 1; }
.site-nav a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: 0;
  width: 0;
  height: 1px;
  background-color: currentColor;
  opacity: 0.8;
  transition: width 220ms ease-out, left 0s 220ms;
}
.site-nav a:hover::after {
  width: 100%;
  left: 0;
  right: auto;
  transition: width 220ms ease-out;
}
/* 모션 — fade-in (홈 .anim-text 동일) */
.anim-text { opacity: 0; transform: translateY(10px); animation: fadeInUp 600ms ease-out forwards; }
@keyframes fadeInUp { to { opacity: 1; transform: translateY(0); } }
.anim-text.delay-5 { animation-delay: 400ms; }
@media (prefers-reduced-motion: reduce) {
  .anim-text { animation: none !important; opacity: 1 !important; transform: none !important; }
}
/* 모바일 — 화면 하단 고정(fixed) + 투명(뒤 내용 비침) + 스크롤 auto-hide */
@media (max-width: 600px) {
  .site-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: auto;
    width: 100%;
    align-items: flex-start;
    gap: 10px;
    margin-top: 0;
    padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
    /* 배경 없음 = 투명, 뒤 내용 그대로 비침 */
    background: none;
    transition: transform 280ms ease, opacity 280ms ease;
  }
  /* 스크롤 내릴 때 숨김 (내용에 안 거슬리게), 올리면 다시 나타남 */
  .site-nav.nav-hidden {
    transform: translateY(130%);
    opacity: 0;
    pointer-events: none;
  }
  .site-nav .nav-row { flex-wrap: wrap; gap: 14px 16px; width: 100%; }
  .site-nav .sep { display: none; }
}
