/* OSXPhotos-easy — single stylesheet, light/dark via prefers-color-scheme. */

:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface2: #eef1f5;
  --text: #1c2430;
  --muted: #5b6b7c;
  --border: #dde3ea;
  --accent: #2563eb;
  --accent-soft: #dbe7ff;
  --ok: #16a34a;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --danger: #dc2626;
  --code-bg: #0f172a;
  --code-text: #e2e8f0;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161b22;
    --surface2: #1f2630;
    --text: #e6edf3;
    --muted: #8d9bab;
    --border: #2b3441;
    --accent: #4f8ef7;
    --accent-soft: #16233c;
    --warn: #d97706;
    --warn-bg: #33260c;
    --code-bg: #0a0e14;
    --code-text: #dbe4ee;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}
[v-cloak] { display: none; }
code { font-family: var(--mono); font-size: 0.92em; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select {
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  outline: none;
  max-width: 100%;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  padding: 0;
}
.topbar-version { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.spacer { flex: 1; }
.langbtn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  color: var(--text);
  font-weight: 600;
}
.langbtn:hover { border-color: var(--accent); color: var(--accent); }

/* ------------------------------------------------------------------ home */
.home { max-width: 1080px; margin: 0 auto; padding: 24px 20px 60px; }
.hero { text-align: center; padding: 36px 0 22px; }
.hero h1 { margin: 0 0 10px; font-size: 34px; letter-spacing: -0.5px; }
.tagline { color: var(--muted); max-width: 640px; margin: 0 auto 22px; }
.bigsearch {
  width: min(560px, 100%);
  font-size: 16px;
  padding: 12px 18px;
  border-radius: 12px;
}
.hero-meta { color: var(--muted); font-size: 13px; margin-top: 14px; }

.home h2 { font-size: 20px; margin: 34px 0 4px; }
.section-hint { color: var(--muted); font-size: 13.5px; margin: 2px 0 12px; }

.recipe-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(240px, 300px);
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 10px;
}
.recipecard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.recipecard:hover { border-color: var(--accent); transform: translateY(-1px); }
.recipecard small { color: var(--muted); }
.recipecard code { color: var(--accent); font-size: 12px; }

.cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.cmdcard {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  transition: border-color 0.15s, transform 0.15s;
}
.cmdcard:hover { border-color: var(--accent); transform: translateY(-1px); }
.cmdcard-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cmdcard-head code { font-weight: 700; font-size: 15px; color: var(--accent); }
.cmdcard-help { font-size: 13.5px; color: var(--text); }
.cmdcard-meta { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--surface2);
  color: var(--muted);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge.mac { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.badge.any { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.dep { background: #fee2e2; color: var(--danger); border-color: transparent; }
@media (prefers-color-scheme: dark) { .badge.dep { background: #3a1214; } }
.badge.req { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.badge.tpl { background: var(--surface2); }

/* --------------------------------------------------------------- builder */
.builder {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px;
  align-items: start;
}
.backlink {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  margin-bottom: 10px;
  font-size: 14px;
}
.cmd-head h1 { margin: 0 0 6px; font-size: 24px; }
.cmd-head h1 code { color: var(--accent); }
.cmd-badges { display: flex; gap: 6px; margin-bottom: 8px; }
.cmd-short { margin: 4px 0; font-size: 15.5px; }
.cmd-platform { color: var(--muted); font-size: 13px; margin: 4px 0; }
.cmd-deprecated {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13.5px;
}
.cmd-links { font-size: 13.5px; margin: 6px 0; }
.fullhelp { margin: 10px 0; }
.fullhelp summary { cursor: pointer; color: var(--muted); font-size: 13.5px; }
.fullhelp pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 12.5px;
  max-height: 420px;
  overflow: auto;
}
.related-recipes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text);
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.args-section { margin-top: 14px; }
.args-section h3 { margin: 0 0 8px; font-size: 15px; color: var(--muted); }

.optfilter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px;
  position: sticky;
  top: 54px;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0;
}
.optfilter input { flex: 1; }
.optcount { color: var(--muted); font-size: 13px; white-space: nowrap; }

.group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}
.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 600;
  font-size: 14.5px;
}
.group-head:hover { background: var(--surface2); }
.caret { transition: transform 0.15s; color: var(--muted); }
.caret.open { transform: rotate(90deg); }
.group-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.group-body { border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ option row */
.opt { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.opt:last-child { border-bottom: none; }
.opt.set { box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent-soft) 30%, transparent); }
.opt-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.opt-name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-width: 180px; }
.opt-name > code { font-weight: 600; font-size: 13.5px; }
.clearbtn, .rmbtn, .tplbtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  padding: 4px 6px;
}
.clearbtn:hover, .rmbtn:hover { border-color: var(--danger); color: var(--danger); }
.tplbtn { font-family: var(--mono); }
.tplbtn:hover { border-color: var(--accent); color: var(--accent); }
.opt-control { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.occ { display: flex; gap: 6px; align-items: center; }
.occ input[type="text"], .occ input[type="number"] { width: 240px; }
.counter { width: 70px; }
.opt-help { margin: 8px 0 0; font-size: 13px; color: var(--muted); max-width: 72ch; white-space: pre-line; }
.opt-help.en-sub { opacity: 0.75; font-size: 12px; border-left: 2px solid var(--border); padding-left: 8px; }
.opt-meta { margin: 6px 0 0; font-size: 12px; color: var(--muted); display: flex; gap: 14px; }

/* toggle switch look for checkboxes */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.15s;
}
.switch span::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s, background 0.15s;
}
.switch input:checked + span { background: var(--accent); border-color: var(--accent); }
.switch input:checked + span::before { transform: translateX(18px); background: #fff; }

/* --------------------------------------------------------------- preview */
.preview { position: sticky; top: 66px; }
.preview-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.preview-head { display: flex; align-items: baseline; justify-content: space-between; }
.setcount { color: var(--muted); font-size: 12.5px; }
.cmdtext {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 14px;
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 52px;
  max-height: 40vh;
  overflow: auto;
}
.cmdtext.invalid { outline: 2px solid var(--danger); outline-offset: -2px; }
.missing { color: var(--danger); font-size: 13px; margin: 0; }
.missing code { background: var(--surface2); padding: 1px 5px; border-radius: 4px; }
.conflict {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  margin: 0;
}
.preview-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.preview-actions button {
  flex: 1;
  border-radius: 9px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
}
.preview-actions .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.preview-actions .primary:disabled { opacity: 0.45; cursor: not-allowed; }
.preview-toggles { display: flex; align-items: center; justify-content: space-between; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.ghost {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  padding: 4px 6px;
}
.ghost:hover { color: var(--danger); }
.hint { color: var(--muted); font-size: 12px; margin: 0; }

/* ----------------------------------------------------------------- modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: min(680px, 100%);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.fields { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-start;
  text-align: left;
  background: var(--surface2);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
}
.field:hover { border-color: var(--accent); }
.field-head { display: flex; gap: 8px; align-items: center; }
.field-head code { color: var(--accent); font-weight: 600; }
.field small { color: var(--muted); }

/* ---------------------------------------------------------------- footer */
.footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 18px;
  margin-top: 30px;
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 960px) {
  .builder { grid-template-columns: 1fr; }
  .preview { position: static; order: -1; }
  .occ input[type="text"], .occ input[type="number"] { width: 170px; }
  .opt-control { align-items: stretch; }
}
