:root {
  --ink: #0b1a2b;
  --ink-soft: #445064;
  --bg: #f7f6f2;
  --card: #ffffff;
  --accent: #1e3a8a;
  --accent-ink: #ffffff;
  --gold: #c9a86a;
  --line: #e6e4dd;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(11, 26, 43, 0.06), 0 8px 24px rgba(11, 26, 43, 0.06);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body.page {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.nav {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.logo { height: 32px; width: auto; display: block; }
.nav-title {
  font-weight: 600; letter-spacing: 0.02em;
  color: var(--ink); font-size: 15px;
}

.wrap {
  max-width: 640px; margin: 0 auto; padding: 48px 24px 80px;
}
.wrap h1 {
  font-size: 32px; line-height: 1.15; margin: 0 0 8px; letter-spacing: -0.01em;
}
.lede { color: var(--ink-soft); margin: 0 0 32px; font-size: 16px; }
.muted { color: var(--ink-soft); font-weight: 400; font-size: 13px; }

.form { display: grid; gap: 18px; }
.form label {
  display: grid; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--ink);
}
.form input, .form textarea {
  font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form input:focus, .form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.12);
}
.form textarea { resize: vertical; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

.url-fields { display: grid; gap: 10px; }
.field-heading { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 2px; }
#rows { display: grid; gap: 12px; }

.row {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; display: grid; gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30, 58, 138, 0.08);
}
.row-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.row-ctrls { display: flex; gap: 4px; }
.row input[type=url] {
  font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px;
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px;
}
.row input[type=url]:focus { outline: none; border-color: var(--accent); }

.icon {
  width: 30px; height: 30px; padding: 0;
  background: #fff; border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink-soft); font-size: 15px; line-height: 1;
  cursor: pointer; transition: background 0.12s, color 0.12s, border-color 0.12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon:hover:not(:disabled) { background: #f1efe8; color: var(--ink); border-color: #d7d4c9; }
.icon:disabled { opacity: 0.35; cursor: not-allowed; }
.icon.remove:hover:not(:disabled) { color: var(--danger); border-color: #f0c8c3; background: #fdf3f1; }

.add-btn {
  background: transparent; color: var(--accent);
  border: 1px dashed #b9c4dd; border-radius: 10px;
  padding: 11px 14px; font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.add-btn:hover:not(:disabled) { background: rgba(30, 58, 138, 0.05); border-color: var(--accent); }
.add-btn:disabled { opacity: 0.5; cursor: not-allowed; color: var(--ink-soft); border-color: var(--line); }

.form button[type=submit] {
  margin-top: 4px;
  background: var(--ink); color: #fff;
  border: 0; border-radius: 10px; padding: 13px 20px;
  font: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; transition: background 0.15s;
}
.form button[type=submit]:hover:not(:disabled) { background: #1a2e48; }
.form button[type=submit]:disabled { opacity: 0.6; cursor: wait; }

.out {
  margin-top: 28px; padding: 20px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.ok { margin: 0 0 12px; font-weight: 600; }
.link-row { display: flex; gap: 8px; }
.link-row input {
  flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 13px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
}
.link-row button {
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: 0 16px; border-radius: 8px; font-weight: 600; cursor: pointer;
}
.secondary {
  display: inline-block; margin-top: 12px;
  color: var(--accent); text-decoration: none; font-weight: 500; font-size: 14px;
}
.secondary:hover { text-decoration: underline; }
.err { color: var(--danger); margin-top: 16px; }

/* ---------- Collection page ---------- */
.collection .hero {
  max-width: 960px; margin: 0 auto; padding: 56px 24px 24px;
}
.collection .hero h1 {
  font-size: 36px; line-height: 1.1; margin: 0 0 8px; letter-spacing: -0.01em;
}
.collection .hero .lede { margin-bottom: 16px; }
.count-chip {
  display: inline-block; padding: 4px 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  font-size: 13px; color: var(--ink-soft); font-weight: 500;
}

.grid {
  max-width: 960px; margin: 0 auto; padding: 24px 24px 64px;
  display: grid; gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  display: flex; flex-direction: column;
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none; color: inherit;
  overflow: hidden; transition: transform 0.18s ease, box-shadow 0.18s ease;
  border: 1px solid var(--line);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(11, 26, 43, 0.08), 0 12px 32px rgba(11, 26, 43, 0.1);
}
.card-img {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, #1e3a8a 0%, #0b1a2b 100%);
  background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center;
}
.card-img .placeholder {
  color: var(--gold); font-weight: 700; font-size: 28px; letter-spacing: 0.1em;
}
.card-body { padding: 16px 18px 18px; display: grid; gap: 8px; }
.card-body h3 {
  margin: 0; font-size: 16px; line-height: 1.3; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body p {
  margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-body .cta {
  margin-top: 4px; font-size: 13px; font-weight: 600; color: var(--accent);
}

.foot {
  border-top: 1px solid var(--line);
  padding: 24px; text-align: center;
  display: flex; gap: 10px; align-items: center; justify-content: center;
  color: var(--ink-soft); font-size: 13px;
}
.foot-logo { height: 20px; opacity: 0.7; }

@media (max-width: 600px) {
  .wrap { padding: 32px 20px 64px; }
  .wrap h1, .collection .hero h1 { font-size: 26px; }
  .collection .hero { padding: 40px 20px 16px; }
  .grid { padding: 16px 20px 48px; }
}
