/* OneBioBank — 완도 다시마 연구 데이터 허브 (static frontend) */
:root {
  --deep:      #06303a;   /* deep ocean */
  --deep-2:    #0a4452;
  --teal:      #0e7c86;
  --teal-2:    #14a3a8;
  --seafoam:   #4cc9be;
  --seafoam-l: #a7e8df;
  --sand:      #f3efe6;
  --ink:       #0d2b30;
  --muted:     #5b7178;
  --line:      #d9e4e3;
  --bg:        #f5faf9;
  --card:      #ffffff;
  --shadow:    0 1px 2px rgba(6,48,58,.06), 0 6px 22px rgba(6,48,58,.07);
  --radius:    14px;
  --maxw:      1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(110deg, var(--deep) 0%, var(--deep-2) 55%, var(--teal) 130%);
  color: #eafcfa;
  box-shadow: 0 2px 18px rgba(6,48,58,.28);
}
.header-inner {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; gap: 18px;
  padding: 12px 20px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo { flex: 0 0 auto; }
.brand .titles { display: flex; flex-direction: column; line-height: 1.15; }
.brand .titles b { font-size: 1.12rem; letter-spacing: .2px; }
.brand .titles span { font-size: .74rem; color: var(--seafoam-l); font-weight: 500; }

.nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.nav button {
  background: transparent; border: 0; color: #cdeeea;
  font: inherit; font-size: .9rem; font-weight: 600;
  padding: 8px 13px; border-radius: 9px; cursor: pointer;
  transition: background .15s, color .15s;
}
.nav button:hover { background: rgba(255,255,255,.10); color: #fff; }
.nav button.active { background: var(--seafoam); color: var(--deep); }

.nav-toggle { display: none; }

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 26px 20px 60px; }
.section { display: none; animation: fade .25s ease; }
.section.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

h2.section-title {
  font-size: 1.4rem; margin: 4px 0 4px; color: var(--deep);
  display: flex; align-items: baseline; gap: 10px;
}
h2.section-title small { font-size: .8rem; font-weight: 500; color: var(--muted); }
.lead { color: var(--muted); margin: 0 0 22px; max-width: 760px; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(120deg, var(--deep) 0%, var(--teal) 100%);
  color: #eafcfa; border-radius: var(--radius);
  padding: 30px 30px 26px; margin-bottom: 24px;
  position: relative; overflow: hidden;
  box-shadow: var(--shadow);
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px;
  width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(76,201,190,.5), transparent 70%);
  pointer-events: none;
}
.hero h1 { margin: 0 0 8px; font-size: 1.8rem; letter-spacing: .2px; position: relative; }
.hero p { margin: 0; max-width: 720px; color: #d7f4f0; position: relative; }

/* ---------- Stat cards ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 28px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.stat .num { font-size: 1.65rem; font-weight: 800; color: var(--teal);
  font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .lab { font-size: .82rem; color: var(--muted); margin-top: 3px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 22px;
}
.card h3 { margin: 0 0 14px; font-size: 1.05rem; color: var(--deep); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ---------- Workflow diagram ---------- */
.workflow { display: flex; flex-wrap: wrap; gap: 0; align-items: stretch; }
.wf-step {
  flex: 1 1 0; min-width: 150px; position: relative;
  background: linear-gradient(160deg, #fff, #f0faf8);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 16px 14px; margin: 6px;
}
.wf-step .wf-ico { color: var(--teal); margin-bottom: 8px; }
.wf-step .wf-n {
  position: absolute; top: -10px; left: -10px;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--seafoam); color: var(--deep);
  display: grid; place-items: center; font-weight: 800; font-size: .82rem;
  box-shadow: var(--shadow);
}
.wf-step b { display: block; color: var(--deep); font-size: .96rem; margin-bottom: 2px; }
.wf-step span { font-size: .8rem; color: var(--muted); }
.wf-arrow { align-self: center; color: var(--seafoam); padding: 0 2px; }

/* ---------- Tables ---------- */
.table-tools {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 12px;
}
.table-tools input[type=search], .table-tools select {
  font: inherit; font-size: .9rem;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--ink); min-width: 200px;
}
.table-tools input[type=search]:focus, .table-tools select:focus {
  outline: 2px solid var(--seafoam); outline-offset: 0; border-color: var(--seafoam);
}
.table-tools .count { margin-left: auto; color: var(--muted); font-size: .85rem; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); cursor: pointer; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.data { width: 100%; border-collapse: collapse; font-size: .87rem; background: #fff; }
table.data thead th {
  position: sticky; top: 0;
  background: var(--deep); color: #eafcfa;
  text-align: left; padding: 10px 12px; font-weight: 600;
  white-space: nowrap; cursor: pointer; user-select: none;
}
table.data thead th.no-sort { cursor: default; }
table.data thead th .arrow { opacity: .45; font-size: .72em; margin-left: 4px; }
table.data thead th.sort-asc .arrow, table.data thead th.sort-desc .arrow { opacity: 1; color: var(--seafoam); }
table.data tbody td { padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:nth-child(even) { background: #f7fbfb; }
table.data tbody tr:hover { background: #eef8f6; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data td.name { font-weight: 600; color: var(--deep); }
table.data td.org { font-style: italic; color: var(--muted); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* QED color chip */
.qed { display: inline-block; min-width: 44px; text-align: center;
  padding: 2px 7px; border-radius: 7px; font-weight: 700; font-size: .82rem;
  color: #08343a; }

/* score bar (targets) */
.scorebar { position: relative; min-width: 150px; }
.scorebar .bar {
  height: 16px; border-radius: 5px; background: linear-gradient(90deg, var(--teal), var(--seafoam));
}
.scorebar .val {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font-size: .75rem; font-weight: 700; color: var(--deep); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: .74rem; font-weight: 700; background: var(--seafoam-l); color: var(--deep); }
.badge.gray { background: #e6edec; color: var(--muted); }
.badge.agonist { background: #cdeede; color: #0a5c3a; }
.badge.antagonist { background: #f6d9d2; color: #8a3320; }
.badge.modulator { background: #d9e4f6; color: #2a3f70; }
.badge.partial { background: #f3ead0; color: #7a5c12; }
.tag-sugar { font-size: .72rem; color: var(--teal); font-weight: 700; }

/* ---------- Plain tables (sources, catalog, MR) ---------- */
table.simple { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.simple th, table.simple td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
table.simple thead th { color: var(--deep); border-bottom: 2px solid var(--seafoam); font-weight: 700; }
table.simple td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.simple tbody tr:hover { background: #f4fbfa; }

.note {
  background: #eef8f6; border-left: 4px solid var(--seafoam);
  border-radius: 0 10px 10px 0; padding: 13px 16px; color: #234;
  font-size: .9rem; margin-top: 16px;
}
.note b { color: var(--deep); }
.kvs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.kvs .kv { background: #eef8f6; border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-size: .8rem; color: var(--muted); }
.kvs .kv b { color: var(--deep); }

.mr-rationale { color: var(--muted); font-size: .82rem; }

/* ---------- Explore (데이터·쿼리) ---------- */
.btn-primary {
  display: inline-block; background: var(--teal); color: #fff;
  font-weight: 700; font-size: .92rem; padding: 10px 18px; border-radius: 10px;
  box-shadow: var(--shadow); transition: background .15s;
}
.btn-primary:hover { background: var(--teal-2); text-decoration: none; color: #fff; }
.btn-go {
  font: inherit; font-size: .9rem; font-weight: 700;
  background: var(--teal); color: #fff; border: 0;
  padding: 8px 16px; border-radius: 9px; cursor: pointer; transition: background .15s;
}
.btn-go:hover { background: var(--teal-2); }

.subtabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.subtabs button {
  font: inherit; font-size: .86rem; font-weight: 600;
  background: #eef8f6; color: var(--teal); border: 1px solid var(--line);
  padding: 7px 14px; border-radius: 9px; cursor: pointer; transition: all .15s;
}
.subtabs button:hover { background: #e2f3f0; }
.subtabs button.active { background: var(--seafoam); color: var(--deep); border-color: var(--seafoam); }
.subpanel { display: none; }
.subpanel.active { display: block; }

/* ---------- Target explorer: quick-pick chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: .84rem; font-weight: 700;
  background: #eef8f6; color: var(--teal); border: 1px solid var(--line);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; transition: all .15s;
}
.chip:hover { background: var(--seafoam); color: var(--deep); border-color: var(--seafoam); }

/* ---------- Autocomplete ---------- */
.ac-wrap { position: relative; }
.ac-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); max-height: 320px; overflow-y: auto; min-width: 280px;
}
.ac-item {
  display: flex; flex-direction: column; gap: 1px;
  padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line);
}
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover { background: #eef8f6; }
.ac-label { font-weight: 700; color: var(--deep); font-size: .9rem; }
.ac-sub { font-size: .78rem; color: var(--muted); }

/* ---------- Dataset preview ---------- */
.btn-sm { padding: 5px 12px; font-size: .82rem; }
.preview-row td { background: #f7fbfb; padding: 12px; }
.preview-row table.data td { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sql-area {
  width: 100%; font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: .85rem; line-height: 1.5; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  background: #fbfdfd; resize: vertical; min-height: 110px;
}
.sql-area:focus { outline: 2px solid var(--seafoam); outline-offset: 0; border-color: var(--seafoam); }

.api-error {
  background: #fbe9e7; border-left: 4px solid #d35140; border-radius: 0 10px 10px 0;
  padding: 12px 16px; color: #8a3320; font-size: .9rem; margin-top: 6px;
  white-space: pre-wrap; word-break: break-word;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line); background: var(--deep); color: #bfe7e2;
  text-align: center; padding: 22px 20px; font-size: .84rem;
}
.site-footer b { color: #eafcfa; }
.site-footer .sep { opacity: .5; margin: 0 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .nav { display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; background: var(--deep-2); padding: 8px; gap: 2px; }
  .nav.open { display: flex; }
  .nav button { width: 100%; text-align: left; }
  .nav-toggle { display: inline-flex; margin-left: auto; background: rgba(255,255,255,.12);
    border: 0; color: #fff; border-radius: 9px; padding: 8px 12px; cursor: pointer; font: inherit; }
  .header-inner { position: relative; flex-wrap: wrap; }
  .wf-arrow { display: none; }
  .wf-step { flex: 1 1 100%; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.45rem; }
  .table-tools .count { margin-left: 0; width: 100%; }
}
