/*
 * Health tool pages (/tools/...) and the list of tools (/tools): a band in the tool's colour with
 * its icon, name and a short line, the calculator on a white panel that rests on the band, and
 * the other tools as the home page's tool cards. The calculators' own styles live with them in
 * the Shohay plugin (assets/calculators.css). Rules: DESIGN.md.
 */

/* ---------- Head: the tool's colour ---------- */

.sh-toolpage__head {
    padding: clamp(36px, 5vw, 64px) 16px clamp(96px, 9vw, 132px);
    background: var(--tone-tint, var(--sh-smoke-tint));
    text-align: center;
}
/* No peach or cream on large surfaces (owner): the period tool's blush and the calorie tool's
   butterscotch bands are mist; their colour stays in the icon and the kicker */
.sh-toolpage.sh-tone--blush .sh-toolpage__head,
.sh-toolpage.sh-tone--butterscotch .sh-toolpage__head { background: var(--sh-mist); }
.sh-toolpage__intro { display: flex; flex-direction: column; align-items: center; max-width: 720px; margin: 0 auto; }

/* A white tile with soft rings, like the home page's icon tiles */
.sh-toolpage__icon {
    display: grid; place-items: center; width: 64px; height: 64px; margin: 0 0 24px;
    border-radius: 13px; background: #fff; color: var(--tone-ink);
    box-shadow: 0 0 0 9px rgba(255, 255, 255, .42), 0 0 0 20px rgba(255, 255, 255, .2), 0 10px 24px rgba(60, 50, 40, .1);
}
.sh-toolpage__icon svg { width: 30px; height: 30px; }

.sh-toolpage .sh-toolpage__kicker {
    color: var(--tone-ink, var(--sh-emerald-ink)); font-size: .88rem; font-weight: 600; line-height: 1.5; text-decoration: none;
}
.sh-toolpage .sh-toolpage__kicker:hover { color: var(--tone-ink, var(--sh-emerald-ink)); text-decoration: underline; text-underline-offset: .22em; }
.sh-toolpage__title {
    margin: 4px 0 0; color: var(--sh-ink);
    font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem); font-weight: 600; line-height: 1.35;
}
.sh-toolpage__lead {
    max-width: 600px; margin: 14px 0 0; color: var(--sh-ink-2);
    font-size: clamp(1.02rem, .98rem + .2vw, 1.12rem); line-height: 1.8;
}

/* ---------- The calculator, on a panel resting on the band ---------- */

.sh-toolpage__tool {
    position: relative; max-width: 752px; margin: calc(-1 * clamp(64px, 6.5vw, 96px)) auto 0; padding: 0 16px;
}
.sh-toolpage__tool #sbmi-calculator, .sh-toolpage__tool #scalorie-calculator, .sh-toolpage__tool #speriod-calculator,
.sh-toolpage__tool #sdiab-calculator, .sh-toolpage__tool #ssugar-calculator, .sh-toolpage__tool #sedd-calculator { margin-bottom: 0; }
/* The page title names the tool, so the calculator's own heading is not repeated */
.sh-toolpage .sbmi-heading,
.sh-toolpage .scalc-heading,
.sh-toolpage .speriod-heading,
.sh-toolpage .sdiab-heading,
.sh-toolpage .ssugar-heading,
.sh-toolpage #sedd-calculator .edd_step > h2 { display: none; }
.sh-toolpage .sbmi-card,
.sh-toolpage .scalc-card,
.sh-toolpage .speriod-card,
.sh-toolpage .sdiab-card,
.sh-toolpage .ssugar-card,
.sh-toolpage #sedd-calculator .edd_step { box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 12px 32px rgba(16, 24, 40, .08); }

.sh-toolpage__after { max-width: 720px; margin: 40px auto 0; padding: 0 16px; color: var(--sh-ink-2); font-size: 1.06rem; line-height: 1.8; }
/* A source under an answer: small and quiet (DESIGN.md: sources on tool pages) */
.sh-toolpage__after .sh-src { margin-top: -.4em; color: var(--sh-muted); font-size: .86rem; line-height: 1.6; }

/* ---------- One ad, marked "বিজ্ঞাপন" (site.css); nothing shows while it is empty. On the pregnancy calculator it sits
   between the chart and the answers; on the other tools after "আরও হেলথ টুল", out of the first screen, so that
   filling it moves nothing in sight ---------- */

.sh-toolpage__ad { max-width: 752px; margin: clamp(40px, 5vw, 56px) auto 0; padding: 0 16px; }
.sh-toolpage__more + .sh-toolpage__ad { margin: 0 auto clamp(56px, 7.5vw, 112px); }
.sh-toolpage__ad .banner-container { margin: 0; }
.sh-toolpage__ad ins.adsbygoogle[data-ad-status^="unfill"] { display: none !important; }
.sh-toolpage__ad:has(ins.adsbygoogle[data-ad-status^="unfill"]) { margin-top: 0; margin-bottom: 0; }

