/* Delint shared design system — used by every tool page.
   Edit colors/type here once and every page picks it up. */

:root{
  --paper:#FAF9F6;
  --ink:#1C1B19;
  --slate:#6B675E;
  --mint:#2F6F5E;
  --mint-dim:#E4EEEA;
  --amber:#C97D2C;
  --amber-dim:#F3E4D2;
  --line:#DEDACC;
  --radius:3px;
  --sidebar-width:240px;
  --sidebar-collapsed-width:56px;
  --topbar-height:52px;
}
* { box-sizing:border-box; }
html { scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce){
  html { scroll-behavior:auto; }
  * { animation:none !important; transition:none !important; }
}
body{
  margin:0; background:var(--paper); color:var(--ink);
  font-family:'IBM Plex Sans', -apple-system, Segoe UI, sans-serif;
  line-height:1.5;
  min-height:100vh;
  display:grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--topbar-height) 1fr auto;
  grid-template-areas:
    "topbar topbar"
    "sidebar main"
    "sidebar footer";
  transition: grid-template-columns .18s ease;
}
a{ color:var(--mint); }
a:focus-visible, button:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible {
  outline:2px solid var(--mint); outline-offset:2px;
}

/* ---- top masthead — separate from the sidebar menu, spans full width ---- */
.topbar{
  grid-area:topbar;
  position:sticky;
  top:0;
  z-index:90;
  display:flex;
  align-items:baseline;
  justify-content:center;
  gap:14px;
  padding:0 24px;
  background:var(--paper);
  border-bottom:1px solid var(--line);
  overflow:hidden;
}
.topbar-brand{
  font-family:'IBM Plex Mono', monospace; font-weight:600; font-size:16px;
  letter-spacing:0.02em; flex:0 0 auto; white-space:nowrap;
}
.topbar-brand span{ color:var(--amber); }
.topbar-tagline{
  color:var(--slate); font-size:12.5px; white-space:nowrap;
  overflow:hidden; text-overflow:ellipsis;
}

/* ---- left sidebar (the <header> element doubles as the sidebar) ---- */
header{
  grid-area:sidebar;
  display:flex;
  flex-direction:column;
  align-items:stretch;
  gap:24px;
  padding:28px 22px;
  border-bottom:none;
  border-right:1px solid var(--line);
  position:sticky;
  top:var(--topbar-height);
  height:calc(100vh - var(--topbar-height));
  overflow-y:auto;
}
/* sidebar "logo" is now just a pointer hinting the rail expands on
   hover — no wordmark here (the full DELINT brand lives in .topbar). */
.logo{
  display:flex; align-items:center; justify-content:center;
  flex:0 0 auto;
  width:28px; height:28px;
  color:var(--slate);
  transition: transform .18s ease, color .18s ease;
}
.logo svg{ display:block; width:18px; height:18px; }
header:hover .logo,
header:focus-within .logo{
  color:var(--mint);
}

