/* Tools hub and the tool-page wrapper.
   From design/source/Tools.dc.html, PointsCalculator.dc.html, M-Tools and M-Points.

   IMPORTANT: the rules that reach inside the calculator widget are restricted to
   colour and font-family on purpose. Nothing in this file sets width, height,
   padding, margin, display, position or flex/grid inside the widget, because the
   mobile geometry there was measured and fixed in amg-tools-mobile.php v1.7 and
   must not move. See tools-mobile/TOOLS_MOBILE_RECORD.md. */

/* =============================================================== TOOLS HUB */

.amg-toolshub { background: var(--amg-bg); }

.amg-toolshub__head { background: var(--amg-surface); border-bottom: 1px solid var(--amg-line); }
.amg-toolshub__head-row { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; padding-top: 28px; padding-bottom: 28px; }
@media (min-width: 768px) { .amg-toolshub__head-row { gap: 32px; padding-top: 40px; padding-bottom: 40px; } }

.amg-toolshub__intro { flex: 1 1 480px; display: flex; flex-direction: column; gap: 12px; }
.amg-toolshub__crumbs { margin: 0; font-size: 14px; color: var(--amg-muted); }
.amg-toolshub__intro h1 { margin: 0; font-weight: 700; font-size: clamp(28px, 6vw, 48px); line-height: 1.1; color: var(--amg-green); }
.amg-toolshub__lede { margin: 0; font-size: 15px; max-width: 560px; }
@media (min-width: 768px) { .amg-toolshub__lede { font-size: 17px; } }
.amg-toolshub__byline { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--amg-muted); }
.amg-toolshub__byline img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: top; }

.amg-toolshub__picker { flex: 1 1 340px; background: var(--amg-green); border-radius: var(--amg-radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; color: #fff; }
.amg-toolshub__picker strong { font-weight: 600; font-size: 18px; }
.amg-toolshub__picker-note { font-size: 14px; color: var(--amg-topbar-text); }
.amg-toolshub__asks { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 480px) { .amg-toolshub__asks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.amg-toolshub__ask {
  display: flex; align-items: center; min-height: var(--amg-tap);
  border: 1.5px solid var(--amg-green-line); border-radius: var(--amg-radius);
  background: transparent; color: #fff; font-size: 14px; padding: 8px 12px;
  text-decoration: none;
}
.amg-toolshub__ask:hover, .amg-toolshub__ask.is-on { background: var(--amg-green-2); color: #fff; border-color: var(--amg-gold); text-decoration: none; }

.amg-toolshub__main { display: flex; flex-direction: column; gap: 20px; padding-top: 24px; padding-bottom: 48px; }
@media (min-width: 768px) { .amg-toolshub__main { padding-top: 36px; padding-bottom: 72px; } }
.amg-toolshub__group { display: flex; flex-direction: column; gap: 12px; }
.amg-toolshub__group-head { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--amg-gold-dark); }

.amg-toolshub__grid { display: flex; flex-direction: column; gap: 0; }
@media (min-width: 768px) { .amg-toolshub__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 26px 24px; } }

/* A compact row on phones, a card from 768 (mobile spec M4). */
.amg-toolcard { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--amg-line); color: inherit; text-decoration: none; }
.amg-toolcard:hover { color: inherit; text-decoration: none; }
.amg-toolcard:hover .amg-toolcard__name { text-decoration: underline; }
.amg-toolcard__media { position: relative; display: block; flex: 0 0 72px; }
.amg-toolcard__media img { width: 72px; height: 54px; object-fit: cover; border-radius: var(--amg-radius-sm); display: block; }
.amg-toolcard__tags { display: none; }
.amg-toolcard__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.amg-toolcard__name { font-weight: 600; font-size: 16px; line-height: 1.3; color: var(--amg-green); }
.amg-toolcard__flag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; background: var(--amg-cream); color: var(--amg-gold-dark); padding: 2px 7px; border-radius: 3px; vertical-align: middle; }
.amg-toolcard__desc { font-size: 14px; color: var(--amg-text); }
.amg-toolcard__go { font-size: 14px; font-weight: 600; color: var(--amg-gold-dark); }