/* ---------- Under the pregnancy calculator: the weeks in each month, how the date is worked out ---------- */

.sh-pguide { max-width: 752px; margin: clamp(48px, 6vw, 72px) auto 0; padding: 0 16px; }
.sh-pguide__title { margin: 0 0 10px; color: var(--sh-ink); font-size: clamp(1.3rem, 1.15rem + .6vw, 1.6rem); font-weight: 600; line-height: 1.45; }
.sh-pguide p { margin: 0 0 12px; color: var(--sh-ink-2); font-size: 1.04rem; line-height: 1.8; }
.sh-pguide__table-wrap { margin: 18px 0 0; overflow-x: auto; border: 1px solid var(--sh-line); border-radius: var(--sh-radius); background: var(--sh-surface); }
.sh-pguide__table { width: 100%; border-collapse: collapse; font-size: 1rem; }
.sh-pguide__table th, .sh-pguide__table td { padding: 11px 16px; border-bottom: 1px solid var(--sh-line); line-height: 1.5; text-align: left; vertical-align: middle; }
.sh-pguide__table thead th { background: var(--sh-mist); color: var(--sh-muted); font-size: .9rem; font-weight: 600; }
.sh-pguide__table tbody th { color: var(--sh-ink); font-weight: 600; white-space: nowrap; }
.sh-pguide__table td { color: var(--sh-ink-2); }
.sh-pguide__table td:first-of-type { white-space: nowrap; }
.sh-pguide__table tr:last-child > * { border-bottom: 0; }
/* The row with the reader's weeks, once the calculator knows them: "আপনি এখানে", not "আপনার মাস", which read as a
   rounded-up month count beside the result's exact "(২ মাস ৫ দিন)" (owner) */
.sh-pguide__table tr.is-yours > * { background: var(--tone-tint); }
.sh-pguide__table tr.is-yours th::after {
    content: "আপনি এখানে"; display: inline-block; margin-left: 8px; padding: 1px 9px; border-radius: 999px;
    background: #fff; color: var(--tone-ink); font-size: .78rem; font-weight: 600; line-height: 1.6; vertical-align: 1px;
}
.sh-pguide__faq { margin: 22px 0 0; border-top: 1px solid var(--sh-line); }
.sh-pguide__faq details { border-bottom: 1px solid var(--sh-line); }
.sh-pguide__faq summary {
    position: relative; padding: 16px 40px 16px 0; color: var(--sh-ink); font-size: 1.05rem; font-weight: 600; line-height: 1.6;
    list-style: none; cursor: pointer;
}
.sh-pguide__faq summary::-webkit-details-marker { display: none; }
/* Heroicons 2.2.0 (MIT), 20/solid chevron-down */
.sh-pguide__faq summary::after {
    content: ""; position: absolute; top: 50%; right: 4px; width: 20px; height: 20px; margin-top: -10px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236b6b72'%3E%3Cpath fill-rule='evenodd' d='M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E") center / 20px no-repeat; transition: transform .3s var(--sh-ease);
}
.sh-pguide__faq details[open] summary::after { transform: rotate(180deg); }
.sh-pguide__faq details p { margin: 0 0 16px; }

/* ---------- The pregnancy calculator on phones: the question on the first screen ---------- */

@media (max-width: 575.98px) {
    .sh-toolpage--edd .sh-toolpage__head { padding: 22px 16px 76px; }
    .sh-toolpage--edd .sh-toolpage__icon { display: none; }
    .sh-toolpage--edd .sh-toolpage__lead { margin-top: 8px; font-size: .98rem; line-height: 1.7; }
    .sh-pguide__table th, .sh-pguide__table td { padding: 10px 12px; }
}
/* The smallest phones: "আপনি এখানে" under the month's name, so the chart never needs a sideways scroll */
@media (max-width: 359.98px) {
    .sh-pguide__table tr.is-yours th::after { display: table; margin: 4px 0 0; }
}

/* ---------- The other tools: the home page's tool cards ---------- */

.sh-toolpage__more { padding: clamp(56px, 7.5vw, 104px) 0 clamp(56px, 7.5vw, 112px); }
.sh-toolpage__more-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0 0 22px; }
.sh-toolpage__more-title { margin: 0; color: var(--sh-ink); font-size: clamp(1.35rem, 1.15rem + .8vw, 1.75rem); font-weight: 600; line-height: 1.4; }
.sh-toolpage__more .sh-toolpage__all { flex: none; color: var(--sh-blue); font-weight: 600; text-decoration: none; }
.sh-toolpage__more .sh-toolpage__all:hover { color: var(--sh-blue-deep); }

