@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root{
  --bg: #10151c;
  --surface: #19212c;
  --surface-raised: #212b3a;
  --border: #2a3444;
  --text: #e7eaf0;
  --muted: #8b94a8;
  --accent: #e8a33d;   /* copper - index-card tab color */
  --accent-ink: #3a2708;
  --teal: #4fd1c5;
  --danger: #ef6461;
  --success: #4fd18c;
  --grid-line: rgba(255,255,255,0.015);
  --shadow: 0 8px 24px rgba(0,0,0,0.28);
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --radius: 3px;
  color-scheme: dark;
}

html[data-theme="light"]{
  --bg: #f6f3ec;
  --surface: #fffdf8;
  --surface-raised: #fff8ec;
  --border: #ddd3bd;
  --text: #241f16;
  --muted: #746a58;
  --accent: #b5680b;
  --accent-ink: #fff8ec;
  --teal: #0d7d72;
  --danger: #c2372a;
  --success: #187a4c;
  --grid-line: rgba(0,0,0,0.03);
  --shadow: 0 8px 24px rgba(80,60,20,0.10);
  color-scheme: light;
}

*{ box-sizing: border-box; }
html{ background: var(--bg); }
body{
  margin:0; background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.5;
  background-image:
    linear-gradient(var(--bg), var(--bg)),
    repeating-linear-gradient(0deg, var(--grid-line) 0 1px, transparent 1px 32px);
  transition: background-color .15s ease, color .15s ease;
}
.wrap{ max-width: 1100px; margin: 0 auto; padding: 0 20px; }

a{ color: var(--teal); text-decoration: none; }
a:hover{ text-decoration: underline; }
:focus-visible{ outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- header ---------- */
.site-header{ border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 90%, transparent); position: sticky; top:0; z-index: 10; backdrop-filter: blur(6px);}
.header-inner{ display:flex; align-items:center; justify-content:space-between; height:64px; gap:12px; }
.brand{ display:flex; align-items:center; gap:10px; color: var(--text); font-family: var(--mono); font-weight:600; font-size:18px; flex:0 0 auto; }
.brand:hover{ text-decoration:none; }
.brand em{ color: var(--accent); font-style: normal; }
.brand-mark{ width:22px; height:16px; background: var(--surface-raised); border:1px solid var(--border); border-radius: 2px; position:relative; display:inline-block; }
.brand-mark .notch{ position:absolute; top:-1px; left:-1px; width:8px; height:8px; background: var(--bg); border-right:1px solid var(--border); border-bottom:1px solid var(--border); border-radius: 0 0 2px 0; }
.site-nav{ display:flex; align-items:center; gap:20px; font-family: var(--mono); font-size:14px; overflow-x:auto; scrollbar-width:none; }
.site-nav::-webkit-scrollbar{ display:none; }
.site-nav a{ color: var(--muted); white-space:nowrap; }
.site-nav a.is-active, .site-nav a:hover{ color: var(--accent); text-decoration:none; }

.theme-toggle{
  flex:0 0 auto; width:34px; height:34px; border-radius:50%; border:1px solid var(--border);
  background: var(--surface); color: var(--text); cursor:pointer; display:flex; align-items:center; justify-content:center;
  padding:0;
}
.theme-toggle:hover{ border-color: var(--accent); }
.theme-toggle svg{ width:18px; height:18px; }
.theme-toggle .icon-sun{ display:none; }
html[data-theme="light"] .theme-toggle .icon-moon{ display:none; }
html[data-theme="light"] .theme-toggle .icon-sun{ display:block; }

/* ---------- layout ---------- */
.main-wrap{ padding: 40px 20px 80px; min-height: 60vh; }
.hero{ margin-bottom: 30px; }
.eyebrow{ font-family: var(--mono); color: var(--accent); font-size:13px; letter-spacing: .08em; text-transform: uppercase; margin:0 0 8px; }
.hero h1{ margin:0 0 10px; font-family: var(--mono); font-size: 32px; }
.hero p{ margin:0; color: var(--muted); max-width: 62ch; }

