/* prototype.css — Mate 포털 디자인 시스템 */

:root {
  /* Color */
  --bg: #faf8f4;
  --surface: #ffffff;
  --surface-2: #f3eee5;
  --surface-3: #ebe4d5;
  --ink: #1a1815;
  --ink-2: #4a4540;
  --muted: #8c867d;
  --divider: #e6dfd0;

  /* Category accents */
  --briefing: #d27a45;
  --briefing-soft: #f7e7d6;
  --briefing-tint: #fbf3ea;

  --study: #5e8b6a;
  --study-soft: #dbe7dd;
  --study-tint: #eef3eb;

  --music: #7466a0;
  --music-soft: #e1dcef;
  --music-tint: #f0ecf5;

  --board: #4d7aa8;
  --board-soft: #d6e1ee;
  --board-tint: #e9eff6;

  --project: #a85b75;
  --project-soft: #efd5dd;
  --project-tint: #f6e6ec;

  /* Market direction — 빨강=상승 (한국 증시 관례) */
  --up:   #dc2626;
  --down: #1d4ed8;
  --flat: #6b7280;

  /* Type */
  --font-sans: 'Pretendard', 'Apple SD Gothic Neo', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Radius (driven by Tweak) */
  --r-card: 14px;
  --r-sm: 8px;
  --r-pill: 999px;
  --pixel-step: 0px; /* > 0 when 'pixel' corners */

  /* Shadow */
  --shadow-1: 0 1px 2px rgba(20, 18, 15, 0.04);
  --shadow-2: 0 1px 2px rgba(20, 18, 15, 0.04), 0 4px 12px rgba(20, 18, 15, 0.05);
  --shadow-3: 0 1px 3px rgba(20, 18, 15, 0.05), 0 12px 32px rgba(20, 18, 15, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; color: inherit; }

/* ── Layout shell ────────────────────────────────────────────── */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
}
@media (max-width: 720px) {
  .shell { padding: 0 16px; }
}

/* ── Top nav ─────────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 18px;
  border-bottom: 1px solid var(--divider);
  margin-bottom: 28px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}
.brand .logo {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 24px;
  letter-spacing: 0.04em;
  line-height: 1;
  white-space: nowrap;
}
.brand .tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.topnav .meta {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--muted);
}
.topnav .meta > span { white-space: nowrap; flex: 0 0 auto; }
.brand .tag { white-space: nowrap; }
.topnav .meta .dot {
  display: inline-block; width: 6px; height: 6px;
  background: var(--study); border-radius: 50%;
  margin-right: 6px; vertical-align: 1px;
}
.topnav .links {
  display: flex; gap: 18px;
  font-size: 14px;
  color: var(--ink-2);
}
.topnav .links a { transition: color .12s; white-space: nowrap; }
.topnav .links a:hover, .topnav .links a.active { color: var(--ink); }
.topnav .links a.active { font-weight: 600; }

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-1);
  transition: transform .15s, box-shadow .15s, border-color .15s;
  position: relative;
  overflow: hidden;
}
.card.tint { background: var(--surface); }
.card.tint-briefing { background: linear-gradient(180deg, var(--briefing-tint) 0%, var(--surface) 60%); border-color: color-mix(in oklab, var(--briefing) 22%, var(--divider)); }
.card.tint-study    { background: linear-gradient(180deg, var(--study-tint)    0%, var(--surface) 60%); }
.card.tint-music    { background: linear-gradient(180deg, var(--music-tint)    0%, var(--surface) 60%); }
.card.tint-board    { background: linear-gradient(180deg, var(--board-tint)    0%, var(--surface) 60%); }
.card.tint-project  { background: linear-gradient(180deg, var(--project-tint)  0%, var(--surface) 60%); }

a.card:hover, button.card:hover, .card.linkable:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-2);
  border-color: color-mix(in oklab, var(--ink) 14%, var(--divider));
}

.card-pad { padding: 20px 22px; }
.card-pad-lg { padding: 28px 32px; }

/* Pixel-corner mode: chop corners using clip-path */
[data-corners="pixel"] .card,
[data-corners="pixel"] .pill,
[data-corners="pixel"] .chip,
[data-corners="pixel"] .btn,
[data-corners="pixel"] .input,
[data-corners="pixel"] .textarea {
  --pixel-step: 5px;
  clip-path: polygon(
    0 var(--pixel-step), var(--pixel-step) var(--pixel-step), var(--pixel-step) 0,
    calc(100% - var(--pixel-step)) 0, calc(100% - var(--pixel-step)) var(--pixel-step), 100% var(--pixel-step),
    100% calc(100% - var(--pixel-step)), calc(100% - var(--pixel-step)) calc(100% - var(--pixel-step)),
    calc(100% - var(--pixel-step)) 100%, var(--pixel-step) 100%,
    var(--pixel-step) calc(100% - var(--pixel-step)), 0 calc(100% - var(--pixel-step))
  );
}

