/* Shared interface for LIFA's interactive sourcing tools. */
.tool-page-hero {
  min-height: min(760px, calc(100svh - 84px));
}

.tool-page-hero .hero-content-wrapper {
  padding-top: clamp(82px, 9vh, 112px);
  padding-bottom: clamp(76px, 8vh, 104px);
}

.tool-page-hero .hero-content {
  max-width: 780px;
}

.tool-page-hero .hero-content h1 {
  max-width: 880px;
  font-size: clamp(2.7rem, 5vw, 4.5rem);
  line-height: 1.04;
  margin-bottom: 24px;
}

.tool-page-hero .hero-content p {
  max-width: 730px;
}

.tools-suite-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(15, 30, 54, .06);
}

.tools-suite-nav .container {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-top: 12px;
  padding-bottom: 12px;
  scrollbar-width: thin;
}

.tools-suite-nav a {
  flex: 0 0 auto;
  color: var(--navy);
  font-size: .86rem;
  font-weight: 800;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 6px;
}

.tools-suite-nav a:hover,
.tools-suite-nav a:focus-visible,
.tools-suite-nav a[aria-current="page"] {
  color: var(--navy);
  background: var(--cream);
  border-color: rgba(201, 168, 76, .5);
}

.tool-answer-band {
  padding: 44px 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.tool-answer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(260px, .7fr);
  gap: 44px;
  align-items: center;
}

.tool-answer-grid h2 {
  font-size: clamp(2rem, 3.6vw, 3rem);
  margin-bottom: 12px;
}

.tool-answer-grid p {
  max-width: 780px;
  font-size: 1.08rem;
  line-height: 1.75;
}

.tool-fact-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--cream);
}

.tool-fact {
  min-height: 92px;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.tool-fact:nth-child(2n) { border-right: 0; }
.tool-fact:nth-last-child(-n + 2) { border-bottom: 0; }
.tool-fact strong { display: block; color: var(--navy); margin-bottom: 3px; }
.tool-fact span { color: var(--muted-text); font-size: .85rem; line-height: 1.45; }

.tool-workspace-section {
  padding: 72px 0 80px;
  background: #f4f6f9;
}

.tool-workspace-heading {
  display: flex;
  justify-content: space-between;
  gap: 28px;
  align-items: end;
  margin-bottom: 26px;
}

.tool-workspace-heading h2 {
  font-size: clamp(2.1rem, 4vw, 3.25rem);
  margin-bottom: 8px;
}

.tool-workspace-heading p {
  max-width: 720px;
}

.tool-updated {
  flex: 0 0 auto;
  color: var(--muted-text);
  font-size: .82rem;
  font-weight: 700;
}

.tool-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, .92fr);
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(15, 30, 54, .09);
  overflow: hidden;
}

.tool-inputs,
.tool-output {
  min-width: 0;
  padding: clamp(24px, 3.5vw, 42px);
}

.tool-output {
  background: #0f1e36;
  color: #fff;
  border-left: 1px solid rgba(255, 255, 255, .1);
}

.tool-form-section + .tool-form-section {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.tool-form-section h3,
.tool-output h3 {
  font-family: var(--heading-font);
  font-size: 1.48rem;
  margin-bottom: 6px;
}

.tool-form-section > p,
.tool-output > p {
  font-size: .9rem;
  margin-bottom: 18px;
}

.tool-output > p { color: rgba(255, 255, 255, .72); }

.tool-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 17px;
}

.tool-form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.tool-field.full { grid-column: 1 / -1; }

.tool-field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  color: var(--navy);
  font-size: .82rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 9px;
}

.tool-field label small {
  color: var(--muted-gold);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  text-transform: none;
}

/* Input / select / textarea visuals come from the PREMIUM UNIFIED INPUT
   SYSTEM in styles.css (.field, .tool-field, .tool-form share one recipe).
   Only tool-specific states are defined here. */
.tool-field input:invalid:not(:placeholder-shown) {
  border-color: #a33b3b;
  box-shadow: 0 0 0 4px rgba(163, 59, 59, .12);
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.tool-action {
  min-height: 46px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 6px;
  font: inherit;
  font-size: .88rem;
  font-weight: 850;
  cursor: pointer;
}

.tool-action-primary {
  flex: 1 1 190px;
  background: var(--gold);
  color: var(--deep-ink);
}

.tool-action-primary:hover,
.tool-action-primary:focus-visible { background: var(--gold-light); }

.tool-action-secondary {
  background: #fff;
  color: var(--navy);
  border-color: #cbd3df;
}

.tool-action-secondary:hover,
.tool-action-secondary:focus-visible { border-color: var(--gold); }

.tool-output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.tool-output-actions button {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 5px;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  font: inherit;
  font-size: .76rem;
  font-weight: 800;
  cursor: pointer;
}

.tool-output-actions button:hover,
.tool-output-actions button:focus-visible {
  border-color: var(--gold);
  color: var(--gold-light);
}

.tool-empty-state {
  min-height: 320px;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, .22);
  border-radius: 7px;
  padding: 30px;
  color: rgba(255, 255, 255, .72);
}

.tool-empty-state strong {
  display: block;
  color: #fff;
  font-family: var(--heading-font);
  font-size: 1.55rem;
  margin-bottom: 8px;
}

.tool-result { display: none; }
.tool-result.is-visible { display: block; }

