/* Visual system follows the Notion DESIGN.md.
   Page sections stay in the CATH order: hero, notice, feature cards, two panels. */

:root {
  color-scheme: dark;
  --bg: #191918;
  --surface: #31302e;
  --field: #252422;
  --field-focus: #3a3835;
  --ink: rgba(255, 255, 255, 0.95);
  --label: rgba(255, 255, 255, 0.95);
  --soft: #a39e98;
  --muted: #a39e98;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.16);
  --ghost-bg: rgba(255, 255, 255, 0.08);
  --ghost-hover: rgba(255, 255, 255, 0.12);
  --accent: #0075de;
  --accent-hover: #1a86ea;
  --accent-ink: #ffffff;
  --accent-dim: rgba(0, 117, 222, 0.18);
  --link: #62aef0;
  --danger: #ff8a3d;
  --hero: #252422;
  --radius: 4px;
  --card-radius: 12px;
  --shadow: rgba(0, 0, 0, 0.28) 0px 14px 28px, rgba(0, 0, 0, 0.18) 0px 4px 12px;
  --shadow-soft: rgba(0, 0, 0, 0.22) 0px 4px 14px;
  --font: Inter, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --display: Inter, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SFMono-Regular", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  font-feature-settings: "lnum", "locl";
  background: var(--bg);
}

button, input, select { font: inherit; color: inherit; }

button {
  transition:
    background-color 0.2s var(--ease),
    color 0.2s var(--ease),
    border-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.15s var(--ease),
    opacity 0.2s var(--ease);
}

.ghost:active:not(:disabled) { background: var(--ghost-hover); }

.primary:active:not(:disabled) { background: var(--accent-hover); }

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.landing { flex: 1 0 auto; }

