/* Link Generator — generator.a9c.site
   Theme-aware (light default, dark via prefers-color-scheme). No external deps. */

:root {
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --fg: #141a24;
  --muted: #5a6677;
  --faint: #8a95a6;
  --line: #dde3ee;
  --line-2: #e9eef5;
  --accent: #3461e0;
  --accent-fg: #ffffff;
  --accent-soft: #e7edfc;
  --ok: #157a52;
  --ok-bg: #e3f3ea;
  --warn: #9a5b00;
  --warn-bg: #fbf0dd;
  --warn-line: #ecd6ac;
  --radius: 14px;
  --shadow: 0 10px 30px -18px rgba(20, 30, 60, .5);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1119;
    --surface: #131c28;
    --surface-2: #0f1824;
    --fg: #e7edf5;
    --muted: #93a0b2;
    --faint: #6b7889;
    --line: #243141;
    --line-2: #1b2634;
    --accent: #5a8cff;
    --accent-fg: #0b1119;
    --accent-soft: #17283f;
    --ok: #5bc291;
    --ok-bg: #102a20;
    --warn: #e0a94e;
    --warn-bg: #2a2112;
    --warn-line: #4a3a1c;
    --shadow: 0 12px 34px -18px rgba(0, 0, 0, .75);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background:
    radial-gradient(1100px 500px at 100% -5%, var(--accent-soft), transparent 60%),
    var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

.shell {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding-inline: 16px;
  padding-block: calc(28px + env(safe-area-inset-top, 0px)) calc(36px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- header ---- */
.head { text-align: left; }
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(24px, 6vw, 30px);
  font-weight: 800;
  letter-spacing: -.02em;
}
.logo {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--accent);
  box-shadow: var(--shadow);
  font-size: 22px;
}
.tagline { margin: 10px 0 0; color: var(--muted); font-size: 15px; max-width: 48ch; }

.stats { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--fg);
}
.stat b { font-weight: 700; }
.stat .dot { font-size: 13px; }

/* ---- cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field > label, .field-label {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
}

input#domain {
  width: 100%;
  font: inherit;
  font-size: 16px;
  color: var(--fg);
  background: var(--surface-2);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  transition: border-color .15s, box-shadow .15s;
}
input#domain::placeholder { color: var(--faint); }
input#domain:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input#domain.invalid { border-color: #d9534f; }

.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.hint.error { color: #d9534f; }

/* segmented + chips share a tactile button look */
.segmented, .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg, .chip {
  font: inherit;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: 11px;
  transition: border-color .15s, background .15s, color .15s, transform .05s;
}
.seg { flex: 1 1 auto; padding: 11px 12px; font-weight: 600; font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.seg small { color: var(--faint); font-weight: 500; }
.chip { min-width: 54px; padding: 10px 14px; font-weight: 700; font-size: 15px; text-align: center; }
.seg:active, .chip:active { transform: translateY(1px); }
.seg[aria-pressed="true"], .chip[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
}
.seg[aria-pressed="true"] small { color: var(--accent-fg); opacity: .85; }
.seg:focus-visible, .chip:focus-visible, .generate:focus-visible, .copy-all:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.generate {
  font: inherit;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  box-shadow: var(--shadow);
  transition: filter .15s, transform .05s;
}
.generate:hover { filter: brightness(1.05); }
.generate:active { transform: translateY(1px); }
.generate[disabled] { opacity: .6; cursor: progress; }

.form-error {
  margin: 0;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

/* ---- result ---- */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-summary { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -.01em; min-width: 0; }
.copy-all {
  font: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  color: var(--fg);
  border-radius: 10px;
  padding: 8px 12px;
  white-space: nowrap;
}
.copy-all:hover { border-color: var(--accent); }

.warn {
  margin: 0;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13.5px;
}

.links-box {
  width: 100%;
  min-height: 150px;
  max-height: 320px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.7;
  color: var(--fg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px;
  white-space: pre;
  overflow: auto;
}

.link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.link-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 10px;
  padding: 7px 8px 7px 12px;
  min-width: 0;
}
.link-list a {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-list a:hover { text-decoration: underline; }
.row-copy {
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 8px;
  padding: 5px 9px;
  white-space: nowrap;
}
.row-copy:hover { color: var(--fg); border-color: var(--accent); }

/* ---- misc ---- */
.foot { text-align: center; color: var(--faint); font-size: 12.5px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  background: var(--fg);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: var(--shadow);
  z-index: 50;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

@media (max-width: 480px) {
  .seg { flex-basis: 100%; }
}

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