/* Scrollie — browser tool UI. Layered on top of seo.css, which owns the design
   tokens (--brand, --ink, --card, --radius …) and the light/dark switch. This
   file only adds what a tool needs and no page-level styling.

   Load order matters: seo.css first, then this. */

.tool {
  margin: 28px 0 8px;
}

/* Honest-limitation banner. Sits above the tool, not below it, because a caveat
   the user only finds after a disappointing result is not a caveat. Amber rather
   than red: this is "manage your expectations", not "something is broken". */
.tool-caveat {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 20px 0 0;
  padding: 15px 17px;
  border: 1px solid rgba(214, 138, 32, .32);
  border-left: 4px solid #D68A20;
  border-radius: 12px;
  background: rgba(240, 176, 82, .10);
  color: var(--ink);
  font-size: .95rem;
  line-height: 1.6;
}

.tool-caveat svg { flex: none; margin-top: 2px; color: #C87E1A; }
.tool-caveat b { display: block; margin-bottom: 3px; }
.seo a.tool-caveat-link,
.tool-caveat a { color: #A9640F; font-weight: 700; text-decoration: underline; }

@media (prefers-color-scheme: dark) {
  .tool-caveat { background: rgba(240, 176, 82, .12); border-color: rgba(240, 176, 82, .3); }
  .tool-caveat svg { color: #F0B052; }
  .seo a.tool-caveat-link,
  .tool-caveat a { color: #F0B052; }
}

/* ---------------------------------------------------------------- drop zone */

.tool-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 190px;
  padding: 28px 20px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  color: var(--ink-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.tool-drop:hover,
.tool-drop:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
  outline: none;
}

.tool-drop.is-over {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.006);
}

.tool-drop strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.tool-drop small {
  color: var(--ink-3);
  max-width: 46ch;
  line-height: 1.5;
}

.tool-drop input[type=file] { display: none; }

/* ------------------------------------------------------------------ thumbs */

.tool-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 16px 0 0;
}

.tool-thumbs:empty { margin: 0; }

.tool-thumb {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.tool-thumb canvas {
  display: block;
  width: 90px;
  height: auto;
  max-height: 160px;
  object-fit: cover;
  background: var(--bg-soft);
}

.tool-thumb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 4px 5px;
  border-top: 1px solid var(--border-2);
}

.tool-thumb-bar span {
  font-size: .78rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.tool-thumb-bar button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font-size: .92rem;
  line-height: 1;
  padding: 3px 5px;
  border-radius: 6px;
  cursor: pointer;
}

.tool-thumb-bar button:hover:not(:disabled) {
  background: var(--brand-soft);
  color: var(--brand-ink);
}

.tool-thumb-bar button:disabled { opacity: .3; cursor: default; }

/* ---------------------------------------------------------------- controls */

.tool-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 18px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.tool-field {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: .9rem;
  color: var(--ink-2);
}

.tool-field select,
.tool-field input[type=number] {
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 5px 9px;
}

.tool-field input[type=range] { accent-color: var(--brand); width: 130px; }
.tool-field input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; }

.tool-actions { display: flex; gap: 10px; margin-left: auto; }

.tool-btn {
  font: inherit;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--ink);
  padding: 9px 16px;
  border-radius: 11px;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}

.tool-btn:hover:not(:disabled) { border-color: var(--brand); }
.tool-btn:disabled { opacity: .5; cursor: default; }

.tool-btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.tool-btn-primary:hover:not(:disabled) { background: var(--brand-2); }

/* ------------------------------------------------------------------ status */

.tool-status {
  margin: 12px 0 0;
  font-size: .9rem;
  color: var(--ink-2);
  min-height: 1.3em;
}