/* ---------- quick jump nav (homepage) ---------- */
.jumpnav{ display:flex; flex-wrap:wrap; gap:8px; margin: 20px 0 8px; }
.jumpnav a{
  font-family: var(--mono); font-size:12px; color: var(--muted); border:1px solid var(--border);
  padding:5px 10px; border-radius:20px; display:inline-flex; align-items:center; gap:6px; background: var(--surface);
}
.jumpnav a:hover{ color: var(--accent); border-color: var(--accent); text-decoration:none; }
.jumpnav svg{ width:13px; height:13px; }

/* ---------- catalog grid ---------- */
.catalog{ display:grid; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)); gap:16px; }
.category-label{ font-family: var(--mono); color: var(--text); font-size:14px; text-transform:uppercase; letter-spacing:.06em; margin: 0; display:flex; align-items:center; gap:10px; }
.category-icon{ width:26px; height:26px; color: var(--accent); flex:0 0 auto; }
.category-icon svg{ width:100%; height:100%; }
.category-count{ font-family: var(--mono); color: var(--muted); font-size:12px; font-weight:normal; text-transform:none; }

.card{
  position:relative; display:block; background: var(--surface); border:1px solid var(--border);
  padding: 18px 16px 16px; color: var(--text); transition: transform .12s ease, border-color .12s ease, background-color .12s ease;
  clip-path: polygon(0 14px, 14px 14px, 14px 0, 100% 0, 100% 100%, 0 100%);
}
.card::before{
  content:""; position:absolute; top:0; left:0; width:14px; height:14px;
  background: var(--bg); border-right:1px solid var(--border); border-bottom:1px solid var(--border);
}
.card:hover{ border-color: var(--accent); text-decoration:none; background: var(--surface-raised); transform: translateY(-2px); box-shadow: var(--shadow); }
.card .tag{ font-family: var(--mono); font-size:11px; color: var(--accent); text-transform:uppercase; letter-spacing:.06em; }
.card h3{ margin: 6px 0 6px; font-size: 17px; font-family: var(--mono); }
.card p{ margin:0; color: var(--muted); font-size: 13.5px; }

.card.small{ padding:14px 14px 12px; }
.card.small h3{ font-size:15px; margin:4px 0 4px; }
.card.small p{ font-size:12.5px; }

