/* ==========================================================================
   Enzvia tools: one component for every tool page + the tools directory.
   Light, uniform, accessible (44px targets, visible focus, clear results).
   ========================================================================== */

/* Tool page layout */
.tool-page { background: linear-gradient(180deg, var(--bg) 0, var(--bg) 340px, #fff 340px); }
.tool-header { padding: 4px 0 22px; }
.tool-header h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.4rem); letter-spacing: -.03em; font-weight: 800; margin: 0 0 10px; }
.tool-header__intro { font-size: 1.075rem; color: var(--ink-2); max-width: 70ch; margin: 0 0 14px; }
.tool-badges { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.tool-badges li { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; font-weight: 650; color: var(--brand-strong); background: var(--brand-tint); border: 1px solid var(--brand-line); border-radius: 999px; padding: 3px 11px; }
.tool-badges li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.tool-page .breadcrumbs { padding-top: clamp(18px, 3vw, 28px); }

.tool-body > * + * { margin-top: 20px; }

/* Card that holds the tool */
.tool-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: clamp(18px, 3.2vw, 28px);
}
.tool-card > * + * { margin-top: 18px; }
.tool-card__title { font-size: 1.2rem; margin: 0; }
.tool-card__help { color: var(--muted); font-size: .95rem; margin: 0; }
.tool-card__note { font-size: .92rem; color: var(--ink-2); background: var(--bg); border-radius: 10px; padding: 10px 14px; margin: 0; }
.tool-card__label { display: block; font-weight: 700; margin-bottom: 8px; }
.tool-card--result { border-color: var(--brand-line); background: linear-gradient(180deg, var(--brand-tint), #fff 70%); }
.tool-card--embed { padding: 0; overflow: hidden; }
.tool-embed { display: block; width: 100%; height: 900px; border: 0; }
@media (max-width: 600px) { .tool-embed { height: 1100px; } }

/* Fields */
.tool-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 16px 18px; }
.tool-fields--2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { width: 100%; }
.field--full + .tool-fields, .tool-fields + .field--full, .field--full + .field--full { margin-top: 16px; }
.field label, .field > span:first-child { font-weight: 650; font-size: .95rem; color: var(--ink); }
.field__required { color: #b42318; }
.field__help { margin: 0; font-size: .85rem; color: var(--muted); }
.field__error { margin: 0; min-height: 0; font-size: .85rem; color: var(--error-ink); font-weight: 600; }
.field__error:empty { display: none; }
.field__inline { display: flex; gap: 8px; }
.field__inline input { flex: 1 1 auto; min-width: 0; }
.field__inline select { flex: 0 0 auto; width: auto; }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--inline select { width: auto; }

.tool-page input:not([type=checkbox]):not([type=radio]):not([type=file]),
.tool-page select,
.tool-page textarea,
.tools-directory input[type=search] {
  width: 100%; min-height: 48px; padding: 10px 14px;
  border: 1px solid #b4c1d0; border-radius: 10px; background: #fff; color: var(--ink);
  font-size: 1rem; line-height: 1.4;
  transition: border-color .15s, box-shadow .15s;
}
.tool-page textarea { min-height: 96px; resize: vertical; font-family: var(--font-mono); font-size: .92rem; }
.tool-page select {
  appearance: none; -webkit-appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235a6a80'%3E%3Cpath d='m6.53 8.97 5.47 5.47 5.47-5.47 1.06 1.06L12 16.56l-6.53-6.53z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 18px;
}
.tool-page input:hover, .tool-page select:hover, .tool-page textarea:hover { border-color: #8a9bb0; }
.tool-page input:focus, .tool-page select:focus, .tool-page textarea:focus,
.tools-directory input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15, 122, 108, .2); }
.tool-page input:user-invalid, .tool-page input[aria-invalid="true"] { border-color: #d0453a; box-shadow: 0 0 0 3px rgba(208, 69, 58, .12); }
.tool-page input::placeholder { color: #8c99aa; }

.check { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--warn-line); background: var(--warn-bg); border-radius: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--brand); flex: none; }

/* Actions */
.tool-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tool-actions--share { padding-top: 6px; }

/* Single-line result (hourly budget, living wage) */
.tool-result { margin: 0; }
.tool-result:empty { display: none; }
.tool-result:not(:empty) {
  padding: 16px 18px; border-radius: var(--radius); background: var(--brand-tint); border: 1px solid var(--brand-line);
  color: #0c2c2a; font-weight: 700; font-size: 1.08rem; line-height: 1.5; overflow-wrap: anywhere;
}

/* Alerts */
.tool-alert { display: none; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); font-size: .93rem; }
.tool-alert.is-visible, .tool-alert--error:not([hidden]) { display: block; }
.tool-alert--error { border-color: var(--error-line); background: var(--error-bg); color: var(--error-ink); font-weight: 600; }
.tool-alert ul { margin: 0; padding-left: 1.2em; }

/* Notices (disclaimers) */
.notice { margin: 0; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--info-line); background: var(--info-bg); font-size: .95rem; color: var(--ink-2); }
.notice--warning { border-color: var(--warn-line); background: var(--warn-bg); color: var(--warn-ink); }