.mast {
  position: sticky;
  top: 0;
  z-index: 3;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.mast-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.mast-start {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.hero-logo-card {
  display: block;
  flex: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.hero-logo {
  display: block;
  width: auto;
  height: 40px;
  background: transparent;
}

.brand strong {
  color: var(--ink);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mast-menu {
  position: relative;
  margin-bottom: -8px;
  padding-bottom: 8px;
}

.menu-panel {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  min-width: 300px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.menu-list,
.menu-sub ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-branch { position: relative; }

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.menu-link:hover,
.menu-link[aria-expanded="true"] { background: var(--ghost-bg); }

.menu-link.is-current {
  background: var(--accent-dim);
  color: var(--link);
}

.menu-caret {
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
}

.menu-caret-down {
  margin-left: 0;
  margin-top: -2px;
  transform: rotate(45deg);
}

.menu-sub {
  position: absolute;
  top: -6px;
  left: 100%;
  padding: 6px 0 6px 8px;
}

.menu-sub ul {
  min-width: 240px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--hero);
  color: var(--ink);
  padding: 56px 0 48px;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: url("/static/hero-dna.png") center / cover no-repeat;
  opacity: 0.55;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  z-index: 1;
}

.hero-copy { min-width: 0; }

.hero h1 {
  margin: 0;
  min-width: 0;
  color: var(--ink);
  font-size: 48px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1.5px;
}

.hero h1 small {
  margin-left: 10px;
  color: var(--muted);
  font-size: 0.42em;
  font-weight: 600;
  letter-spacing: 0;
}

.hero p {
  max-width: 40rem;
  margin: 16px 0 0;
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.125px;
}

.notice-panel {
  margin-top: 24px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.notice-panel p {
  margin: 0;
  color: var(--soft);
  font-size: 16px;
}

.crumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.crumb a {
  color: var(--link);
  text-decoration: none;
}

.crumb a:hover,
.crumb-button:hover { text-decoration: underline; }

.crumb-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

body.picker-open { overflow: hidden; }

.picker {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.4);
}

.picker-card {
  width: min(520px, 100%);
  max-height: min(640px, calc(100dvh - 48px));
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.picker-card h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.25px;
}

.picker-options {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.picker-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.picker-option:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.picker-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.crumb [aria-current="page"] {
  color: var(--ink);
  font-weight: 600;
}

.page-feature { padding-top: 20px; }

body[data-view="home"] .work-row,
body[data-view="module"] .work-row,
body[data-view="missing"] .work-row,
body[data-view="tool"] .page-feature,
body[data-view="missing"] .page-feature,
body[data-view="tool"] .notice-panel { display: none; }

#nav {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
  padding: 0;
}

.feature-card {
  display: flex;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.feature-card:hover {
  box-shadow: var(--shadow);
}

.feature-card.is-current {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.feature-hit {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  min-height: 180px;
  padding: 18px 18px 16px;
  border: 0;
  border-radius: var(--card-radius);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.feature-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.feature-hit-module {
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
}

.feature-icon {
  display: block;
  width: 52px;
  height: 52px;
  flex: none;
  align-self: flex-start;
  background: var(--icon) center / contain no-repeat;
}

.feature-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.feature-title {
  color: var(--ink);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.27;
  letter-spacing: -0.25px;
}

.feature-copy {
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.feature-go {
  margin-top: auto;
  color: var(--accent);
  font-size: 14px;
  font-weight: 400;
}

.work-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
  margin: 8px 0 40px;
}

.white-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--card-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

main {
  display: contents;
}

#panel { display: block; }

.panel-body { padding: 28px 32px 16px; }

.dock-actions {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 32px;
  border-top: 1px solid var(--line);
  background: transparent;
}

#form-error { margin: 0; flex: 1; min-width: 12rem; }

h1 {
  margin: 0;
  font-family: var(--display);
  font-size: 26px;
  line-height: 1.23;
  letter-spacing: -0.625px;
  font-weight: 700;
  color: var(--ink);
}

.summary {
  margin: 10px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.folder, .notice {
  margin: 8px 0 0;
  max-width: 68ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.folder { font-family: var(--mono); font-size: 13px; }

.ghost,
.primary {
  min-height: 42px;
  padding: 0 14px;
  border-radius: var(--radius);
  white-space: nowrap;
  cursor: pointer;
}

.ghost {
  border: 1px solid transparent;
  background: var(--ghost-bg);
  color: var(--ink);
  font-weight: 600;
  font-size: 15px;
}

.primary {
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 15px;
  box-shadow: none;
}

.primary:hover:not(:disabled) { background: var(--accent-hover); }

.ghost:hover:not(:disabled) {
  color: var(--ink);
  border-color: transparent;
  background: var(--ghost-hover);
}

.menu-button.ghost,
.menu-button.ghost:hover,
.menu-button.ghost:active,
.menu-button.ghost[aria-expanded="true"] {
  background: transparent;
}

.mast-contact {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.mast-contact.ghost,
.mast-contact.ghost:hover,
.mast-contact.ghost:active,
.mast-contact.ghost:focus {
  background: transparent;
}

.primary:disabled,
.ghost:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

form {
  max-width: none;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

legend {
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 8px;
}

.modes label, .check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 32px;
}

.check > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.modes input, .check input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field .label, .check .label {
  color: var(--label);
  font-size: 14px;
  font-weight: 400;
}

.help, .error, #form-error {
  font-size: 13px;
  line-height: 1.45;
}

.help { color: var(--muted); }

.error, #form-error { color: var(--danger); }

#form-error:empty, .error:empty { display: none; }

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  font-size: 17px;
}

.field input::placeholder { color: var(--muted); opacity: 0.75; }

.field input[type="text"]:hover,
.field input[type="number"]:hover,
.field select:hover { border-color: var(--line-strong); }

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--field-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"] { border-color: var(--danger); }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.upload-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
}

.upload-field .meter,
.upload-field .upload-status { grid-column: 1 / -1; }

.upload-status {
  min-height: 1.2em;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--soft);
}

.upload-status:empty { display: none; }

.upload-status[data-state="done"] { color: var(--accent); }

.upload-status[data-state="error"] { color: var(--danger); }

.upload-button { min-height: 42px; }

.file-picker {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.run-progress {
  padding: 0 32px 8px;
}

.run-progress:not([hidden]) { display: grid; gap: 6px; }

.run-progress p { margin: 0; color: var(--muted); font-size: 13px; }

.meter {
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

.meter.indeterminate > span {
  width: 35%;
  animation: meter-slide 1.1s ease-in-out infinite;
}

@keyframes meter-slide {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.result-banner:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 32px 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--accent-dim);
}

.result-banner p { margin: 0; flex: 1; min-width: 12rem; }

.distribution:not([hidden]) { display: grid; gap: 18px; }

.dist-block h3 {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 600;
}

.dist-row {
  display: grid;
  grid-template-columns: 7.5rem 2.5rem minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-top: 6px;
  font-size: 13px;
}

.dist-count { color: var(--muted); }

.dist-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.dist-bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.fasta {
  width: 100%;
  min-height: 148px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
}

.fasta:hover { border-color: var(--line-strong); }

.fasta:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--field-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.choose-file { width: 100%; }

.job-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.job-suffix { color: var(--muted); }

.species-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.species-option { min-width: 92px; }

.species-option[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  border-color: transparent;
}

.predator-actions { justify-content: center; }

#logdock {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 22px 24px 20px;
}

.log-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.log-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.25px;
  color: var(--ink);
}

#log-status {
  margin: 0;
  flex: 1;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}

#log {
  min-height: 4.5rem;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.log-empty {
  margin: 0;
  color: var(--muted);
  font-family: var(--font);
}

.site-foot {
  margin-top: 12px;
  padding: 40px 0 56px;
  background: var(--hero);
  color: var(--muted);
}

body:not([data-view="home"]) .site-foot { display: none; }

.site-foot section + section { margin-top: 28px; }

.copyright {
  margin: 40px 0 0 !important;
  color: var(--ink);
  font-weight: 700;
  text-align: center;
}

#contact { scroll-margin-top: 80px; }

.site-foot h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  line-height: 1.4;
}

.site-foot p { margin: 0; }

.site-foot a {
  color: inherit;
  text-decoration: none;
}

.site-foot a:hover { color: var(--link); }

@media (max-width: 1024px) {
  #nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .hero h1 { font-size: 32px; letter-spacing: -0.8px; }
}

@media (max-width: 640px) {
  #nav { grid-template-columns: 1fr; }

  .menu-panel { width: min(320px, calc(100vw - 32px)); min-width: 0; }

  .menu-link { white-space: normal; }

  .menu-sub {
    position: static;
    padding: 0 0 4px 12px;
  }

  .menu-sub ul { min-width: 0; box-shadow: none; }

  .panel-body { padding: 16px 14px 12px; }

  .dock-actions,
  #logdock { padding-left: 14px; padding-right: 14px; }

  .run-progress { padding-left: 14px; padding-right: 14px; }

  .result-banner:not([hidden]) { margin-left: 14px; margin-right: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }

  .ghost:active:not(:disabled),
  .primary:active:not(:disabled) { background: inherit; }

  .meter.indeterminate > span { width: 100%; animation: none; }
}