.tool-status.is-ok { color: var(--brand-ink); }
.tool-status.is-warn { color: #A65A12; }
.tool-status.is-error { color: #B3261E; }

@media (prefers-color-scheme: dark) {
  .tool-status.is-ok { color: var(--brand); }
  .tool-status.is-warn { color: #F0A868; }
  .tool-status.is-error { color: #F2857C; }
}

/* ------------------------------------------------------------------ result */

.tool-result {
  margin: 20px 0 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.tool-preview {
  max-height: 460px;
  overflow: auto;
  border-radius: 12px;
  background: var(--bg-soft);
  text-align: center;
}

.tool-preview img { max-width: 100%; display: inline-block; }

.tool-result-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

/* seo.css has `.seo a:not(.btn) { color: var(--brand) }` at specificity (0,2,1).
   A bare `.tool-download` loses to it, which paints brand-orange text on a
   brand-orange button — the label vanishes. Match on `a.tool-download` inside
   `.seo` to tie on specificity and win on order, since tools.css loads after. */
.seo a.tool-download,
.tool-download {
  font-weight: 600;
  text-decoration: none;
  background: var(--brand);
  color: #fff;
  padding: 9px 18px;
  border-radius: 11px;
}

.seo a.tool-download:hover,
.tool-download:hover { background: var(--brand-2); color: #fff; }

/* Privacy line — this is a promise, so it gets visual weight rather than
   being buried in the body copy. */
.tool-privacy {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-size: .9rem;
  line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
  .tool-privacy { color: var(--ink); }
}

.tool-privacy svg { flex: none; margin-top: 1px; }

@media (max-width: 560px) {
  .tool-controls { gap: 10px; }
  .tool-actions { margin-left: 0; width: 100%; }
  .tool-actions .tool-btn { flex: 1; }
}

/* ============================================================================
   Collage workspace. The canvas is the page; controls sit under it and every
   change redraws live, so there is no generate-then-look round trip.
   ========================================================================= */

/* Once photos are in, the drop zone shrinks out of the way — it has done its
   job and the canvas needs the room. */
.tool-dropwrap.is-compact .tool-drop { min-height: 78px; padding: 14px 18px; }
.tool-dropwrap.is-compact .tool-drop small { display: none; }
.tool-dropwrap.is-compact .tool-drop strong { font-size: .95rem; font-weight: 600; }

.tool-stage {
  margin: 16px 0 0;
  padding: 22px;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  text-align: center;
}

#canvas {
  max-width: 100%;
  max-height: 78vh;
  min-height: 320px;
  cursor: grab;
  touch-action: none;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  background:
    linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%) 0 0/18px 18px,
    linear-gradient(45deg, rgba(0,0,0,.05) 25%, transparent 25%, transparent 75%, rgba(0,0,0,.05) 75%) 9px 9px/18px 18px;
}

.tool-meta { margin: 10px 0 0; font-size: .82rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Layout picker — drawn diagrams, filtered to the number of photos on hand. */
.tool-layouts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

.lay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 46px;
  padding: 5px;
  border: 1.5px solid var(--border);
  border-radius: 11px;
  background: var(--card);
  cursor: pointer;
  transition: border-color .14s ease, background .14s ease, transform .14s ease;
}

.lay svg { display: block; }
.lay rect { fill: var(--ink-3); opacity: .5; transition: fill .14s ease, opacity .14s ease; }
.lay:hover { border-color: var(--brand); transform: translateY(-1px); }
.lay.is-on { border-color: var(--brand); background: var(--brand-soft); }
.lay.is-on rect { fill: var(--brand); opacity: 1; }

/* A quiet App Store link that rides along beside the H1 rather than taking a
   section of its own. The tool is the page; this is a footnote with a button. */
.tool-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.tool-head h1 { margin-bottom: 6px; }

.seo a.tool-appbadge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: none;
  margin-top: 6px;
  padding: 8px 13px 8px 9px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  transition: border-color .15s ease, transform .15s ease;
}

.seo a.tool-appbadge:hover { border-color: var(--brand); transform: translateY(-1px); }
.tool-appbadge img { width: 34px; height: 34px; border-radius: 8px; }
.tool-appbadge span { display: block; font-size: .9rem; line-height: 1.25; }
.tool-appbadge small { display: block; font-size: .76rem; color: var(--ink-3); font-weight: 500; }

@media (max-width: 560px) {
  .tool-head { gap: 12px; }
  .tool-stage { padding: 12px; }
  #canvas { max-height: 62vh; min-height: 240px; }
  .lay { min-width: 42px; height: 42px; }
}

/* Dragging a cell onto another swaps them, matching the app. The cursor and the
   translucent source cell are the only affordance, so they have to be right. */
#canvas.is-dragging { cursor: grabbing; }

/* The template list is per-photo-count and can run to a dozen entries with the
   mirror variants, so it scrolls rather than pushing the canvas off-screen. */
.tool-layouts {
  max-height: 132px;
  overflow-y: auto;
  padding: 2px;
}

.tool-tplcount {
  margin: 8px 0 0;
  font-size: .82rem;
  color: var(--ink-3);
}

/* Full-bleed workspace: the tool is the page, so let it use the width. */
.seo .tool-wide { max-width: 1080px; margin-left: auto; margin-right: auto; }