/* ── Category dot/tag ────────────────────────────────────────── */
.cat-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.cat-tag .swatch {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.cat-tag.briefing .swatch { background: var(--briefing); }
.cat-tag.study    .swatch { background: var(--study); }
.cat-tag.music    .swatch { background: var(--music); }
.cat-tag.board    .swatch { background: var(--board); }
.cat-tag.project  .swatch { background: var(--project); }

/* ── Chips ───────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--divider);
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
  flex: 0 0 auto;
}
.chip:hover { border-color: var(--ink-2); }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.tag-discuss { color: var(--study); border-color: color-mix(in oklab, var(--study) 35%, var(--divider)); }
.chip.tag-question { color: var(--board); border-color: color-mix(in oklab, var(--board) 35%, var(--divider)); }
.chip.tag-chat { color: var(--project); border-color: color-mix(in oklab, var(--project) 35%, var(--divider)); }
.chip.tag-discuss.active { background: var(--study); color: #fff; border-color: var(--study); }
.chip.tag-question.active { background: var(--board); color: #fff; border-color: var(--board); }
.chip.tag-chat.active { background: var(--project); color: #fff; border-color: var(--project); }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: background .12s, color .12s, transform .08s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--surface); }
.btn.primary:hover { background: var(--ink-2); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.lg { padding: 13px 22px; font-size: 15px; }
.btn.sm { padding: 6px 12px; font-size: 13px; }

.btn.accent-briefing { background: var(--briefing); border-color: var(--briefing); color: #fff; }
.btn.accent-briefing:hover { background: color-mix(in oklab, var(--briefing) 88%, black); }
.btn.accent-board { background: var(--board); border-color: var(--board); color: #fff; }
.btn.accent-board:hover { background: color-mix(in oklab, var(--board) 88%, black); }

/* ── Inputs ──────────────────────────────────────────────────── */
.input, .textarea, .select {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  font-size: 15px;
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--ink) 10%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { min-height: 220px; resize: vertical; line-height: 1.6; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.field-hint { font-size: 12px; color: var(--muted); }

/* ── Section header ──────────────────────────────────────────── */
.section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 16px;
}
.section-h h2 { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -0.02em; }
.section-h .lead { font-size: 13px; color: var(--muted); }

/* ── Eyebrow ─────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Home grid ──────────────────────────────────────────────── */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  align-items: stretch;
}
.home-grid > .hero { min-height: 580px; display: flex; flex-direction: column; }
.home-grid > .stack { display: flex; flex-direction: column; gap: 12px; }
.home-grid > .stack > .card { flex: 1; min-height: 0; }
@media (max-width: 900px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-grid > .hero { min-height: 420px; }
}

/* ── Stack-card rows (used in Home V2) ───────────────────────── */
.stack-row {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 24px;
  height: 100%;
}
.stack-row .icon {
  width: 56px; height: 56px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  flex: 0 0 auto;
}
.stack-row .body { flex: 1; min-width: 0; }
.stack-row .body .title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.stack-row .body .sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.stack-row .arrow { color: var(--muted); transition: transform .15s, color .15s; }
.stack-row .eyebrow { white-space: nowrap; }
.card.linkable:hover .stack-row .arrow { transform: translateX(3px); color: var(--ink); }

/* ── Briefing hero ───────────────────────────────────────────── */
.hero-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 16px;
}
.hero-title {
  font-size: 48px; font-weight: 800; line-height: 1.05; letter-spacing: -0.03em;
  margin: 6px 0 0;
}
.hero-title .accent {
  background-image: linear-gradient(180deg, transparent 62%, color-mix(in oklab, var(--briefing) 50%, transparent) 62%, color-mix(in oklab, var(--briefing) 50%, transparent) 92%, transparent 92%);
  padding: 0 4px;
}
.hero-meta {
  display: flex; gap: 18px; align-items: center;
  font-size: 13px; color: var(--muted);
  margin-top: 6px;
}
.brief-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 28px;
  flex: 1;
}
@media (max-width: 720px) {
  .brief-grid { grid-template-columns: 1fr; }
  .hero-title { font-size: 36px; }
}
.brief-block { border-left: 2px solid var(--briefing); padding: 4px 0 4px 14px; }
.brief-block .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--briefing);
  margin-bottom: 8px;
}
.brief-block ul { margin: 0; padding: 0; list-style: none; }
.brief-block li { font-size: 14px; color: var(--ink-2); padding: 4px 0; border-bottom: 1px dashed var(--divider); }
.brief-block li:last-child { border-bottom: none; }
.brief-block li .k { color: var(--muted); margin-right: 8px; font-variant-numeric: tabular-nums; font-size: 12px; }

/* ── Indicator grid (briefing hero) ──────────────────── */
.ind-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 14px;
}
.ind {
  border-left: 2px solid var(--briefing);
  padding: 6px 0 6px 14px;
}
.ind-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 4px;
  white-space: nowrap;
}
.ind-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  color: var(--ink);
}
.ind-chg {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .ind-grid { grid-template-columns: 1fr 1fr; gap: 12px 10px; }
  .ind-value { font-size: 22px; }
}

.hero-foot {
  margin-top: 24px;
  display: flex; justify-content: space-between; align-items: center;
  border-top: 1px solid var(--divider);
  padding-top: 16px;
}

