/* Free tools (TMP-63): shared look for /tools and the three tools. Uses the site's tokens only (src/style.css). */

/* Hub cards. */
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-lg); }
.tool-card { display: flex; flex-direction: column; gap: var(--space-sm); padding: var(--space-xl); background: var(--color-bg-surface); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); color: inherit; text-decoration: none; transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease; }
.tool-card:hover { border-color: var(--color-border-strong); transform: translateY(-2px); box-shadow: 0 8px 24px -12px rgb(0 0 0 / .18); }
.tool-card:focus-visible { outline: 2px solid var(--color-accent-fill); outline-offset: 2px; }
.tool-card h2, .tool-card h3 { font: 600 var(--text-heading-s)/var(--leading-heading-s) var(--font-sans); }
.tool-card p { color: var(--color-text-secondary); font-size: var(--text-body-s); line-height: var(--leading-body-s); }
.tool-card .go { margin-top: auto; color: var(--color-text-accent); font: 500 var(--text-label-m)/var(--leading-label) var(--font-sans); }

/* The working area of a tool (.tool-work; .tool is taken by the home page): input on the left, results on the right; stacked on phones. */
.tool-work { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--space-xl); align-items: start; }
.tool-panel { display: flex; flex-direction: column; gap: var(--space-md); padding: var(--space-xl); background: var(--color-bg-surface); border: 1px solid var(--color-border-default); border-radius: var(--radius-lg); min-width: 0; }
.tool-panel h2 { font: 600 var(--text-heading-s)/var(--leading-heading-s) var(--font-sans); }
.tool-label { font: 500 var(--text-label-m)/var(--leading-label) var(--font-sans); color: var(--color-text-primary); }
.tool-hint { color: var(--color-text-secondary); font-size: var(--text-body-s); line-height: var(--leading-body-s); }
.tool-private { display: flex; gap: 8px; align-items: center; color: var(--color-text-secondary); font-size: var(--text-body-s); }
.tool-private::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--color-status-published); flex: none; }

.tool-textarea { width: 100%; min-height: 220px; resize: vertical; padding: var(--space-md); font: var(--text-body-m)/var(--leading-body-m) var(--font-sans); color: var(--color-text-primary); background: var(--color-bg-page); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.tool-input { width: 100%; padding: 10px var(--space-md); font: var(--text-body-m)/var(--leading-body-m) var(--font-sans); color: var(--color-text-primary); background: var(--color-bg-page); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md); }
.tool-textarea:focus, .tool-input:focus { outline: 2px solid var(--color-accent-fill); outline-offset: 1px; border-color: transparent; }

/* Platform and format chips (checkboxes or radios styled as pills). */
.tool-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tool-chip { position: relative; }
.tool-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tool-chip span { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--color-border-default); border-radius: var(--radius-full); font: 500 var(--text-label-m)/var(--leading-label) var(--font-sans); color: var(--color-text-secondary); background: var(--color-bg-page); transition: background .15s ease, color .15s ease, border-color .15s ease; }
.tool-chip input:checked + span { background: var(--color-bg-inverse); color: var(--color-text-inverse); border-color: var(--color-bg-inverse); }
.tool-chip input:focus-visible + span { outline: 2px solid var(--color-accent-fill); outline-offset: 2px; }

/* Drop zone for a file. The <input type=file> inside covers it, so click, keyboard and drop all work. */
.tool-drop { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 180px; padding: var(--space-xl); text-align: center; border: 1.5px dashed var(--color-border-strong); border-radius: var(--radius-lg); background: var(--color-bg-subtle); color: var(--color-text-secondary); transition: border-color .2s ease, background .2s ease; }
.tool-drop b { color: var(--color-text-primary); font-weight: 600; }
.tool-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.tool-drop.is-over, .tool-drop:focus-within { border-color: var(--color-accent-fill); background: var(--color-accent-subtle); }

/* Results: one row per platform or format, with a status dot, a value and a short message. */
.tool-results { display: flex; flex-direction: column; }
.tool-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--color-border-default); }
.tool-row:first-child { border-top: 0; }
.tool-row .name { font-weight: 600; color: var(--color-text-primary); }
.tool-row .value { font-variant-numeric: tabular-nums; color: var(--color-text-primary); font-weight: 500; text-align: right; }
.tool-row .msg { grid-column: 2 / -1; color: var(--color-text-secondary); font-size: var(--text-body-s); line-height: var(--leading-body-s); }
.tool-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-border-strong); }
.is-pass .tool-dot { background: var(--color-status-published); }
.is-warn .tool-dot { background: var(--color-status-approval); }
.is-fail .tool-dot { background: var(--color-status-failed); }
.is-unknown .tool-dot { background: var(--color-status-draft); }

/* A thin meter under a count (characters used of the limit). */
.tool-meter { grid-column: 2 / -1; height: 4px; border-radius: 2px; background: var(--color-bg-subtle); overflow: hidden; }
.tool-meter i { display: block; height: 100%; width: 0; background: var(--color-status-published); border-radius: inherit; transition: width .25s ease, background .2s ease; }
.is-warn .tool-meter i { background: var(--color-status-approval); }
.is-fail .tool-meter i { background: var(--color-status-failed); }

/* Facts read from a file (duration, size, resolution). */
.tool-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--space-sm); }
.tool-fact { padding: var(--space-md); border-radius: var(--radius-md); background: var(--color-bg-subtle); }
.tool-fact dt { color: var(--color-text-secondary); font-size: var(--text-body-s); }
.tool-fact dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-text-primary); }

.tool-empty { padding: var(--space-xl) 0; color: var(--color-text-secondary); text-align: center; }
.tool-note { padding: var(--space-md); border-radius: var(--radius-md); background: var(--color-bg-subtle); color: var(--color-text-secondary); font-size: var(--text-body-s); line-height: var(--leading-body-s); }
.tool-cta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md); padding-top: var(--space-md); border-top: 1px solid var(--color-border-default); }
.tool-cta p { color: var(--color-text-secondary); font-size: var(--text-body-s); flex: 1 1 200px; }

/* Safe-zone stage: the picture with the app's overlay drawn on top, at 9:16. */
.tool-stage { position: relative; width: 100%; max-width: 360px; margin: 0 auto; aspect-ratio: 9 / 16; border-radius: var(--radius-lg); overflow: hidden; background: var(--color-bg-night); }
.tool-stage img, .tool-stage video, .tool-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tool-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* The dated limits table on each tool page. */
.tool-limits { margin-top: var(--space-md); }

@media (max-width: 900px) {
  .tool-grid { grid-template-columns: 1fr; }
  .tool-work { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .tool-card, .tool-meter i, .tool-chip span, .tool-drop { transition: none; }
  .tool-card:hover { transform: none; }
}