.sh-tools__grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 576px) { .sh-tools__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) {
    .sh-tools__grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sh-tools__grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sh-tools__grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

.sh-tools__grid .sh-tool {
    position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 18px;
    min-height: 200px; padding: 24px 22px 26px; text-align: left; text-decoration: none;
    background: var(--sh-surface); border: 1px solid var(--sh-line); border-radius: var(--sh-radius); box-shadow: var(--sh-shadow);
    color: var(--sh-ink);
    transition: transform .4s var(--sh-ease), box-shadow .4s var(--sh-ease);
}
.sh-tools__grid .sh-tool:hover, .sh-tools__grid .sh-tool:focus { color: var(--sh-ink); transform: translateY(-4px); box-shadow: var(--sh-shadow-hover); }
.sh-tools__grid .sh-tool:focus-visible { outline: 3px solid var(--sh-blue); outline-offset: 3px; }
.sh-tool__icon {
    display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 13px;
    background: var(--tone-tint); color: var(--tone-ink);
}
.sh-tool__icon svg { width: 26px; height: 26px; }
.sh-tool__text { display: flex; flex-direction: column; gap: 6px; }
.sh-tool__name { margin: 0; color: var(--sh-ink); font-size: 1.08rem; font-weight: 600; line-height: 1.5; }
.sh-tool__desc { color: var(--sh-muted); font-size: .95rem; line-height: 1.65; }
.sh-tool__go { position: absolute; top: 24px; right: 20px; color: #b9b9c0; transition: transform .3s var(--sh-ease), color .2s ease; }
.sh-tool__go svg { display: block; width: 18px; height: 18px; }
.sh-tool:hover .sh-tool__go { color: var(--tone-ink); transform: translateX(3px); }

@media (max-width: 991.98px) {
    .sh-tools__grid > .sh-tool:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .sh-tools__grid .sh-tool { flex-direction: row; align-items: center; gap: 16px; min-height: 0; padding: 16px 44px 16px 16px; }
    .sh-tool__icon { width: 48px; height: 48px; border-radius: 12px; }
    .sh-tool__go { top: 50%; right: 16px; margin-top: -9px; }
}

/* ---------- The list of tools: in groups, every row full ---------- */

.sh-toolpage--list .sh-toolpage__head { padding: clamp(40px, 6vw, 84px) 16px clamp(28px, 4vw, 48px); background: none; }
.sh-toolpage--list .sh-container { padding-bottom: clamp(56px, 7.5vw, 112px); }
.sh-tools__group + .sh-tools__group { margin-top: clamp(36px, 4.5vw, 56px); }
.sh-tools__group-title {
    margin: 0 0 16px; color: var(--sh-ink);
    font-size: clamp(1.2rem, 1.1rem + .45vw, 1.45rem); font-weight: 600; line-height: 1.4;
}
/* The cards lie flat on every screen: the icon beside the name, so each name fits on one line */
@media (min-width: 992px) {
    /* Four tools in a group sit two and two, so each name fits on one line */
    .sh-toolpage--list .sh-tools__grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sh-toolpage--list .sh-tools__grid .sh-tool { flex-direction: row; align-items: center; gap: 18px; min-height: 112px; padding: 22px 48px 22px 22px; }
    .sh-toolpage--list .sh-tool__go { top: 50%; right: 20px; margin-top: -9px; }
}

/* One focus ring per control (DESIGN.md) */
.sh-toolpage a:focus-visible,
.sh-toolpage__more a:focus-visible { outline: 3px solid var(--sh-blue); outline-offset: 3px; border-radius: 4px; }
.sh-tools__grid .sh-tool:focus-visible { border-radius: var(--sh-radius); }

/* ---------- Phones ---------- */

@media (max-width: 575.98px) {
    .sh-toolpage__head { padding: 30px 16px 84px; }
    .sh-toolpage__icon { width: 56px; height: 56px; margin-bottom: 20px; box-shadow: 0 0 0 7px rgba(255, 255, 255, .42), 0 0 0 16px rgba(255, 255, 255, .2), 0 8px 20px rgba(60, 50, 40, .1); }
    .sh-toolpage__icon svg { width: 26px; height: 26px; }
    .sh-toolpage__tool { margin-top: -56px; padding: 0 12px; }
    .sh-toolpage--list .sh-toolpage__head { padding: 36px 16px 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .sh-tools__grid .sh-tool, .sh-tool__go, .sh-pguide__faq summary::after { transition: none; }
    .sh-tools__grid .sh-tool:hover, .sh-tools__grid .sh-tool:focus { transform: none; }
}