@media (min-width: 768px) {
  .amg-toolcard { flex-direction: column; gap: 10px; padding: 0; border-bottom: 0; }
  .amg-toolcard__media { flex: none; }
  .amg-toolcard__media img { width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: var(--amg-radius); }
  .amg-toolcard__tags { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 4px; }
  .amg-toolcard__tags span { font-size: 12px; font-weight: 600; background: #fff; color: var(--amg-green); padding: 2px 8px; border-radius: 3px; }
  .amg-toolcard__name { font-size: 19px; }
  .amg-toolcard__desc { font-size: 15px; }
}

.amg-toolshub__disclaimer { margin: 8px 0 0; font-size: 14px; color: var(--amg-muted); border-top: 1px solid var(--amg-line); padding-top: 16px; }

/* ============================================================= TOOL PAGES */

.amg-tool-hero { background: var(--amg-cream); border-bottom: 1px solid var(--amg-cream-border); }
.amg-tool-hero__inner { display: flex; gap: 14px; align-items: center; padding-top: 22px; padding-bottom: 22px; }
@media (min-width: 768px) { .amg-tool-hero__inner { gap: 18px; padding-top: 32px; padding-bottom: 32px; } }

.amg-tool-hero__icon { flex: 0 0 48px; height: 48px; border-radius: 14px; background: var(--amg-gold-dark); color: #fff; display: flex; align-items: center; justify-content: center; }
.amg-tool-hero__icon svg { width: 26px; height: 26px; }
@media (min-width: 768px) {
  .amg-tool-hero__icon { flex: 0 0 64px; height: 64px; border-radius: 18px; }
  .amg-tool-hero__icon svg { width: 32px; height: 32px; }
}

.amg-tool-hero__text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.amg-tool-hero__crumbs { margin: 0; font-size: 13px; color: var(--amg-text); }
@media (min-width: 768px) { .amg-tool-hero__crumbs { font-size: 14px; } }
h1.amg-tool-hero__title { margin: 0; font-weight: 700; font-size: clamp(24px, 5.4vw, 44px); line-height: 1.05; color: var(--amg-green); }
.amg-tool-hero__desc { margin: 0; font-size: 15px; color: var(--amg-text); }
@media (min-width: 768px) { .amg-tool-hero__desc { font-size: 16px; } }

.amg-tool-after { background: var(--amg-bg); padding-bottom: 32px; }

.amg-tool-readnext { padding-top: 28px; }
.amg-tool-readnext h2 { margin: 0 0 12px; font-size: 20px; font-weight: 700; color: var(--amg-green); border-bottom: 2px solid var(--amg-green); padding-bottom: 8px; }
.amg-tool-readnext__list { display: flex; flex-direction: column; }
@media (min-width: 768px) { .amg-tool-readnext__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; } }

.amg-tool-readnext__item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--amg-line); color: inherit; text-decoration: none; }
.amg-tool-readnext__item:hover { color: inherit; text-decoration: none; }
.amg-tool-readnext__item:hover strong { text-decoration: underline; }
.amg-tool-readnext__item img { flex: 0 0 104px; width: 104px; height: 74px; object-fit: cover; border-radius: var(--amg-radius-sm); }
.amg-tool-readnext__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.amg-tool-readnext__flag { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--amg-gold-dark); }
.amg-tool-readnext__item strong { font-size: 15px; line-height: 1.33; color: var(--amg-green); font-weight: 600; }
.amg-tool-readnext__meta { font-size: 12px; color: var(--amg-muted); }
@media (min-width: 768px) {
  .amg-tool-readnext__item { flex-direction: column; padding: 0; border-bottom: 0; }
  .amg-tool-readnext__item img { flex: none; width: 100%; height: auto; aspect-ratio: 3 / 2; border-radius: var(--amg-radius); }
  .amg-tool-readnext__item strong { font-size: 16px; }
}

.amg-tool-cta { padding-top: 24px; }
.amg-tool-cta__inner { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; justify-content: space-between; background: var(--amg-green); color: #fff; border-radius: var(--amg-radius); padding: 20px; }
.amg-tool-cta__inner strong { display: block; font-size: 17px; }
.amg-tool-cta__inner span { font-size: 14px; color: var(--amg-topbar-text); }
.amg-tool-cta .amg-btn { flex: 0 0 auto; }

.amg-tool-disclaimer { margin: 18px auto 0; font-size: 13px; color: var(--amg-muted); }

/* ---------------------------------------------------------------------------
   Branding inside the calculator widget.

   Colour and font-family only. No geometry: the v1.7 mobile fixes in
   amg-tools-mobile.php are what keep these eight pages usable at 320–375px,
   and anything here that changed a width, a track or a flex basis could undo
   them without being obvious.
   --------------------------------------------------------------------------- */

.amg-tool-page .elementor-widget-html {
  font-family: var(--amg-font-body);
  color: var(--amg-text);
}

.amg-tool-page .elementor-widget-html h1,
.amg-tool-page .elementor-widget-html h2,
.amg-tool-page .elementor-widget-html h3,
.amg-tool-page .elementor-widget-html h4 {
  font-family: var(--amg-font-heading);
  color: var(--amg-green);
}

/* Primary actions pick up the brand gold; green text on gold for contrast. */
.amg-tool-page .elementor-widget-html button[class*="btn"],
.amg-tool-page .elementor-widget-html [class*="-cta"] {
  background-color: var(--amg-gold);
  color: var(--amg-green);
  border-color: var(--amg-gold);
}

/* The sticky result bar is the same component as the design's, restyled. */
.amg-tool-page .amgmb {
  background-color: var(--amg-green);
  color: #fff;
}
.amg-tool-page .amgmb a,
.amg-tool-page .amgmb [class*="-val"] {
  color: var(--amg-gold);
}

.amg-tool-page .elementor-widget-html a { color: var(--amg-gold-dark); }
.amg-tool-page .elementor-widget-html a:hover { color: var(--amg-gold-darker); }

/* ----------------------------------------------------------------- shared */

.amg-toolshub :focus-visible,
.amg-tool-hero :focus-visible,
.amg-tool-after :focus-visible { outline: 3px solid var(--amg-gold); outline-offset: 2px; }