/* ---------- tool page ---------- */
.tool-head{ margin-bottom: 22px; }
.tool-head h1{ font-family: var(--mono); font-size: 26px; margin: 0 0 6px; }
.tool-head p{ color: var(--muted); margin:0; max-width: 68ch; }
.breadcrumb{ font-family: var(--mono); font-size:12px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a{ color: var(--muted); }

.panel{
  background: var(--surface); border:1px solid var(--border); padding: 22px;
  clip-path: polygon(0 16px, 16px 16px, 16px 0, 100% 0, 100% 100%, 0 100%);
  position:relative; margin-bottom: 18px;
}
.panel::before{
  content:""; position:absolute; top:0; left:0; width:16px; height:16px;
  background: var(--bg); border-right:1px solid var(--border); border-bottom:1px solid var(--border);
}

.field{ margin-bottom: 16px; }
.field label{ display:block; font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing:.04em; }
.field .hint{ font-size:12px; color: var(--muted); margin-top:4px; }
input[type=text], input[type=number], input[type=password], input[type=search], input[type=date], input[type=datetime-local], input[type=file], select, textarea{
  width:100%; background: var(--bg); border:1px solid var(--border); color: var(--text);
  padding: 10px 12px; font-family: var(--mono); font-size: 14px; border-radius: var(--radius);
}
textarea{ resize: vertical; min-height: 100px; }
input:focus, select:focus, textarea:focus{ border-color: var(--teal); }
.row{ display:flex; gap:14px; flex-wrap: wrap; }
.row > *{ flex:1; min-width: 160px; }
.checkline{ display:flex; align-items:center; gap:8px; font-family: var(--mono); font-size:13px; color: var(--text); margin: 6px 0; }
.checkline input{ width:auto; }

button, .btn{
  background: var(--accent); color: var(--accent-ink); border:none; padding: 10px 18px;
  font-family: var(--mono); font-weight:600; font-size:14px; cursor:pointer; border-radius: var(--radius);
}
button:hover{ filter: brightness(1.08); }
button:disabled{ opacity:.5; cursor:not-allowed; }
button.secondary{ background: transparent; color: var(--teal); border:1px solid var(--border); }
button.secondary:hover{ border-color: var(--teal); filter:none; }
.btn-row{ display:flex; gap:10px; flex-wrap: wrap; margin-top: 4px; align-items:center; }

.output{
  background: var(--bg); border:1px solid var(--border); padding: 14px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 14px; white-space: pre-wrap; word-break: break-all; min-height: 24px;
}
.output.big{ font-size: 18px; }
.result-grid{ display:grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap:12px; }
.result-item{ background: var(--bg); border:1px solid var(--border); padding: 12px; border-radius: var(--radius); }
.result-item .k{ font-family: var(--mono); font-size:11px; color: var(--muted); text-transform:uppercase; }
.result-item .v{ font-family: var(--mono); font-size:15px; margin-top:4px; word-break: break-all; }

.status-ok{ color: var(--success); }
.status-bad{ color: var(--danger); }
.status-warn{ color: var(--accent); }

.copy-btn{ font-family: var(--mono); font-size: 12px; padding: 4px 10px; }
[data-copy]{ display:inline-flex; align-items:center; gap:6px; }
[data-copy]::before{
  content:""; width:13px; height:13px; flex:0 0 auto; display:inline-block;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='9' y='9' width='12' height='12' rx='1.5'/%3E%3Cpath d='M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Crect x='9' y='9' width='12' height='12' rx='1.5'/%3E%3Cpath d='M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* ---------- section headers ---------- */
.section-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; margin: 40px 0 14px; padding-bottom:10px; border-bottom: 1px dashed var(--border); }
.section-head:first-of-type{ margin-top:0; }
.view-all{ font-family: var(--mono); font-size:12.5px; white-space:nowrap; }

/* ---------- related tools ---------- */
.related-tools{ margin-top: 40px; }
.related-tools .section-head{ margin-top:0; }

/* ---------- content pages (about/contact/disclaimer) ---------- */
.content-page h2{ font-family: var(--mono); font-size:19px; margin: 28px 0 10px; }
.content-page p{ color: var(--text); max-width: 70ch; }
.content-page p.muted{ color: var(--muted); }

/* ---------- back to top ---------- */
.back-to-top{
  position: fixed; right: 20px; bottom: 20px; width:44px; height:44px; border-radius:50%;
  background: var(--accent); color: var(--accent-ink); border:none; cursor:pointer;
  display:flex; align-items:center; justify-content:center; box-shadow: var(--shadow);
  opacity:0; visibility:hidden; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease, visibility .2s;
  z-index: 20;
}
.back-to-top.visible{ opacity:1; visibility:visible; transform: translateY(0); }
.back-to-top svg{ width:20px; height:20px; }
.back-to-top:hover{ filter: brightness(1.08); }

/* ---------- footer ---------- */
.site-footer{ border-top:1px solid var(--border); }
.footer-inner{ display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; padding: 18px 20px; color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.footer-nav{ display:flex; gap:16px; flex-wrap:wrap; }
.footer-nav a{ color: var(--muted); }
.footer-nav a:hover{ color: var(--accent); }

@media (max-width: 640px){
  .hero h1{ font-size: 24px; }
  .site-nav{ gap:12px; font-size:12.5px; }
  .back-to-top{ right:14px; bottom:14px; width:40px; height:40px; }
}
