/* HtaccessGen — dark "server config" theme.
   Rose primary + sky accent (from site.config.json), cool dark surfaces.
   Declared in both modes so the palette is identical regardless of
   prefers-color-scheme and load order. */

:root {
  --bg: #0f0d11;
  --surface: #16131a;
  --surface-2: #1e1a24;
  --text: #efe9ee;
  --text-dim: #a99fae;
  --border: #352c3c;
  --hg-ok: #9ccc65;
  --hg-bad: #ff8a65;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0d11;
    --surface: #16131a;
    --surface-2: #1e1a24;
    --text: #efe9ee;
    --text-dim: #a99fae;
    --border: #352c3c;
  }
}
html {
  color-scheme: dark;
}

/* ---------- generator shell ---------- */
.hg {
  margin: 1.4rem 0 1.8rem;
}
@media (min-width: 54rem) {
  .prose .hg {
    width: min(66rem, calc(100vw - 2.5rem));
  }
}
.hg-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 1.1rem;
  align-items: start;
}
@media (max-width: 60rem) {
  .hg-cols { grid-template-columns: 1fr; }
}

/* ---------- form column ---------- */
.hg-form { min-width: 0; }

.hg-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
}
.hg-presets > span {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-inline-end: 0.2rem;
}
.hg-mini {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.32rem 0.7rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}
.hg-mini:hover { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); }

.hg-sec {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0.55rem 0.8rem 0.75rem;
  margin: 0 0 0.6rem;
}
.hg-sec legend {
  padding: 0 0.35rem;
  font-size: 0.9rem;
}
.hg-sec legend label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  min-height: 1.9rem;
}
.hg-sec legend input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
  cursor: pointer;
}
.hg-sec.off legend label { color: var(--text-dim); }
.hg-sec.off .hg-sub { opacity: 0.45; }
.hg-sec.off .hg-sub input:disabled,
.hg-sec.off .hg-sub select:disabled,
.hg-sec.off .hg-sub textarea:disabled,
.hg-sec.off .hg-sub button:disabled { cursor: not-allowed; }
.hg-sec.plain legend { font-weight: 700; color: var(--text); }

.hg-sub { display: flex; flex-direction: column; gap: 0.6rem; transition: opacity 0.15s; }
.hg-f { display: flex; flex-direction: column; gap: 0.28rem; min-width: 0; }
.hg-f > span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hg-f code { font-size: 0.85em; }
.hg-row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}
@media (max-width: 30rem) {
  .hg-row2 { grid-template-columns: 1fr; }
}
.hg-check {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
}
.hg-check input { accent-color: var(--primary); width: 1rem; height: 1rem; margin: 0; }
.hg-hint {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-dim);
}
.hg-hint code { font-size: 0.76rem; }

.hg input[type="text"],
.hg input:not([type]),
.hg input[type="email"],
.hg textarea,
.hg select {
  font-family: var(--mono);
  font-size: 0.92rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hg textarea {
  resize: vertical;
  min-height: 3.4rem;
  line-height: 1.5;
}
.hg select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 1rem) 55%, calc(100% - 0.7rem) 55%;
  background-size: 0.3rem 0.3rem;
  background-repeat: no-repeat;
  padding-inline-end: 1.8rem;
}
.hg input:focus, .hg textarea:focus, .hg select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.hg input::placeholder, .hg textarea::placeholder { color: #6d6274; }

/* ---------- redirect / error-doc rows ---------- */
.hg-rows { display: flex; flex-direction: column; gap: 0.4rem; }
.hg-rrow {
  display: grid;
  grid-template-columns: 7.6rem 1fr 1fr 2rem;
  gap: 0.4rem;
  align-items: center;
}
.hg-erow {
  display: grid;
  grid-template-columns: 4.6rem 1fr 2rem;
  gap: 0.4rem;
  align-items: center;
}
.hg-x {
  font: inherit;
  font-size: 1.05rem;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  cursor: pointer;
}
.hg-x:hover { color: var(--hg-bad); border-color: var(--hg-bad); }
@media (max-width: 30rem) {
  .hg-rrow { grid-template-columns: 1fr; }
  .hg-rrow .hg-x { justify-self: end; }
  .hg-erow { grid-template-columns: 4.6rem 1fr 2rem; }
}

/* ---------- output column ---------- */
.hg-out {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 34px -20px rgba(0, 0, 0, 0.75);
}
@media (min-width: 60rem) {
  .hg-out { position: sticky; top: 0.9rem; }
}
.hg-outbar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.hg-outname {
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
}
.hg-outname::before { content: '≡ '; color: var(--accent); }
.hg-outmeta {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-inline-start: auto;
}
.hg-btn {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}
.hg-btn:hover { border-color: color-mix(in srgb, var(--primary) 60%, var(--border)); }
.hg-btn.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.hg-btn.primary:hover { filter: brightness(1.1); }

.hg-code {
  margin: 0;
  padding: 0.85rem 0.95rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
  overflow-x: auto;
  max-height: 34rem;
  overflow-y: auto;
  white-space: pre;
  tab-size: 4;
}
.hg-code code { background: none; padding: 0; color: inherit; font-size: inherit; }

.hg-notes {
  margin: 0;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent) 7%, var(--bg));
}
.hg-notes ul { margin: 0; padding-inline-start: 1.1rem; }
.hg-notes li {
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
}
.hg-notes li:last-child { margin-bottom: 0; }

.hg-status {
  margin: 0;
  padding: 0.55rem 0.9rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  min-height: 1.6em;
}
.hg-status.ok { color: var(--hg-ok); }
.hg-status.bad { color: var(--hg-bad); }

/* ---------- article polish ---------- */
.prose pre { background: var(--bg); border: 1px solid var(--border); }
.prose code { background: var(--surface-2); }
.prose pre code { background: none; }
.prose table code { white-space: nowrap; }

@media (max-width: 480px) {
  .hg-sec { padding: 0.5rem 0.6rem 0.7rem; }
  /* ≥40px touch targets on phones */
  .hg input[type="text"], .hg input:not([type]), .hg select { min-height: 2.5rem; }
  .hg-mini, .hg-btn { min-height: 2.5rem; }
  .hg-x { width: 2.5rem; height: 2.5rem; }
  .hg-check, .hg-sec legend label { min-height: 2.5rem; }
  .hg-code { font-size: 0.75rem; max-height: 26rem; }
}
