/* htaccess.tools global styles */

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: #f8f8f6;
  color: #131313;
  font-family: "IBM Plex Sans", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-wrap: pretty;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: #131313; text-decoration: underline; text-underline-offset: 3px; }
a:hover { background: oklch(0.9 0.18 95); }
::selection { background: oklch(0.9 0.18 95); }
button:focus-visible, a:focus-visible { outline: 2px solid #131313; outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid #131313; outline-offset: -2px; }

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

/* One content width across the whole site, so the logo, the hero and the
   footer all line up on every page. */
main { max-width: 1000px; width: 100%; margin: 0 auto; padding: 0 20px 100px; flex: 1 0 auto; }

.spacer { flex: 1 1 auto; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.meta { font-family: "IBM Plex Mono", monospace; font-size: 12.5px; color: #8a8a8a; }

/* Site header + animated logo */
.site-head { padding: 56px 0 0; }
.site-head-inner { max-width: 1000px; margin: 0 auto; padding: 0 20px; position: relative; }

/* Top-right minimal link (google.com style). Sibling tools live here because
   they matter more to a visitor than this site's own pages, which sit in the
   footer. Absolute, so the logo keeps the same position it has on every
   other site in the family. */
.head-links {
  position: absolute;
  top: 22px;
  right: 20px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: baseline;
  gap: 4px 16px;
  max-width: calc(100% - 40px);
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
}
.head-links a { color: #8a8a8a; text-decoration: none; }
.head-links a:hover { color: #131313; text-decoration: underline; text-underline-offset: 3px; }
.head-links-label { color: #b5b5b5; }

.logo { display: inline-block; position: relative; width: 210px; text-decoration: none; }
.logo:hover { background: transparent; }
.logo img { display: block; width: 100%; height: auto; }

/* The typed word sits inside the empty bar of the outline logo. Percentages
   are measured from the artwork so the two stay locked together at any size. */
.logo-type {
  position: absolute;
  left: 7.3%;
  top: 0;
  height: 70.4%;
  display: flex;
  align-items: center;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 26px;
  line-height: 1;
  letter-spacing: 0.028em;
  white-space: nowrap;
}
.logo-word { font-weight: 800; color: #1a1a19; }
.logo-caret {
  display: inline-block;
  width: 3px;
  height: 0.74em;
  margin-left: 3px;
  background: #fccd4d;
  animation: caret-blink 0.85s step-end infinite;
}
.logo-caret.done { display: none; }
/* Without JS the logo text is never typed, so render it statically.
   Kept in the stylesheet because the CSP forbids inline <style>. */
.no-js .logo-word::after { content: "HTACCESS"; }
.no-js .logo-caret { display: none; }
@keyframes caret-blink { 50% { opacity: 0; } }

/* Three sibling tools do not fit on one line next to the logo on a phone, so
   below this width the nav drops into the flow underneath it. */
@media (max-width: 700px) {
  .site-head { padding: 16px 0 0; }
  .site-head-inner {
    display: flex;
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 12px;
  }
  .head-links {
    position: static;
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }
  .logo { width: 162px; }
  .logo-type { font-size: 20px; }
}

/* Hero */
.hero { padding: 56px 0 44px; }
.tool-hero { padding-bottom: 30px; }

h1 {
  margin: 0 0 16px;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: clamp(38px, 5.4vw, 62px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 700;
  max-width: 20ch;
}
.hl { background: oklch(0.9 0.18 95); padding: 0 0.04em; }

.lede { margin: 0 0 32px; font-size: 17px; line-height: 1.55; color: #565656; max-width: 58ch; }
code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9em;
  background: #f0f0ec;
  padding: 1px 5px;
  border-radius: 3px;
}

button { cursor: pointer; }

.btn-primary {
  background: #131313;
  color: oklch(0.9 0.18 95);
  border: 0;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 15px;
  font-weight: 700;
  padding: 12px 24px;
  min-height: 44px;
  border-radius: 6px;
}
.btn-primary:hover:not(:disabled) { background: #2e2e2e; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  border: 1px solid #131313;
  color: #131313;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  min-height: 44px;
  border-radius: 6px;
}
.btn-secondary:hover:not(:disabled) { background: oklch(0.9 0.18 95); }
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 0;
  color: #8a8a8a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13.5px;
  padding: 12px 8px;
  min-height: 44px;
}
.btn-ghost:hover:not(:disabled) { color: #131313; }
.btn-ghost:disabled { color: #c9c9c9; cursor: not-allowed; }

/* Landing page */
main.home { max-width: 860px; }
.home-hero { padding: 64px 0 40px; }
.home-hero h1 { max-width: 16ch; }
.home-hero .lede { margin-bottom: 34px; max-width: 54ch; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 26px;
}
.btn-cta {
  display: inline-flex;
  align-items: center;
  background: #131313;
  color: oklch(0.9 0.18 95);
  border-radius: 6px;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding: 15px 30px;
  min-height: 52px;
  text-decoration: none;
}
.btn-cta:hover { background: #2e2e2e; color: oklch(0.9 0.18 95); }
.cta-link { font-size: 15px; color: #565656; text-underline-offset: 4px; }
.cta-note { margin: 16px 0 0; }

.home-sample { margin: 8px 0 0; }
.sample-caption {
  margin: 0 0 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a8a8a;
}
/* Two classes deep so it beats the min-height on .output-code, which is sized
   to fill the tool panel rather than to hug a six line sample. */
.home-sample .sample-code {
  min-height: 0;
  border-radius: 4px;
  font-size: 12px;
}
@media (max-width: 560px) {
  .home-sample .sample-code { font-size: 11px; padding: 14px; }
}

.home-copy { padding-top: 64px; }

.feature-list { margin: 24px 0 8px; }
.feature-list dt {
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-top: 16px;
  border-top: 1px solid #e4e4e0;
}
.feature-list dd {
  margin: 6px 0 16px;
  font-size: 15.5px;
  line-height: 1.6;
  color: #3a3a3a;
}

/* Presets */
.presets { margin-top: 4px; }
.presets-label {
  display: block;
  margin-bottom: 10px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8a8a8a;
}
.presets-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-preset {
  background: #fff;
  border: 1px solid #d8d8d2;
  border-radius: 4px;
  font-family: "IBM Plex Sans", Helvetica, Arial, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #131313;
  padding: 9px 15px;
  min-height: 40px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.btn-preset:hover { border-color: #131313; background: oklch(0.9 0.18 95); }
.btn-preset.is-active {
  border-color: #131313;
  background: #131313;
  color: oklch(0.9 0.18 95);
  font-weight: 600;
}
.btn-preset-clear { color: #8a8a8a; border-style: dashed; }
.btn-preset-clear:hover { color: #131313; }

/* Builder layout */
.builder {
  display: grid;
  /* The output panel gets the wider track: config lines are long. */
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 36px;
  align-items: start;
}
/* minmax(0, ...) on every track, and min-width on the items: without it the
   automatic minimum size stretches a column to the longest line of output
   instead of letting that line scroll inside its own panel. */
.builder-options, .builder-output { min-width: 0; }
@media (max-width: 980px) {
  .builder { grid-template-columns: minmax(0, 1fr); gap: 28px; }
}

.apache-note {
  margin: 0 0 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #565656;
  border-left: 3px solid oklch(0.9 0.18 95);
  padding-left: 12px;
}
.apache-note strong { font-weight: 600; }

.conflict-box { margin-bottom: 18px; }
.conflict-box .issue-list { margin-top: 0; }

/* Option groups */
.builder-options { border-top: 2px solid #131313; }

.opt-group {
  border-bottom: 1px solid #e4e4e0;
  background: #fff;
}
.opt-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 14px;
  cursor: pointer;
  list-style: none;
  transition: background 0.18s ease;
}
.opt-head::-webkit-details-marker { display: none; }
.opt-head:hover { background: #faf9f6; }
.opt-head:focus-visible { outline: 2px solid #131313; outline-offset: -2px; }

.opt-title {
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.opt-count {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11.5px;
  color: #8a8a8a;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.audit-chevron {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-right: 2px solid #8a8a8a;
  border-bottom: 2px solid #8a8a8a;
  transform: rotate(-45deg);
  transition: transform 0.26s ease, border-color 0.18s ease;
}
.opt-group[open] > .opt-head .audit-chevron { transform: rotate(45deg); }
.opt-head:hover .audit-chevron { border-color: #131313; }

.section-wrap {
  overflow: hidden;
  transition: height 0.26s ease;
}
@media (prefers-reduced-motion: reduce) {
  .section-wrap { transition: none; }
}

.opt-body {
  padding: 6px 14px 24px;
  border-top: 1px solid #f2f2f0;
}

/* Checkbox rows */
.opt-check {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 11px 0;
  cursor: pointer;
  border-bottom: 1px solid #f4f4f1;
}
.opt-check:last-child { border-bottom: 0; }
.opt-check input[type="checkbox"] {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  accent-color: #131313;
  cursor: pointer;
}
.opt-check-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.opt-check-title { font-size: 15px; font-weight: 600; line-height: 1.35; }
.opt-check-note { font-size: 13px; line-height: 1.5; color: #6a6a6a; }

.opt-check-sm { padding: 7px 0; border-bottom: 0; }
.opt-check-sm .opt-check-title { font-size: 13.5px; font-weight: 500; font-family: "IBM Plex Mono", monospace; }
.opt-check-sm .opt-check-note { font-size: 12.5px; }

/* Mutually exclusive choices: a master checkbox turns the rule on, radios
   pick which direction. Two contradictory rules cannot be selected at all. */
.radio-set {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 4px;
}
.opt-radio {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 8px 10px;
  cursor: pointer;
  border-radius: 3px;
  border: 1px solid transparent;
}
.opt-radio:hover { background: #f2f2ee; }
.opt-radio input[type="radio"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: #131313;
  cursor: pointer;
}
.opt-radio:has(input:checked) {
  background: #fff;
  border-color: #dcdcd6;
  box-shadow: inset 2px 0 0 oklch(0.9 0.18 95);
}
.opt-radio .opt-check-title { font-size: 14.5px; font-weight: 600; }
.opt-radio .opt-check-note { font-size: 12.5px; }

.opt-block { padding: 14px 0 4px; border-bottom: 1px solid #f4f4f1; }
.opt-block > .opt-check-title { display: block; font-size: 15px; font-weight: 600; }
.opt-block > .opt-check-note { display: block; font-size: 13px; line-height: 1.5; color: #6a6a6a; margin-top: 3px; }

/* Sub panels revealed by their parent checkbox */
.opt-sub {
  margin: 2px 0 14px 28px;
  padding: 14px 16px;
  background: #faf9f6;
  border-left: 2px solid #e4e4e0;
  transition: opacity 0.2s ease;
}
.opt-sub.is-off { opacity: 0.42; }
.opt-sub.is-off .field-input { background: #f2f2ee; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; flex: 1 1 200px; }
.field:last-child { margin-bottom: 0; }
.field-label {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8a8a8a;
}
.field-input {
  width: 100%;
  border: 1px solid #dcdcd6;
  border-radius: 3px;
  background: #fff;
  padding: 9px 10px;
  min-height: 40px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  color: #131313;
}
.field-input:disabled { cursor: not-allowed; }
.field-area { min-height: 88px; resize: vertical; line-height: 1.5; }
.field-narrow { flex: 0 1 190px; }
.field-note { margin: -6px 0 12px; font-size: 12.5px; line-height: 1.45; color: #8a8a8a; }
.field-row { display: flex; flex-wrap: wrap; gap: 0 16px; }
.field-row-wrap { gap: 0 16px; }

.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0 16px;
}

.warn-inline {
  margin: 0 0 14px;
  padding: 9px 12px;
  background: #fffaef;
  border-left: 3px solid #fccd4d;
  font-size: 13px;
  line-height: 1.5;
  color: #6a5200;
}

/* Single redirect rows */
.single-rows { margin-top: 12px; }
.single-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: #faf9f6;
  border-left: 2px solid #e4e4e0;
}
.single-row .field { margin-bottom: 8px; }
.btn-row-remove {
  background: transparent;
  border: 0;
  color: #8a8a8a;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  padding: 10px 4px;
  min-height: 40px;
  margin-bottom: 8px;
}
.btn-row-remove:hover { color: #b2402f; text-decoration: underline; }
.btn-add { padding-left: 0; }

/* Notices */
.issue-list { list-style: none; margin: 16px 0 0; padding: 0; }
.issue {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 14px;
  line-height: 1.5;
  padding: 10px 12px;
  border-left: 3px solid #ececec;
  background: #fafafa;
  border-radius: 0 4px 4px 0;
  margin-bottom: 6px;
}
.issue-sev {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.issue-error { border-left-color: #b2402f; background: #fdf5f3; }
.issue-error .issue-sev { color: #b2402f; }
.issue-warning { border-left-color: #fccd4d; background: #fffaef; }
.issue-warning .issue-sev { color: #8a6a00; }
.issue-info .issue-sev { color: #8a8a8a; }

/* Output panel */
.builder-output {
  position: sticky;
  top: 20px;
  display: flex;
  flex-direction: column;
  max-height: min(calc(100vh - 40px), 600px);
}
@media (max-width: 980px) {
  .builder-output { position: static; max-height: none; }
}

.output-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 0 0 12px;
  border-bottom: 2px solid #131313;
}
.output-title-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.output-title {
  font-family: "IBM Plex Mono", monospace;
  font-size: 16px;
  font-weight: 600;
}
.output-meta {
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  color: #8a8a8a;
}
.output-actions { display: flex; gap: 8px; }

.output-code {
  margin: 0;
  padding: 20px;
  background: #131313;
  color: #f2f2ee;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  min-height: 320px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  line-height: 1.65;
  /* Long directives (a CSP value, a FilesMatch pattern) wrap instead of
     forcing a horizontal scrollbar, which would eat height off the panel and
     bring a vertical scrollbar with it. */
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
/* One block per line, with a hanging indent so a wrapped continuation is
   never mistaken for a new directive. */
.output-code span {
  display: block;
  min-height: 1.65em;
  padding-left: 2.4ch;
  text-indent: -2.4ch;
}
.output-code:focus-visible { outline: 2px solid #fccd4d; outline-offset: -2px; }
.ln-comment { color: #8f8f88; }
.ln-tag { color: #fccd4d; }
.ln-dir { color: #f2f2ee; }
.output-status { padding-top: 10px; }

/* htpasswd result */
.htpasswd-out { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.code-block {
  margin: 0 0 12px;
  padding: 16px;
  background: #f7f7f5;
  border: 1px solid #ececea;
  border-radius: 4px;
  overflow: auto;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12px;
  line-height: 1.6;
  max-height: 320px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.code-block-sm { margin-bottom: 0; padding: 12px; font-size: 12px; }

/* Tables used in the explainer copy */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 8px 0 20px; }
.data-table th, .data-table td {
  text-align: left;
  padding: 10px 14px 10px 0;
  border-top: 1px solid #e4e4e0;
  vertical-align: top;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.data-table th {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  color: #8a8a8a;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-top: 0;
}
.data-table tr:nth-child(even) td { background: #f3f3ef; }
.data-table code { background: transparent; padding: 0; font-size: 12.5px; }

/* Copy sections (home body + utility pages) */
.copy { max-width: 680px; padding-top: 72px; }
.tool-copy { padding-top: 80px; }

.copy h2, .page-title {
  margin: 0 0 20px;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: clamp(26px, 4vw, 34px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 700;
}

.copy h3 {
  margin: 44px 0 10px;
  font-family: "Archivo", Helvetica, sans-serif;
  font-size: 21px;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.copy h4 { margin: 28px 0 8px; font-size: 16.5px; font-weight: 600; }

.copy p { margin: 0 0 16px; font-size: 16px; line-height: 1.65; color: #3a3a3a; }
.copy ul, .copy ol { margin: 0 0 16px; padding-left: 22px; }
.copy li { font-size: 16px; line-height: 1.65; color: #3a3a3a; margin-bottom: 8px; }

/* Utility pages */
.page { max-width: 680px; padding-top: 48px; }
.page h1 {
  font-size: clamp(32px, 5vw, 48px);
  max-width: none;
}
.page .lede { max-width: 56ch; }
.page .copy { padding-top: 8px; }

/* Footer */
footer { background: #131313; margin-top: 80px; flex: 0 0 auto; }

.footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 24px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 12.5px;
  color: #ababab;
}

.footer-logo { display: inline-block; }
.footer-logo:hover { background: transparent; }
.footer-logo img { display: block; width: 130px; height: auto; }

.footer-inner nav { display: flex; flex-wrap: wrap; gap: 8px 22px; align-items: center; }
.footer-inner nav a {
  color: #ababab;
  text-decoration: none;
  padding-bottom: 2px;
  background-color: transparent;
  background-image: linear-gradient(#ffb703 0 0);
  background-repeat: no-repeat;
  background-size: 0% 32%;
  background-position: 0 calc(90% + 2px);
  transition: background-size 0.35s ease, color 0.35s ease;
}
.footer-inner nav a:hover {
  color: #fff;
  background-color: transparent;
  background-size: 100% 32%;
  text-decoration: none;
}
@media (max-width: 700px) {
  .footer-inner { justify-content: flex-start; }
}