/* ── Page header / breadcrumb ────────────────────────────────── */
.page-h {
  margin-bottom: 28px;
}
.page-h .crumbs {
  font-size: 13px; color: var(--muted);
  margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.crumbs > * { white-space: nowrap; flex: 0 0 auto; }
.page-h h1 { margin: 0; font-size: 36px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.page-h .lead { margin-top: 8px; color: var(--ink-2); font-size: 15px; }

/* ── Board list ──────────────────────────────────────────────── */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
  gap: 14px;
  flex-wrap: wrap;
}
.toolbar .filters { display: flex; gap: 6px; flex-wrap: wrap; }
.toolbar .search {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 14px; color: var(--muted);
  min-width: 240px;
}
.toolbar .search input { border: none; outline: none; background: transparent; flex: 1; }

.post-list { border-top: 1px solid var(--divider); }
.post-row {
  display: grid;
  grid-template-columns: 70px 1fr 110px 70px 70px 100px;
  gap: 12px;
  padding: 16px 12px;
  border-bottom: 1px solid var(--divider);
  align-items: center;
  transition: background .12s;
  cursor: pointer;
}
.post-row:hover { background: var(--surface-2); }
.post-row.head {
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--ink);
  background: transparent !important;
  cursor: default;
  padding: 10px 12px;
}
.post-row .title-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.post-row .title { font-size: 15px; font-weight: 500; color: var(--ink); letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-row .nick { font-size: 13px; color: var(--ink-2); }
.post-row .num { font-size: 13px; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.post-row .num-label { display: none; }
.post-row .time { font-size: 12px; color: var(--muted); text-align: right; white-space: nowrap; }
.post-row .badge { font-family: var(--font-mono); font-size: 11px; color: var(--briefing); }
@media (max-width: 720px) {
  .post-row { grid-template-columns: 1fr; gap: 4px; padding: 14px 6px; }
  .post-row.head { display: none; }
  .post-row .num, .post-row .nick { text-align: left; }
  .post-row .num-label { display: inline; color: var(--muted); margin-right: 4px; font-size: 11px; font-family: var(--font-mono); text-transform: uppercase; }
  .post-row .meta-row { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
}

/* ── Pagination ──────────────────────────────────────────────── */
.pager {
  display: flex; justify-content: center; gap: 4px;
  margin-top: 24px;
}
.pager .pg {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--divider);
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  cursor: pointer;
}
.pager .pg:hover { border-color: var(--ink-2); }
.pager .pg.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ── Post detail ─────────────────────────────────────────────── */
.post-detail { max-width: 760px; margin: 0 auto; }
.post-detail h1 { font-size: 32px; font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 16px; }
.post-meta {
  display: flex; flex-wrap: wrap; gap: 16px;
  font-size: 13px; color: var(--muted);
  padding-bottom: 18px;
  border-bottom: 1px solid var(--divider);
}
.post-meta > span { white-space: nowrap; flex: 0 0 auto; }
.post-body {
  padding: 24px 0;
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}
.post-body p { margin: 0 0 1em; }

.comments { margin-top: 32px; border-top: 1px solid var(--divider); padding-top: 24px; }
.comment {
  padding: 16px 0;
  border-bottom: 1px dashed var(--divider);
}
.comment .head {
  display: flex; gap: 10px; align-items: baseline;
  margin-bottom: 4px;
  font-size: 13px;
}
.comment .head > * { white-space: nowrap; flex: 0 0 auto; }
.comment .head .nick { font-weight: 600; color: var(--ink); }
.comment .head .time { color: var(--muted); }
.comment .body { font-size: 14px; color: var(--ink-2); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

/* ── Two-col page (board write) ──────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 36px;
  align-items: flex-start;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; gap: 24px; }
}

/* ── Mini diagram (Study) ────────────────────────────────────── */
.diagram {
  position: relative;
  padding: 32px 24px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-card);
}
.diagram .node {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface);
}
.diagram .node.accent { color: #fff; background: var(--ink); }

/* ── Empty/info state ────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty .icon { font-size: 32px; margin-bottom: 12px; opacity: 0.5; }
.empty .title { font-size: 16px; color: var(--ink-2); margin-bottom: 6px; }

/* ── Footer ──────────────────────────────────────────────────── */
.foot {
  margin-top: 72px;
  padding: 32px 0;
  border-top: 1px solid var(--divider);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px;
  font-size: 13px; color: var(--muted);
}
.foot .links { display: flex; gap: 18px; }

/* ── Toast ───────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--surface);
  padding: 12px 20px;
  border-radius: var(--r-sm);
  font-size: 14px;
  box-shadow: var(--shadow-3);
  z-index: 100;
  animation: toast-in 0.2s ease;
}
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}

/* ── Misc ────────────────────────────────────────────────────── */
.divider-dot {
  width: 3px; height: 3px;
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin: 0 8px;
}
.kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--divider);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  background: var(--surface);
}

/* ── Fade in ─────────────────────────────────────────────────── */
.fade-in { animation: fade-in 0.25s ease; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
