/* Shared styles for the shaikhismail.com free tools.
   Same tokens as the main site: sage paper + forest ink, mint in dark mode, orange for actions. */

/* Font is served from this site (no Google Fonts), so no visitor data goes to a third party. */
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 800; font-display: swap; src: url('../fonts/jetbrains-mono-latin-800-normal.woff2') format('woff2'); }

/* ============ TOKENS ============ */
:root {
  --bg:        #EDF2EC;
  --bg-alt:    #E2EADF;
  --surface:   #F7FAF6;
  --ink:       #10261A;
  --ink-soft:  #4A5F52;
  --line:      #C9D6CB;
  --green:     #155E3B;
  --green-2:   #1F8A57;
  --orange:    #C85A06;
  --orange-ink:#FFFFFF;
  --danger:    #B42318;
  --grid:      rgba(21, 94, 59, .09);
  --font:      'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0E1A14;
    --bg-alt:    #12221A;
    --surface:   #152A1F;
    --ink:       #E3EFE6;
    --ink-soft:  #93AB9C;
    --line:      #25402F;
    --green:     #5FD39A;
    --green-2:   #3FB57C;
    --orange:    #FF9A3D;
    --orange-ink:#1A0F05;
    --danger:    #FF8A7A;
    --grid:      rgba(95, 211, 154, .07);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg:        #0E1A14;
  --bg-alt:    #12221A;
  --surface:   #152A1F;
  --ink:       #E3EFE6;
  --ink-soft:  #93AB9C;
  --line:      #25402F;
  --green:     #5FD39A;
  --green-2:   #3FB57C;
  --orange:    #FF9A3D;
  --orange-ink:#1A0F05;
  --danger:    #FF8A7A;
  --grid:      rgba(95, 211, 154, .07);
  color-scheme: dark;
}

/* ============ BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  font-family: var(--font); font-size: 14px; line-height: 1.6;
  color: var(--ink); background-color: var(--bg);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
a { color: var(--green); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; }
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-soft); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* ============ HEADER / FOOTER ============ */
.top { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 10; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; }
.brand .logo { width: 28px; height: 28px; border-radius: 7px; background: #155E3B; color: #F5821F; display: grid; place-items: center; font-weight: 800; }
.brand small { font-weight: 400; color: var(--ink-soft); }
.top nav { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.top nav a { text-decoration: none; color: var(--ink-soft); }
.top nav a:hover { color: var(--green); }
.theme-btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font: inherit; }
main { flex: 1; padding: 28px 0 48px; }
.foot { border-top: 1px solid var(--line); padding: 18px 0; font-size: 12px; color: var(--ink-soft); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

/* ============ PAGE PIECES ============ */
.prompt { font-size: 12px; color: var(--ink-soft); margin-bottom: 6px; }
.prompt .u { color: var(--orange); } .prompt .d { color: var(--green); }
.lead { color: var(--ink-soft); margin: 0 0 22px; max-width: 64ch; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.stack > * + * { margin-top: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.notice { display: flex; gap: 12px; align-items: flex-start; background: color-mix(in srgb, var(--green) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--green) 35%, transparent); border-radius: 12px; padding: 12px 14px; font-size: 13px; max-width: 72ch; }
.notice .ico { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--green); color: var(--bg); font-weight: 800; }
.notice strong { color: var(--green); }
.notice p { margin: 2px 0 0; color: var(--ink-soft); }
.gate { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 14px; }
.gate .gate-title { font-size: 13px; font-weight: 700; }
.gate .gate-state { font-size: 12px; color: var(--ink-soft); flex-basis: 100%; }
.gate .gate-widget { min-height: 65px; }
[data-gated].locked { opacity: .45; filter: grayscale(.4); pointer-events: none; user-select: none; }
.ver { color: inherit; }
.prose { max-width: 72ch; }
.prose h2 { font-size: 17px; margin-top: 1.6em; }
.prose li + li { margin-top: 4px; }

/* Drop zone */
.drop { display: block; border: 2px dashed var(--line); border-radius: 12px; padding: 28px 16px; text-align: center; cursor: pointer; background: var(--surface); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--green); background: color-mix(in srgb, var(--green) 6%, var(--surface)); }
.drop strong { display: block; font-size: 15px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* Form controls */
label.f, div.f { display: block; font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
input[type=number], input[type=text], input[type=date], input[type=time], input[type=password], select {
  width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; min-height: 38px;
}
input[type=range] { width: 100%; accent-color: var(--green); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row > * { flex: 1 1 140px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; flex-wrap: wrap; }
.seg button { font: inherit; font-size: 13px; border: 0; background: var(--surface); color: var(--ink); padding: 7px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: var(--green); color: var(--bg); }

.btn { font: inherit; font-weight: 700; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; padding: 9px 16px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--green); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--orange-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 12px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Result lists */
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item .thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); flex: none; background: var(--bg-alt); }
.item .info { flex: 1; min-width: 0; }
.item .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta { font-size: 12px; color: var(--ink-soft); }
.good { color: var(--green); font-weight: 700; }
.warn { color: var(--orange); font-weight: 700; }
.err  { color: var(--danger); }

/* Stat tiles and tables */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.stat .k { font-size: 12px; color: var(--ink-soft); }
.stat .v { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.hl .v { color: var(--green); }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--ink-soft); font-weight: 500; }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
.tabs button[aria-selected=true] { background: var(--green); border-color: var(--green); color: var(--bg); }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  .top nav .hide-sm { display: none; }
  .brand small { display: none; }
}

