/* ==========================================================================
   docandimage.com — design system
   Display: Bricolage Grotesque · Body: Newsreader · Utility: IBM Plex Mono
   ========================================================================== */

:root {
  /* color */
  --paper:      #F7F8F6;
  --paper-dim:  #EEF0EB;
  --ink:        #14171A;
  --ink-soft:   #4B4F49;
  --muted:      #6B7069;
  --line:       #DEE1D9;
  --line-strong:#C4C9BE;
  --signal:     #0C8599;
  --signal-ink: #06424B;
  --signal-soft:#E4F1F1;
  --amber:      #B8611E;
  --amber-soft: #F5E7D8;
  --white:      #FFFFFF;

  /* type */
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body:    'Newsreader', Georgia, serif;
  --mono:    'IBM Plex Mono', ui-monospace, Menlo, monospace;

  /* scale */
  --radius-sm: 3px;
  --radius-md: 6px;
  --container: 1120px;
  --shadow-1: 0 1px 2px rgba(20,23,26,0.06);
  --shadow-2: 0 6px 24px rgba(20,23,26,0.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
  color: var(--ink);
}
h1 { font-size: clamp(2.1rem, 4.4vw, 3.4rem); font-weight: 700; }
h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
h3 { font-size: 1.15rem; }
p { margin: 0 0 1em; color: var(--ink-soft); }

.mono {
  font-family: var(--mono);
  letter-spacing: -0.01em;
}

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------------- header ---------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(247,248,246,0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.logo .dot { color: var(--signal); }
.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
}
.main-nav a {
  text-decoration: none;
  font-size: 0.92rem;
  color: var(--ink-soft);
  font-family: var(--display);
  font-weight: 500;
  transition: color .15s ease;
}
.main-nav a:hover { color: var(--signal-ink); }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .main-nav { position: fixed; inset: 68px 0 0 0; background: var(--paper); flex-direction: column; align-items: flex-start; padding: 24px; gap: 18px; transform: translateX(100%); transition: transform .25s ease; overflow-y: auto; }
  .main-nav.open { transform: translateX(0); }
  .nav-toggle { display: block; background: none; border: none; cursor: pointer; padding: 6px; }
  .nav-toggle svg { width: 22px; height: 22px; }
}

/* ---------------- footer ---------------- */
.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 96px;
  padding: 48px 0 32px;
  background: var(--paper-dim);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 36px;
}
.footer-grid h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 14px; font-weight: 600; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.footer-grid a { text-decoration: none; font-size: 0.92rem; color: var(--ink-soft); }
.footer-grid a:hover { color: var(--signal-ink); }
.footer-bottom {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 24px; border-top: 1px solid var(--line);
  font-size: 0.82rem; color: var(--muted);
  font-family: var(--mono);
}
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 13px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s ease, color .15s ease, border-color .15s ease, transform .1s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--signal-ink); }
.btn-primary:disabled { background: var(--line-strong); color: var(--muted); cursor: not-allowed; }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-outline:hover { border-color: var(--ink); }
.btn-signal { background: var(--signal); color: var(--white); }
.btn-signal:hover { background: var(--signal-ink); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 8px 14px; font-size: 0.82rem; }

/* ---------------- hero ---------------- */
.hero {
  padding: 64px 0 88px;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.hero .wrap {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  align-items: center;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--signal-ink);
  background: var(--signal-soft);
  display: inline-block;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}
.hero p.lede { font-size: 1.08rem; max-width: 46ch; }
.hero-ctas { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 28px; margin-top: 40px; }
.hero-stats div strong { display: block; font-family: var(--display); font-size: 1.3rem; color: var(--ink); }
.hero-stats div span { font-size: 0.8rem; color: var(--muted); font-family: var(--mono); }

/* scan-card: the signature element */
.scan-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-2);
  padding: 20px;
  overflow: hidden;
}
.scan-card .frame {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--paper-dim);
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scan-card .frame img { width: 100%; height: 100%; object-fit: cover; }
.scan-line {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--signal), transparent);
  box-shadow: 0 0 14px 2px rgba(12,133,153,0.55);
  animation: scan-sweep 2.6s ease-in-out infinite;
}
@keyframes scan-sweep {
  0%   { top: 0%; opacity: 0; }
  8%   { opacity: 1; }
  50%  { top: 100%; opacity: 1; }
  58%  { opacity: 0; }
  100% { top: 100%; opacity: 0; }
}
.scan-card .tagrow { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; }
.chip {
  font-family: var(--mono);
  font-size: 0.76rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--signal-soft);
  color: var(--signal-ink);
  white-space: nowrap;
}
.chip-muted { background: var(--paper-dim); color: var(--muted); }
.arrow-swap { color: var(--muted); font-family: var(--mono); font-size: 0.85rem; }

@media (max-width: 860px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-stats { flex-wrap: wrap; row-gap: 16px; }
}

/* ---------------- tool directory ---------------- */
.directory { padding: 8px 0 80px; }
.cat-block { margin-top: 56px; }
.cat-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 20px;
}
.cat-head .eyebrow { margin-bottom: 0; }
.cat-head span.count { font-family: var(--mono); font-size: 0.8rem; color: var(--muted); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.tool-card {
  background: var(--paper);
  padding: 22px 22px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: background .15s ease;
  display: flex;
  flex-direction: column;
  min-height: 148px;
}
.tool-card:hover { background: var(--white); }
.tool-card .ext {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--signal-ink);
  margin-bottom: 10px;
}
.tool-card h3 { margin-bottom: 6px; }
.tool-card p { font-size: 0.88rem; margin-bottom: 0; flex-grow: 1; }
.tool-card .soon { font-family: var(--mono); font-size: 0.72rem; color: var(--amber); margin-top: 10px; }