/* sidebar nav links — vertical list */
header nav{
  display:flex; flex-direction:column; gap:2px; min-width:0;
}
header nav a{
  display:block;
  margin-left:0;
  padding:9px 10px;
  border-radius:6px;
  color:var(--slate);
  text-decoration:none;
  font-size:14px;
  white-space:normal;
}
header nav a:hover{ background:var(--mint-dim); color:var(--ink); }
header nav a.current{ background:var(--mint); color:#fff; }

/* hamburger toggle — injected by assets/nav.js, hidden on desktop */
.nav-toggle{
  display:none;
  flex-direction:column;
  justify-content:center;
  gap:4px;
  width:34px; height:34px;
  padding:0; border:none; background:none; cursor:pointer;
  flex:0 0 auto;
}
.nav-toggle span{
  display:block; width:100%; height:2px; background:var(--ink); border-radius:1px;
}
.nav-overlay{
  display:none;
  position:fixed; inset:0; background:rgba(20,20,18,0.4); z-index:40;
}
.nav-overlay.open{ display:block; }

/* ---- desktop autohide sidebar ----
   Below 881px the mobile hamburger menu (above) takes over instead, so
   none of this applies there. On desktop the sidebar starts collapsed
   to a thin rail and expands automatically on hover/keyboard focus,
   collapsing again once the pointer/focus leaves (see assets/nav.js
   setupAutoHideSidebar). */
@media (min-width:881px){
  body{
    grid-template-columns: var(--sidebar-collapsed-width) 1fr;
  }
  header{
    align-items:center;
    padding:28px 8px;
    overflow:hidden;
    transition:padding .18s ease;
  }
  header nav{
    display:none;
  }
  header .logo{
    transform:rotate(0deg);
  }

  body.sidebar-expanded{
    grid-template-columns: var(--sidebar-width) 1fr;
  }
  body.sidebar-expanded header{
    align-items:stretch;
    padding:28px 22px;
    overflow-y:auto;
  }
  body.sidebar-expanded header .logo{
    align-self:flex-start;
    transform:rotate(180deg);
  }
  body.sidebar-expanded header nav{
    display:flex;
  }
}

main{ grid-area:main; max-width:1040px; margin:0 auto; padding:0 32px; width:100%; }

.eyebrow{
  font-family:'IBM Plex Mono', monospace; font-size:12px; letter-spacing:0.12em;
  text-transform:uppercase; color:var(--amber); margin:44px 0 8px;
}
h1{
  font-family:'IBM Plex Mono', monospace; font-weight:600;
  font-size:clamp(28px, 4vw, 42px); line-height:1.15; margin:0 0 12px; max-width:720px;
}
.sub{ color:var(--slate); font-size:16px; max-width:580px; margin:0 0 32px; }

/* generic tool shell — every tool page wraps its UI in .tool */
.tool{ border:1px solid var(--line); border-radius:var(--radius); background:#fff; overflow:hidden; }
.toolbar, .resultbar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  padding:12px 16px; border-top:1px solid var(--line); background:var(--paper);
}
.stat{ font-family:'IBM Plex Mono', monospace; font-size:12px; color:var(--slate); }
.stat b{ color:var(--mint); }
.stat.warn b{ color:var(--amber); }

.seg{ display:flex; border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; }
.seg button{
  border:none; background:#fff; padding:7px 14px;
  font-family:'IBM Plex Mono', monospace; font-size:12px; cursor:pointer; color:var(--slate);
}
.seg button + button{ border-left:1px solid var(--line); }
.seg button.active{ background:var(--mint); color:#fff; }

.btn{
  border:1px solid var(--ink); background:var(--ink); color:#fff;
  padding:8px 16px; border-radius:var(--radius);
  font-family:'IBM Plex Mono', monospace; font-size:12px; cursor:pointer;
}
.btn:hover{ background:#000; }
.btn.ghost{ background:transparent; color:var(--ink); }
.btn[disabled]{ opacity:0.4; cursor:not-allowed; }

.chips{ display:flex; flex-wrap:wrap; gap:6px; padding:0 16px 14px; }
.chip{
  font-family:'IBM Plex Mono', monospace; font-size:11px; color:var(--amber);
  background:var(--amber-dim); border-radius:2px; padding:2px 6px; text-decoration:line-through;
}

/* every page should have exactly one ad slot near the top of the fold */
.adslot{
  margin:40px 0; border:1px dashed var(--line); border-radius:var(--radius);
  padding:14px; text-align:center; font-family:'IBM Plex Mono', monospace;
  font-size:11px; color:var(--slate); letter-spacing:0.05em;
}

section.copy{ margin:56px 0; max-width:680px; }
section.copy h2{ font-family:'IBM Plex Mono', monospace; font-size:20px; margin:0 0 14px; }
.checklist{ list-style:none; padding:0; margin:0; }
.checklist li{
  padding:9px 0 9px 26px; border-bottom:1px solid var(--line); position:relative;
  color:var(--slate); font-size:14.5px;
}
.checklist li::before{
  content:"✕"; position:absolute; left:0; top:9px; color:var(--amber);
  font-family:'IBM Plex Mono', monospace; font-size:13px;
}
.checklist li b{ color:var(--ink); }

details{ border-bottom:1px solid var(--line); padding:14px 0; }
details summary{ cursor:pointer; font-size:15px; font-weight:600; list-style:none; }
details summary::-webkit-details-marker{ display:none; }
details summary::before{ content:"+ "; color:var(--mint); font-family:'IBM Plex Mono', monospace; }
details[open] summary::before{ content:"– "; }
details p{ color:var(--slate); font-size:14px; margin:10px 0 0; }

footer{
  grid-area:footer;
  border-top:1px solid var(--line); padding:26px 32px 60px; color:var(--slate); font-size:13px;
  display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between; gap:6px 16px;
}
footer a{ color:var(--slate); }
footer nav{ display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:0; }
footer nav a{ margin-left:0; margin-right:0; }

.footer-views{
  margin-top:10px;
  font-family:'IBM Plex Mono', monospace;
  font-size:12px;
  color:var(--slate);
}
.footer-views b{ color:var(--mint); }

/* Shared tool content area */
.tool-body{
  padding:24px;
}

/* Tool headings */
.tool-title{
  margin:0 0 8px;
  font-family:'IBM Plex Mono', monospace;
  font-size:18px;
  font-weight:600;
}

.tool-intro{
  margin:0 0 20px;
  color:var(--slate);
  font-size:14px;
  max-width:650px;
}

/* File upload component */
.upload-box{
  display:block;
  width:100%;
  min-height:180px;
  padding:48px 24px;
  border:1px dashed var(--line);
  border-radius:var(--radius);
  background:var(--paper);
  cursor:pointer;
  text-align:center;
  transition:border-color .15s, background .15s;
}

.upload-box:hover,
.upload-box.dragging{
  border-color:var(--mint);
  background:var(--mint-dim);
}

.upload-box input{
  display:none;
}

.upload-box strong{
  display:block;
  margin-bottom:5px;
  font-family:'IBM Plex Mono', monospace;
  font-size:14px;
  font-weight:600;
}

.upload-box small{
  color:var(--slate);
  font-size:13px;
}

/* File name and status text */
.file-name,
.status,
.tool-note{
  color:var(--slate);
  font-size:13px;
}

.file-name{
  min-height:20px;
  margin:14px 0 0;
  font-family:'IBM Plex Mono', monospace;
}

.tool-note{
  margin:20px 0 0;
  line-height:1.55;
}

/* Checkbox option list */
.options{
  display:grid;
  gap:10px;
  margin-top:20px;
}

.option{
  display:flex;
  align-items:flex-start;
  gap:10px;
  padding:12px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--paper);
  cursor:pointer;
}

.option:hover{
  border-color:var(--mint);
}

.option input{
  width:auto;
  margin:4px 0 0;
  accent-color:var(--mint);
}

.option strong{
  display:block;
  font-size:14px;
}

.option small{
  display:block;
  margin-top:2px;
  color:var(--slate);
  font-size:12px;
}

/* Single-line checkbox rows. Two canonical patterns site-wide — reuse one
   of these for any new tool rather than inventing a third:
   1. .toggle-row  — <label class="toggle-row"><input type="checkbox"> text</label>
                      whole row is one label, used in .toggles containers (encoding-fixer).
   2. .checkbox-row — <div class="checkbox-row"><input id=x><label for="x">text</label></div>
                       separate input+label, used where a `for`/`id` pairing is wanted
                       (column-splitter, split-into-tabs).
   Both share the same checkbox sizing fix below — the input must not inherit
   the site-wide input{width:100%} rule or it renders as a giant checkbox. */
.toggles{ display:flex; flex-direction:column; gap:8px; margin-top:16px; }
.toggle-row,
.checkbox-row{ display:flex; align-items:center; gap:8px; font-size:14px; cursor:pointer; }
.checkbox-row{ margin-top:12px; }
.toggle-row input[type="checkbox"],
.checkbox-row input[type="checkbox"]{ width:auto; min-height:0; margin:0; accent-color:var(--mint); }
.checkbox-row label{ margin:0; cursor:pointer; }

/* Shared form controls */
input,
select,
textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:#fff;
  color:var(--ink);
  font:inherit;
}

input,
select{
  min-height:38px;
  padding:7px 10px;
}

textarea{
  min-height:220px;
  padding:12px;
  resize:vertical;
  line-height:1.5;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible{
  outline:2px solid var(--mint);
  outline-offset:2px;
  border-color:var(--mint);
}

/* Tool action row */
.tool-actions{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:10px;
  margin-top:20px;
}

/* Output box for text tools */
.tool-output{
  display:none;
  margin:20px 0 0;
  padding:16px;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--paper);
  color:var(--ink);
  font-family:'IBM Plex Mono', monospace;
  font-size:13px;
  line-height:1.55;
  white-space:pre-wrap;
  word-break:break-word;
}

.tool-output.visible{
  display:block;
}

/* ---- Sitemap page ---- */
.sitemap-groups{ display:flex; flex-direction:column; gap:36px; }
.sitemap-group{ margin:0; }
.sitemap-group h2{
  font-family:'IBM Plex Mono', monospace; font-size:14px; text-transform:uppercase;
  letter-spacing:0.06em; color:var(--slate); margin:0 0 14px;
}
.sitemap-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; }
.sitemap-list li{
  border:2px solid var(--line); border-radius:var(--radius); background:#fff;
  padding:14px 16px; min-height:112px; box-sizing:border-box;
}
.sitemap-list a{
  font-family:'IBM Plex Mono', monospace; font-weight:600; font-size:15px;
  color:var(--ink); text-decoration:none;
}
.sitemap-list a:hover{ color:var(--mint); }
.sitemap-list p{ margin:4px 0 0; color:var(--slate); font-size:13.5px; max-width:60ch; }