/* ============ TOOLS INDEX (tools.shaikhismail.com) ============ */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool { display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: var(--ink); text-decoration: none; transition: border-color .15s, transform .15s; }
a.tool:hover { border-color: var(--green); transform: translateY(-2px); }
.tool .ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); font-weight: 800; font-size: 15px; }
.tool h2 { margin: 0; font-size: 16px; }
.tool p { margin: 0; font-size: 13px; color: var(--ink-soft); flex: 1; }
.tool .meta { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--ink-soft); }
.tool .go { color: var(--orange); font-weight: 700; }
.tool.soon { border-style: dashed; }

/* ============ BREADCRUMB ============ */
.crumbs ol { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; font-size: 12px; color: var(--ink-soft); }
.crumbs li + li::before { content: '/'; margin: 0 8px; color: var(--line); }
.crumbs a { color: var(--ink-soft); text-decoration: none; }
.crumbs a:hover { color: var(--green); text-decoration: underline; }
.crumbs [aria-current] { color: var(--ink); font-weight: 700; }

/* ============ INPUT → PROCESS → OUTPUT ============ */
.flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; align-items: stretch; gap: 8px; margin: 0 0 18px; max-width: 840px; padding: 0; list-style: none; }
.flow li { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.flow li.arrow { background: none; border: 0; padding: 0; display: grid; place-items: center; color: var(--orange); font-weight: 800; font-size: 18px; }
.flow b { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--green); margin-bottom: 2px; }
@media (max-width: 640px) {
  .flow { grid-template-columns: 1fr; gap: 4px; }
  .flow li.arrow { transform: rotate(90deg); height: 18px; }
}

/* ============ FAQ ============ */
.faq h2 { font-size: 16px; margin-bottom: 8px; }
.faq details { border-top: 1px solid var(--line); padding: 10px 0; }
.faq details:first-of-type { border-top: 0; }
.faq summary { cursor: pointer; font-weight: 700; }
.faq details p { margin: 6px 0 0; color: var(--ink-soft); max-width: 72ch; }

/* ============ PAGE / IMAGE GRID (PDF to Image, Image to PDF) ============ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.tile { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.tile.dragging { opacity: .4; }
.tile.drop-before { box-shadow: -4px 0 0 var(--orange); }
.tile .pic { aspect-ratio: 3 / 4; display: grid; place-items: center; background: var(--bg-alt); border-radius: 6px; overflow: hidden; cursor: grab; }
.tile .pic img { max-width: 100%; max-height: 100%; object-fit: contain; transition: transform .2s; }
.tile .num { z-index: 1; position: absolute; top: 12px; left: 12px; background: var(--green); color: var(--bg); font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 7px; }
.tile .name { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .meta { font-size: 11px; color: var(--ink-soft); }
.tile .tools { display: flex; gap: 4px; flex-wrap: wrap; }
.tile .tools .btn { flex: 1 1 auto; justify-content: center; padding: 4px 6px; }
.progress { height: 6px; border-radius: 3px; background: var(--bg-alt); overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }
.check { display: flex; gap: 8px; align-items: center; font-size: 13px; }
.big { font-size: 22px; font-weight: 800; line-height: 1.35; color: var(--green); margin: 0; }
.stat .v { overflow-wrap: anywhere; }
@media (max-width: 560px) { .stat .v { font-size: 17px; } }