@media (max-width: 860px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .tool-grid { grid-template-columns: 1fr; }
}

/* ---------------- tool page ---------------- */
.tool-hero {
  padding: 40px 0 8px;
}
.tool-hero .eyebrow { margin-bottom: 14px; }
.tool-hero p.lede { max-width: 62ch; font-size: 1.05rem; }

.tool-app {
  padding: 28px 0 60px;
}
.app-panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: 32px;
}
@media (max-width: 640px) { .app-panel { padding: 20px; } }

.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
  position: relative;
}
.dropzone:hover, .dropzone.drag { border-color: var(--signal); background: var(--signal-soft); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone .dz-icon { color: var(--muted); margin-bottom: 14px; }
.dropzone strong { font-family: var(--display); }
.dropzone .dz-sub { font-size: 0.85rem; color: var(--muted); margin-top: 6px; font-family: var(--mono); }

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-top: 12px;
  background: var(--paper);
}
.file-row .thumb { width: 44px; height: 44px; border-radius: var(--radius-sm); object-fit: cover; background: var(--paper-dim); flex-shrink: 0; }
.file-row .meta { flex-grow: 1; min-width: 0; }
.file-row .meta .name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-row .meta .size { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); }
.file-row .remove { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 4px 8px; }
.file-row .remove:hover { color: var(--amber); }

.progress-bar { height: 3px; background: var(--paper-dim); border-radius: 2px; overflow: hidden; margin-top: 18px; display: none; }
.progress-bar.active { display: block; }
.progress-bar .fill { height: 100%; width: 0%; background: var(--signal); transition: width .2s ease; }

.status-line { font-family: var(--mono); font-size: 0.82rem; color: var(--muted); margin-top: 10px; min-height: 1.2em; }
.status-line.err { color: var(--amber); }
.status-line.ok { color: var(--signal-ink); }

.controls-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin: 20px 0; }
.control-group { display: flex; flex-direction: column; gap: 6px; }
.control-group label { font-size: 0.78rem; font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
select, input[type=text], input[type=number], textarea {
  font-family: var(--body);
  font-size: 0.95rem;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--ink);
}
input[type=range] { accent-color: var(--signal); }
textarea { font-family: var(--mono); width: 100%; resize: vertical; }

.result-panel { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); display: none; }
.result-panel.show { display: block; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.compare figure { margin: 0; }
.compare img { border: 1px solid var(--line); border-radius: var(--radius-sm); width: 100%; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50%/16px 16px; }
.compare figcaption { font-family: var(--mono); font-size: 0.76rem; color: var(--muted); margin-top: 6px; text-align: center; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }

/* content sections on tool pages (SEO depth) */
.content-block { padding: 40px 0; border-top: 1px solid var(--line); }
.content-block h2 { margin-bottom: 20px; }
.steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.steps li { display: flex; gap: 16px; }
.steps li::before {
  counter-increment: step;
  content: counter(step);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--signal-ink);
  background: var(--signal-soft);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.faq { display: grid; gap: 0; border-top: 1px solid var(--line); }
.faq-item { border-bottom: 1px solid var(--line); padding: 18px 0; }
.faq-item summary { cursor: pointer; font-family: var(--display); font-weight: 600; list-style: none; display: flex; justify-content: space-between; align-items: center; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: var(--muted); }
.faq-item[open] summary::after { content: '–'; }
.faq-item p { margin-top: 12px; margin-bottom: 0; }

.related-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.related-tools a { font-family: var(--mono); font-size: 0.82rem; padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; text-decoration: none; color: var(--ink-soft); }
.related-tools a:hover { border-color: var(--signal); color: var(--signal-ink); }

.privacy-note {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 0.85rem; color: var(--ink-soft);
  background: var(--signal-soft); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-top: 20px;
}
.privacy-note svg { flex-shrink: 0; margin-top: 2px; color: var(--signal-ink); }

.section-alt { background: var(--paper-dim); }

/* crop & rotate tool */
.toolbar-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.crop-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  touch-action: none;
  line-height: 0;
  background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50%/16px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.crop-stage canvas { display: block; max-width: 100%; max-height: 520px; height: auto; }
.crop-box {
  position: absolute;
  border: 2px solid var(--signal);
  box-shadow: 0 0 0 9999px rgba(20, 23, 26, 0.4);
  cursor: move;
  touch-action: none;
}
.crop-box .handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: var(--signal);
  border: 2px solid var(--white);
  border-radius: 50%;
  touch-action: none;
}
.crop-box .handle.nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-box .handle.ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-box .handle.sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-box .handle.se { right: -8px; bottom: -8px; cursor: nwse-resize; }

/* text-tool specific */
.count-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 16px; }
.count-grid div { background: var(--white); padding: 16px; text-align: center; }
.count-grid strong { display: block; font-family: var(--display); font-size: 1.5rem; }
.count-grid span { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); text-transform: uppercase; }
@media (max-width: 640px) { .count-grid { grid-template-columns: repeat(2,1fr); } }

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--paper);
  padding: 10px 16px; z-index: 100;
}
.skip-link:focus { left: 12px; top: 12px; }
