/* ===================================================================
   blog8 — design tokens
   Palette:  paper #EFEDE6 · ink #21201C · moss #4B5D45 · clay #8B6F47
             line #D8D4C8 · danger #A23B33
   Type:     Fraunces (display) · Inter (body) · JetBrains Mono (meta)
   Signature: rotated "spine" title fixed to the left edge, echoed as a
              small monospace date-tab on every card and article.
=================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

:root{
  --paper: #FCFBFA;
  --paper-raised: #F7F6F1;
  --ink: #21201C;
  --ink-soft: #58564C;
  --moss: #4B5D45;
  --moss-dark: #384633;
  --clay: #8B6F47;
  --line: #D8D4C8;
  --danger: #A23B33;
  --radius: 3px;
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  line-height: 1.15;
  margin: 0;
  letter-spacing: -0.01em;
}
a{ color: inherit; text-decoration: none; }
button{ font-family: inherit; cursor: pointer; }
img{ max-width: 100%; display: block; }
::selection{ background: var(--moss); color: var(--paper); }

.mono{
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--clay);
}

/* ---------- layout shell ---------- */
.shell{
  display: flex;
  min-height: 100vh;
}

/* the "spine" — signature element, fixed rotated wordmark */
.spine{
  width: 64px;
  flex: none;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 32px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}
.spine a{
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-style: normal;
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.spine .spine-dot{
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--moss);
  margin-bottom: 18px;
}

.main{
  flex: 1;
  min-width: 0;
  padding: 56px clamp(24px, 6vw, 96px) 96px;
}

.topbar{
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 64px;
  gap: 16px 24px;
}
.topbar-left{
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.topbar nav{ display: flex; gap: 24px; }
.topbar nav a{
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
.topbar nav a:hover, .topbar nav a.active{
  color: var(--ink);
  border-color: var(--moss);
}

/* ---------- session timer (관리자 페이지 전용) ---------- */
.session-info{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--paper-raised);
}
.session-info .mono{
  color: var(--ink-soft);
  font-size: 0.7rem;
}
.session-extend-btn{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  border: 1px solid var(--moss);
  background: transparent;
  color: var(--moss-dark);
  padding: 4px 12px;
  border-radius: 20px;
  transition: background .15s ease, color .15s ease;
}
.session-extend-btn:hover{ background: var(--moss); color: var(--paper); }
.session-extend-btn:disabled{ opacity: 0.5; cursor: not-allowed; }

/* ---------- hero ---------- */
.hero{ max-width: 640px; margin-bottom: 72px; }
.hero h1{
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  margin-bottom: 14px;
}
.hero p{
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 46ch;
}

/* ---------- post list ---------- */
.post-list{
  display: flex;
  flex-direction: column;
}
.post-card{
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 28px;
  padding: 30px 0;
  border-top: 1px solid var(--line);
  transition: transform .15s ease;
}
.post-list .post-card:last-child{ border-bottom: 1px solid var(--line); }
.post-card:hover{ transform: translateX(4px); }
.post-card .date-tab{
  padding-top: 4px;
}
.post-card h2{
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.post-card h2 a:hover{ color: var(--moss-dark); }
.post-card p{
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 62ch;
}
.post-card .cover{
  width: 100%;
  aspect-ratio: 16/7;
  object-fit: cover;
  border-radius: var(--radius);
  margin-top: 14px;
  border: 1px solid var(--line);
}
.empty-state{
  padding: 48px 0;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
}

/* ---------- article ---------- */
.article-head{ max-width: 680px; margin-bottom: 40px; }
.article-head h1{
  font-size: clamp(2rem, 4.4vw, 2.8rem);
  margin: 14px 0 18px;
}
.article-cover{
  width: 100%;
  max-height: 460px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 40px;
}
.article-body{
  max-width: 680px;
  font-size: 1.08rem;
  color: #2B2A24;
}
.article-body p{ margin: 0 0 1.3em; }
.article-body img{
  border-radius: var(--radius);
  margin: 1.6em 0;
  border: 1px solid var(--line);
}
.article-body h2{ font-size: 1.5rem; margin: 1.6em 0 0.6em; }
.article-body a{ color: var(--moss-dark); border-bottom: 1px solid var(--moss); }

/* ---------- forms / admin ---------- */
.panel{
  max-width: 560px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
}
/* 글쓰기 폼은 본문 에디터가 더 넓게 쓸 수 있도록 박스 자체를 넓히고,
   제목/요약/카테고리 등 다른 필드는 .field-narrow로 기존 너비를 유지한다. */
#post-form.panel{ max-width: 900px; }
.field{ margin-bottom: 20px; }
.field-narrow{ max-width: 560px; }
.field label{
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--clay);
  margin-bottom: 8px;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=file],
.field input[type=datetime-local],
.field textarea{
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: var(--radius);
  padding: 11px 13px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
}
.field textarea{ min-height: 320px; resize: vertical; font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; line-height: 1.6; }
.field input:focus, .field textarea:focus{
  outline: none;
  border-color: var(--moss);
}

/* ---------- rich text editor ---------- */
.editor-toolbar{
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-bottom: none;
  background: var(--paper);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 8px;
}
.editor-toolbar button{
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-soft);
  width: 32px; height: 32px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
}
.editor-toolbar button:hover{ background: var(--line); color: var(--ink); }
.editor-content{
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--paper);
  padding: 16px;
  font-size: 0.98rem;
  line-height: 1.7;
}
.editor-content:focus{ outline: none; border-color: var(--moss); }
.editor-content img{ max-width: 100%; border-radius: var(--radius); margin: 10px 0; }
.editor-content:empty:before{
  content: attr(data-placeholder);
  color: var(--ink-soft);
  opacity: 0.6;
}

