/* =========================================================================
   ImageTools — design system
   "Precision instrument" identity. Palette + type are the only place
   visual decisions live; components below consume tokens only.
   ========================================================================= */

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

:root {
  /* palette */
  --bg:        #F0F2F5;   /* cool paper / brushed-panel */
  --surface:   #FFFFFF;
  --surface-2: #F7F8FA;
  --ink:       #12151B;   /* near-black */
  --muted:     #5A6472;
  --line:      #E2E6EC;
  --primary:   #2547FF;   /* electric blue — chrome, links, primary action */
  --primary-ink:#1B34C4;
  --save:      #0FA968;   /* savings green — the number-drop moment */
  --save-bg:   #E6F7EF;
  --warn:      #C4341E;

  /* type */
  --display: 'Space Grotesk', system-ui, sans-serif;
  --body:    'Inter', system-ui, sans-serif;
  --data:    'Space Mono', ui-monospace, monospace;

  /* scale */
  --step--1: clamp(0.83rem, 0.8rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  --step-1:  clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2:  clamp(1.55rem, 1.3rem + 1.1vw, 2.1rem);
  --step-3:  clamp(2rem, 1.5rem + 2.2vw, 3.1rem);

  /* space + shape */
  --gap: 1rem;
  --pad: clamp(1rem, 0.7rem + 1.5vw, 2rem);
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(18,21,27,.05), 0 8px 24px rgba(18,21,27,.06);
  --maxw: 1080px;
}

* { box-sizing: border-box; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--body);
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); line-height: 1.12; font-weight: 600; letter-spacing: -0.02em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--pad); }

/* ---- header --------------------------------------------------------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-head .wrap { display: flex; align-items: center; gap: 1.5rem; height: 60px; }
.brand { font-family: var(--display); font-weight: 700; font-size: var(--step-1); letter-spacing: -0.03em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand b { color: var(--primary); }
.nav { display: flex; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: var(--step--1); font-weight: 500; }
.nav a:hover { color: var(--ink); text-decoration: none; }

/* ---- hero / tool head ---------------------------------------------- */
.tool-head { padding-block: clamp(1.5rem, 1rem + 3vw, 3rem) 1rem; }
.eyebrow {
  font-family: var(--data); font-size: var(--step--1); color: var(--primary);
  text-transform: uppercase; letter-spacing: .12em;
}
.tool-head h1 { font-size: var(--step-3); margin-top: .4rem; max-width: 18ch; }
.tool-head .tagline { color: var(--muted); font-size: var(--step-1); margin-top: .6rem; max-width: 52ch; }

/* ---- the tool panel ------------------------------------------------- */
.tool { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--pad); margin-block: 1.5rem; }

.dropzone {
  display: block;
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface-2);
  padding: clamp(1.5rem, 1rem + 3vw, 3.2rem) 1rem;
  text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, var(--surface)); }
.dropzone h2 { font-size: var(--step-1); }
.dropzone p { color: var(--muted); font-size: var(--step--1); margin-top: .3rem; }
.dropzone input { display: none; }

/* controls (quality slider, target size, etc.) */
.controls { display: flex; flex-wrap: wrap; gap: 1.2rem; margin-top: 1.2rem; }
.control { flex: 1 1 200px; }
.control label { display: block; font-size: var(--step--1); font-weight: 600; margin-bottom: .35rem; }
.control label .val { font-family: var(--data); color: var(--primary); font-weight: 700; }
.control input[type=range] { width: 100%; accent-color: var(--primary); }
.control input[type=number], .control select {
  width: 100%; padding: .55rem .7rem; font-family: var(--data);
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
  color: var(--ink); font-size: var(--step-0);
}

/* ---- results / the signature weight readout ------------------------ */
.results { margin-top: 1.2rem; display: grid; gap: .8rem; }
.result-row {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem;
  padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.result-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.readout { display: flex; align-items: center; gap: .6rem; font-family: var(--data); font-size: var(--step--1); }
.readout .from { color: var(--muted); text-decoration: line-through; }
.readout .arrow { color: var(--muted); }
.readout .to { color: var(--ink); font-weight: 700; }
.saved-pill {
  font-family: var(--data); font-weight: 700; font-size: var(--step--1);
  color: var(--save); background: var(--save-bg); padding: .2rem .5rem; border-radius: 999px; white-space: nowrap;
}
.savings-bar { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.savings-bar > span { display: block; height: 100%; background: var(--save); width: 0; transition: width .5s ease; }

/* ---- buttons -------------------------------------------------------- */
.btn {
  font-family: var(--body); font-weight: 600; font-size: var(--step-0);
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: .6rem 1.1rem;
  cursor: pointer; transition: background .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-ink); text-decoration: none; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; }
.btn-row { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: 1.1rem; }

/* ---- content sections (SEO copy, how-to, FAQ) ---------------------- */
.section { padding-block: clamp(1.8rem, 1.2rem + 2vw, 3rem); }
.section + .section { border-top: 1px solid var(--line); }
.section h2 { font-size: var(--step-2); }
.section p { color: var(--ink); max-width: 68ch; margin-top: .8rem; }
.section p.muted { color: var(--muted); }

.steps { display: grid; gap: 1rem; margin-top: 1.4rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.step .n { font-family: var(--data); font-weight: 700; color: var(--primary); font-size: var(--step-1); }
.step h3 { font-size: var(--step-0); margin-top: .4rem; }
.step p { font-size: var(--step--1); color: var(--muted); margin-top: .3rem; }

.faq { margin-top: 1.2rem; max-width: 72ch; }
.faq details { border-bottom: 1px solid var(--line); padding: .9rem 0; }
.faq summary { font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq summary::after { content: '+'; font-family: var(--data); color: var(--primary); }
.faq details[open] summary::after { content: '–'; }
.faq details p { margin-top: .6rem; color: var(--muted); }

/* ---- tool grid (homepage + related) ------------------------------- */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); margin-top: 1.4rem; }
.card {
  display: block; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem; transition: border-color .15s, transform .1s;
}
.card:hover { border-color: var(--primary); transform: translateY(-2px); text-decoration: none; }
.card .tag { font-family: var(--data); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.card h3 { font-size: var(--step-1); margin-top: .3rem; color: var(--ink); }
.card p { color: var(--muted); font-size: var(--step--1); margin-top: .4rem; }

/* ---- footer -------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); margin-top: 2rem; }
.site-foot .wrap { padding-block: 2rem; display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.foot-col h4 { font-family: var(--data); font-size: var(--step--1); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: .6rem; }
.foot-col a { display: block; color: var(--ink); font-size: var(--step--1); padding: .2rem 0; }
.foot-col a:hover { color: var(--primary); }
.foot-note { border-top: 1px solid var(--line); }
.foot-note .wrap { padding-block: 1.1rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; color: var(--muted); font-size: var(--step--1); }

/* privacy badge — reused trust signal */
.badge { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--data); font-size: var(--step--1); color: var(--save); background: var(--save-bg); padding: .3rem .7rem; border-radius: 999px; }

/* ---- a11y + motion ------------------------------------------------- */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto; } }