/* =======================================================
   Responsive: below this width the sidebar becomes a
   slide-in mobile menu triggered by a hamburger button.
   ======================================================= */
@media (max-width:880px){
  body{
    grid-template-columns: 1fr;
    grid-template-rows: var(--topbar-height) auto 1fr auto;
    grid-template-areas:
      "topbar"
      "sidebar"
      "main"
      "footer";
  }

  header{
    position:sticky; top:var(--topbar-height); height:auto; overflow-y:visible;
    flex-direction:row; align-items:center; justify-content:space-between;
    border-right:none; border-bottom:1px solid var(--line);
    padding:14px 16px;
    z-index:60;
    background:var(--paper);
  }

  .nav-toggle{ display:flex; }

  header nav{
    position:fixed; top:0; left:0; height:100vh; width:min(280px, 82vw);
    background:var(--paper); border-right:1px solid var(--line);
    padding:74px 22px 24px; gap:4px;
    transform:translateX(-100%);
    transition:transform .2s ease;
    z-index:50;
    overflow-y:auto;
  }
  header nav.open{ transform:translateX(0); }

  main{ padding:0 20px; }

  .eyebrow{ margin-top:32px; }

  .tool-body{ padding:18px; }

  .upload-box{ min-height:150px; padding:36px 16px; }

  .tool-actions{ gap:8px; }

  footer{ padding:22px 20px 48px; }
}

@media (max-width:400px){
  .upload-box{ padding:28px 14px; min-height:130px; }
}

@media (max-width:480px){
  .topbar-tagline{ display:none; }
}