/* ---------- settings ---------- */
.settings-grid{
  display: grid;
  gap: 16px;
}
.info-row{
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-size: 0.88rem;
}
.info-row:last-child{ border-bottom: 1px solid var(--line); }
.info-row .k{ color: var(--ink-soft); flex: none; }
.info-row .v{ font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; text-align: right; word-break: break-all; }
.hint{ font-size: 0.82rem; color: var(--ink-soft); margin-top: 6px; }

.btn{
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.btn:hover{ background: var(--moss-dark); border-color: var(--moss-dark); }
.btn.secondary{
  background: transparent;
  color: var(--ink);
}
.btn.secondary:hover{ background: var(--line); }
.btn.danger{ background: var(--danger); border-color: var(--danger); }
.btn:disabled{ opacity: 0.5; cursor: not-allowed; }

.admin-row{
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  gap: 16px;
}
.admin-row:last-child{ border-bottom: 1px solid var(--line); }
.admin-row .title{ font-weight: 500; }
.admin-row .actions{ display: flex; gap: 10px; flex: none; }
.status{
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  color: var(--ink-soft);
}
.status.published{ color: var(--moss-dark); border-color: var(--moss); }
.status.scheduled{ color: var(--clay); border-color: var(--clay); }

.toast{
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show{ opacity: 1; transform: translateY(0); }
.toast.error{ background: var(--danger); }

footer.site-footer{
  margin-top: 96px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

@media (max-width: 640px){
  .spine{ display: none; }
  .main{ padding: 32px 20px 64px; }
  .post-card{ grid-template-columns: 1fr; gap: 10px; }
  .date-tab{ order: 2; }
}

/* ===================================================================
   public homepage (index.html) — header + centered hero + magazine grid
=================================================================== */

.site{ min-height: 100vh; }

.site-header{
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 32px clamp(20px, 5vw, 48px) 0;
}
.site-header .brand{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
}
.site-nav{ display: flex; gap: 28px; }
.site-nav a{
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding-bottom: 3px;
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease, color .15s ease;
}
.site-nav a.active, .site-nav a:hover{ color: var(--ink); border-color: var(--moss); }
.header-actions{ display: flex; align-items: center; }
.search-toggle{
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-family: 'Inter', sans-serif;
  font-size: 0.88rem;
  padding: 6px;
}
.search-toggle:hover{ color: var(--ink); }
.search-toggle svg{ width: 16px; height: 16px; }

.search-bar{
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 clamp(20px, 5vw, 48px);
}
.search-bar input{
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.95rem;
  color: var(--ink);
}
.search-bar input:focus{ outline: none; border-color: var(--moss); }

.page{
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px) 96px;
}

.hero-center{
  max-width: 640px;
  margin: 56px auto 64px;
  text-align: center;
}
.hero-center .overline{ margin-bottom: 10px; color: var(--moss-dark); }
.hero-center h1{ font-size: clamp(2.1rem, 5vw, 3rem); margin-bottom: 14px; }
.hero-center p{ color: var(--ink-soft); font-size: 1.02rem; }

.section-heading{
  font-size: 1.15rem;
  margin-bottom: 20px;
}

/* ---- featured post + top stories ---- */
.featured-grid{
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 44px;
  margin-bottom: 80px;
}
.featured-card .cover{
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 20px;
}
.featured-card h2{ font-size: 1.7rem; margin: 8px 0 10px; }
.featured-card h2 a:hover{ color: var(--moss-dark); }
.featured-card p{ color: var(--ink-soft); font-size: 0.98rem; max-width: 56ch; }

.top-stories-list{ display: flex; flex-direction: column; }
.top-story{
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.top-story:first-child{ border-top: none; padding-top: 0; }
.top-story .num{
  flex: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.top-story .body{ flex: 1; min-width: 0; }
.top-story .body h4{
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.3;
  margin-bottom: 6px;
}
.top-story .body h4 a:hover{ color: var(--moss-dark); }
.top-story .body .mono{ font-size: 0.66rem; }
.top-story .thumb{
  flex: none;
  width: 64px; height: 56px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

/* ---- bottom card grid ---- */
.card-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px 32px;
}
.post-card-b .cover{
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}
.post-card-b .card-meta{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.post-card-b h3{ font-size: 1.15rem; margin-bottom: 8px; }
.post-card-b h3 a:hover{ color: var(--moss-dark); }
.post-card-b p{ color: var(--ink-soft); font-size: 0.92rem; }

.category-badge{
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--moss-dark);
  margin-bottom: 8px;
}
.card-meta .category-badge{ margin-bottom: 0; }

.results-heading{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.results-heading a{
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
.results-heading a:hover{ color: var(--ink); border-color: var(--moss); }

@media (max-width: 900px){
  .featured-grid{ grid-template-columns: 1fr; gap: 36px; }
  .card-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 640px){
  .site-header{ padding-top: 22px; }
  .site-nav{ gap: 16px; }
  .site-nav a{ font-size: 0.84rem; }
  .hero-center{ margin: 40px auto 44px; }
  .featured-grid{ margin-bottom: 56px; }
  .card-grid{ gap: 32px; }
}

@media (max-width: 420px){
  .site-nav{ display: none; }
}