/* Multi-value results */
.tool-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 14px; }
.result { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.result__title { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.result__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.result__row:first-of-type { border-top: 0; }
.result__label { color: var(--ink-2); font-size: .95rem; }
.result__value { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.result__value--strong { font-size: 1.35rem; color: var(--brand-strong); }
.result__note { margin: 6px 0 0; font-size: .82rem; color: var(--muted); }
.result__note:empty { display: none; }

/* KPI tiles (age calculator) */
.tool-output > * + * { margin-top: 14px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.kpis--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 700px) { .kpis, .kpis--2 { grid-template-columns: 1fr; } }
.kpi { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.kpi__label { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kpi__value { font-size: 1.25rem; font-weight: 800; color: var(--brand-strong); line-height: 1.3; }
.kpi__text { font-size: 1rem; font-weight: 650; line-height: 1.45; }

/* Code preview (UTM) */
.code-preview { padding: 12px 14px; border: 1px dashed #b4c1d0; border-radius: 10px; background: var(--bg); }
.code-preview__label { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 4px; }
.code-preview code { display: block; font-family: var(--font-mono); font-size: .9rem; color: var(--ink); overflow-wrap: anywhere; }
.disclosure { border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; }
.disclosure > summary { cursor: pointer; padding: 12px 0; font-weight: 650; }
.disclosure[open] > summary { border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.disclosure[open] { padding-bottom: 14px; }
.embed-box { display: grid; gap: 10px; justify-items: start; }

/* Toolbar (language picker) */
.tool-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }

/* PDF converter */
.pdf-tool__grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr); gap: 20px; }
@media (max-width: 760px) { .pdf-tool__grid { grid-template-columns: 1fr; } }
.pdf-tool__grid > div > * + * { margin-top: 14px; }
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px;
  padding: 28px 18px; border: 2px dashed #a9b8c9; border-radius: var(--radius); background: var(--bg); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.is-dragging, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-tint); }
.dropzone:focus-within { box-shadow: 0 0 0 3px rgba(15, 122, 108, .2); }
.dropzone__icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: #fff; color: var(--g-files); box-shadow: var(--shadow-sm); margin-bottom: 6px; }
.dropzone__icon .icon { width: 24px; height: 24px; }
.dropzone__title { font-weight: 750; font-size: 1.05rem; color: var(--ink); }
.dropzone__sub { color: var(--ink-2); font-size: .95rem; }
.dropzone__limits { color: var(--muted); font-size: .8rem; margin-top: 6px; }
.dropzone__input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.thumbs:empty { display: none; }
@media (max-width: 560px) { .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.thumb { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.thumb img { width: 100%; height: 100px; object-fit: contain; background: var(--bg); }
.thumb figcaption { padding: 6px 8px; font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumbs__more { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: var(--muted); }
.pdf-tool__notes { padding: 16px 18px; border-radius: var(--radius); background: var(--bg); border: 1px solid var(--line); align-self: start; }
.pdf-tool__notes h3 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pdf-tool__notes ul { margin: 0; padding-left: 1.1em; font-size: .92rem; color: var(--ink-2); }
.pdf-tool__notes li + li { margin-top: 6px; }

/* Content sections below the tool */
.tool-section { margin-top: clamp(28px, 4vw, 40px); }
.tool-section > h2 { font-size: 1.35rem; }
.tool-section.prose { font-size: 1.05rem; max-width: 76ch; }
.tool-section.prose h2:first-child { margin-top: 0; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.feature { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.feature h3 { font-size: 1rem; margin: 0 0 4px; }
.feature p { margin: 0; color: var(--muted); font-size: .92rem; }

/* FAQ */
.faq > h2 { margin-bottom: 12px; }
.faq__item { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin-bottom: 10px; }
.faq__item > summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 18px; font-weight: 700; font-size: 1rem;
}
.faq__item > summary::-webkit-details-marker { display: none; }
.faq__item > summary::after { content: "+"; flex: none; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--line-soft); color: var(--ink-2); font-weight: 700; }
.faq__item[open] > summary::after { content: "–"; background: var(--brand-tint); color: var(--brand-strong); }
.faq__item > summary:hover { color: var(--brand-strong); }
.faq__answer { padding: 0 18px 14px; color: var(--ink-2); }
.faq__answer p { margin: 0; }

.tool-next { display: grid; gap: 8px; }
.tool-next .tool-section > p { margin: 14px 0 0; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 300; transform: translate(-50%, 10px); opacity: 0;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: #fff; font-size: .92rem; font-weight: 600;
  box-shadow: var(--shadow-lg); transition: opacity .2s, transform .2s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* Tools directory -------------------------------------------------------------- */
.tools-hero { background: var(--bg); border-bottom: 1px solid var(--line-soft); padding: clamp(18px, 3vw, 28px) 0 clamp(24px, 4vw, 36px); margin-bottom: clamp(24px, 4vw, 36px); }
.tools-hero h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 2.8rem); letter-spacing: -.035em; font-weight: 800; margin: 0 0 10px; }
.tools-hero__lede { font-size: 1.075rem; color: var(--ink-2); max-width: 70ch; }
.tools-search { position: relative; max-width: 640px; margin-top: 8px; }
.tools-search__icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); display: flex; }
.tools-directory .tools-search input[type=search] { min-height: 54px; padding-left: 46px; font-size: 1.05rem; border-radius: 12px; box-shadow: var(--shadow-sm); }
.tools-search__hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 0; font-size: .9rem; color: var(--muted); }
.tools-group { margin-bottom: 36px; scroll-margin-top: calc(var(--header-h) + var(--admin-bar) + 16px); }
.tools-group__title { display: flex; align-items: center; gap: 12px; font-size: 1.3rem; margin-bottom: 16px; }
.tools-group__title .tool-tile__icon { width: 36px; height: 36px; border-radius: 10px; }
.tools-empty { padding: 20px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }
.tools-directory__content { margin-top: 24px; }