.tool-result-summary {
  padding: 18px 20px;
  background: rgba(201, 168, 76, .13);
  border-left: 3px solid var(--gold);
  margin-bottom: 20px;
}

.tool-result-summary strong {
  display: block;
  color: var(--gold-light);
  font-size: 1.05rem;
  margin-bottom: 5px;
}

.tool-result-summary p {
  color: rgba(255, 255, 255, .82);
  font-size: .88rem;
  margin: 0;
}

.tool-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 7px;
  overflow: hidden;
}

.tool-metric {
  min-height: 104px;
  padding: 17px;
  border-right: 1px solid rgba(255, 255, 255, .14);
  border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.tool-metric:nth-child(2n) { border-right: 0; }
.tool-metric:nth-last-child(-n + 2) { border-bottom: 0; }
.tool-metric span { display: block; color: rgba(255, 255, 255, .64); font-size: .74rem; font-weight: 700; margin-bottom: 6px; }
.tool-metric strong { display: block; color: #fff; font-size: 1.32rem; line-height: 1.22; }
.tool-metric small { display: block; color: rgba(255, 255, 255, .58); font-size: .68rem; margin-top: 5px; }

.tool-result-table-wrap {
  overflow-x: auto;
  margin-top: 20px;
}

.tool-result-table {
  width: 100%;
  border-collapse: collapse;
  color: #fff;
  font-size: .78rem;
}

.tool-result-table th,
.tool-result-table td {
  padding: 11px 9px;
  border-bottom: 1px solid rgba(255, 255, 255, .13);
  text-align: left;
  white-space: nowrap;
}

.tool-result-table th { color: var(--gold-light); }
.tool-result-table tr:last-child td { border-bottom: 0; }
.tool-result-table .is-best td { background: rgba(51, 153, 102, .14); }

.tool-method-note {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, .14);
  color: rgba(255, 255, 255, .68);
  font-size: .76rem;
  line-height: 1.6;
}

.tool-method-note a { color: var(--gold-light); text-decoration: underline; }

.tool-feedback {
  min-height: 20px;
  margin-top: 10px;
  color: #2f7656;
  font-size: .78rem;
  font-weight: 750;
}

.tool-content-section .section-heading {
  max-width: 850px;
}

.tool-methodology {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.tool-method-step {
  min-height: 210px;
  padding: 26px 23px;
  border-right: 1px solid var(--line);
}

.tool-method-step:last-child { border-right: 0; }
.tool-method-step .lifa-number-badge { margin-bottom: 16px; }
.tool-method-step h3 { font-size: 1.18rem; margin-bottom: 8px; }
.tool-method-step p { font-size: .9rem; }

.tool-source-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.tool-source-list a {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 15px 17px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--navy);
  font-weight: 800;
}

.tool-source-list a span {
  color: var(--muted-text);
  font-size: .76rem;
  font-weight: 650;
}

.tools-directory-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.tools-directory-grid .link-card {
  min-height: 250px;
}

.tools-directory-grid .link-card[aria-current="page"] {
  border-color: var(--gold);
  background: linear-gradient(180deg, #fff, #fffaf0);
}

@media (max-width: 1050px) {
  .tool-workspace { grid-template-columns: 1fr; }
  .tool-output { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .1); }
  .tool-methodology { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-method-step:nth-child(2) { border-right: 0; }
  .tool-method-step:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .tools-directory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .tool-page-hero { min-height: auto; }
  .tool-page-hero .hero-content h1 { font-size: clamp(2.45rem, 13vw, 3.45rem); }
  .tool-answer-grid { grid-template-columns: 1fr; gap: 26px; }
  .tool-workspace-section { padding: 54px 0 62px; }
  .tool-workspace-heading { display: block; }
  .tool-updated { display: block; margin-top: 10px; }
  .tool-inputs, .tool-output { padding: 24px 19px; }
  .tool-form-grid,
  .tool-form-grid.cols-3,
  .tools-directory-grid { grid-template-columns: 1fr; }
  .tool-methodology { grid-template-columns: 1fr; }
  .tool-method-step,
  .tool-method-step:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--line); }
  .tool-method-step:last-child { border-bottom: 0; }
  .tool-empty-state { min-height: 240px; }
  .tool-source-list a { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (max-width: 430px) {
  .tool-fact-list,
  .tool-metrics { grid-template-columns: 1fr; }
  .tool-fact,
  .tool-fact:nth-child(2n),
  .tool-metric,
  .tool-metric:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .tool-metric,
  .tool-metric:nth-child(2n) { border-bottom-color: rgba(255, 255, 255, .14); }
  .tool-fact:last-child,
  .tool-metric:last-child { border-bottom: 0; }
}

@media print {
  .site-header,
  .tool-page-hero,
  .tools-suite-nav,
  .tool-inputs,
  .tool-output-actions,
  .tool-content-section,
  .site-footer,
  .floating-contact,
  .wechat-modal { display: none !important; }
  .tool-workspace-section { padding: 0; background: #fff; }
  .tool-workspace { display: block; box-shadow: none; border: 0; }
  .tool-output { display: block; background: #fff; color: #111; border: 0; }
  .tool-output h3,
  .tool-result-summary strong,
  .tool-metric strong,
  .tool-result-table,
  .tool-result-table th,
  .tool-result-table td { color: #111; }
  .tool-result-summary,
  .tool-metrics { border-color: #bbb; background: #fff; }
  .tool-metric { border-color: #ddd; }
}
