/* GradeHelm calculators — theme-independent styles (palette via CSS variables with fallbacks). */
.gh-calc {
	--c-navy: var(--gh-navy, #101B35);
	--c-blue: var(--gh-blue, #3563FF);
	--c-blue-deep: var(--gh-blue-deep, #2A4FE0);
	--c-cyan: var(--gh-cyan, #22D3EE);
	--c-ice: var(--gh-ice, #F5F7FC);
	--c-line: var(--gh-line, #E2E7F2);
	--c-muted: var(--gh-muted, #4A5878);
	--c-danger: #B42318;
	--c-good: #0E7A55;
	--c-ease: cubic-bezier(.2, .7, .2, 1);
	position: relative;
	margin-block: clamp(20px, 3vw, 32px) clamp(28px, 4vw, 48px) !important;
	color: var(--c-navy);
	font-size: 1rem;
	line-height: 1.5;
}
.gh-calc *, .gh-calc *::before, .gh-calc *::after { box-sizing: border-box; }
.gh-calc [hidden] { display: none !important; }
.wp-block-post-content > .gh-calc:first-child { margin-block-start: 0 !important; }
.gh-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.gh-noscript { background: #FFF4E5; border-radius: 12px; padding: 12px 16px; }

.gh-calc__grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.gh-calc__panel { background: #fff; border: 1px solid var(--c-line); border-radius: 22px; padding: clamp(18px, 2.4vw, 28px); box-shadow: 0 2px 4px rgba(16, 27, 53, .04), 0 18px 40px rgba(16, 27, 53, .07); }
.gh-calc__side { display: grid; gap: 16px; position: sticky; top: calc(var(--gh-header-h, 68px) + 16px); }
.gh-calc__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.gh-calc__title { margin: 0 !important; font-size: 1.25rem !important; letter-spacing: -0.01em; }
.gh-calc__sub { margin: 18px 0 8px !important; font-size: 1rem !important; color: var(--c-muted); font-weight: 700; }

/* Fields */
.gh-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gh-field__label { font-size: .9rem; font-weight: 700; color: var(--c-navy); }
.gh-field__hint { margin: 0; font-size: .84rem; color: var(--c-muted); line-height: 1.4; }
.gh-field__error { margin: 0; font-size: .82rem; font-weight: 600; color: var(--c-danger); }
.gh-input { width: 100%; min-height: 48px; padding: 0 14px; border: 1.5px solid #7F8CAB; /* 3.36:1 on white (WCAG 1.4.11) */ border-radius: 12px; background: #fff; color: var(--c-navy); font: inherit; font-size: 1rem; transition: border-color .2s, box-shadow .2s, background-color .2s; -webkit-appearance: none; appearance: none; }
.gh-input::placeholder { color: #66728F; } /* 4.81:1 */
.gh-input:hover { border-color: #4A5878; }
.gh-input:focus { outline: none; border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(53, 99, 255, .22); }
.gh-input[aria-invalid="true"] { border-color: var(--c-danger); background: #FFF8F7; }
.gh-input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px rgba(180, 35, 24, .15); }
.gh-select { padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234A5878' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; cursor: pointer; }
.gh-input-wrap--suffix { position: relative; }
.gh-input-wrap--suffix .gh-input { padding-right: 38px; }
.gh-input-suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--c-muted); font-weight: 700; pointer-events: none; }
.gh-check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; cursor: pointer; }
.gh-check input { width: 20px; height: 20px; accent-color: var(--c-blue); margin: 0; }
.gh-check--small { font-size: .9rem; font-weight: 500; color: var(--c-muted); }

/* Rows */
.gh-rows { display: grid; gap: 10px; }
.gh-rows__list { display: grid; gap: 10px; }
.gh-rows__head, .gh-row { display: grid; gap: 10px; align-items: start; grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.2fr) minmax(0, 1fr) 44px; }
.gh-rows--hs .gh-rows__head, .gh-rows--hs .gh-row { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.2fr) 44px; }
.gh-rows--cat .gh-rows__head, .gh-rows--cat .gh-row, .gh-rows--pts .gh-rows__head, .gh-rows--pts .gh-row, .gh-rows--term .gh-rows__head, .gh-rows--term .gh-row { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 44px; }
.gh-rows__head { font-size: .9rem; font-weight: 700; color: var(--c-navy); padding: 0 2px; }
.gh-row .gh-field__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.gh-row.is-new { animation: gh-row-in .35s var(--c-ease); }
.gh-row__remove { width: 44px; height: 48px; border: 1.5px solid transparent; border-radius: 12px; background: transparent; color: var(--c-muted); cursor: pointer; display: grid; place-items: center; transition: background .2s, color .2s, border-color .2s, transform .2s; }
.gh-row__remove:hover { background: #FDECEA; color: var(--c-danger); }
.gh-row__remove:active { transform: scale(.92); }
.gh-row__remove:focus-visible, .gh-cbtn:focus-visible, .gh-pill:focus-visible, .gh-mode__opt input:focus-visible + span, .gh-scale__summary:focus-visible, .gh-math summary:focus-visible { outline: 3px solid var(--c-blue); outline-offset: 2px; }

.gh-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.gh-pair--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gh-pct-toggle { margin: -6px 0 6px; }
.gh-weighted { margin: 4px 0 -4px; }
.gh-scale__hint { flex-basis: 100%; margin: 4px 0 0; font-size: .8rem; color: var(--c-muted); line-height: 1.45; }
.gh-plan__scope { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: var(--c-muted); }
.gh-plan__scope a { color: var(--c-blue-deep); font-weight: 600; display: inline-block; padding-block: 4px; }

/* Buttons */
.gh-cbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent; font: inherit; font-weight: 700; font-size: .975rem; cursor: pointer; transition: transform .2s var(--c-ease), box-shadow .25s var(--c-ease), background-color .2s, color .2s, border-color .2s; }
.gh-cbtn:active { transform: scale(.97); }
.gh-cbtn--primary { background: var(--c-blue); color: #fff; box-shadow: 0 6px 16px rgba(53, 99, 255, .28); }
.gh-cbtn--primary:hover { background: #2A55F5; transform: translateY(-2px); box-shadow: 0 10px 26px rgba(53, 99, 255, .34), 0 0 0 1px rgba(34, 211, 238, .35); }
.gh-cbtn--ghost { background: #EEF2FF; color: var(--c-blue-deep); }
.gh-cbtn--ghost:hover { background: #E1E8FF; transform: translateY(-2px); }
.gh-cbtn--text { background: transparent; color: var(--c-muted); padding: 0 12px; }
.gh-cbtn--text:hover { color: var(--c-navy); background: var(--c-ice); }
.gh-cbtn--add { justify-self: start; background: #fff; color: var(--c-blue-deep); border: 1.5px dashed #9DB0E8; }
.gh-cbtn--add:hover { border-style: solid; border-color: var(--c-blue); background: #F4F7FF; transform: translateY(-1px); }
.gh-cbtn--onnavy { min-height: 44px; background: rgba(255, 255, 255, .08); color: #fff; border-color: rgba(143, 166, 255, .35); font-size: .9rem; }
.gh-cbtn--onnavy:hover { border-color: var(--c-cyan); background: rgba(255, 255, 255, .14); transform: translateY(-1px); }
.gh-calc__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.gh-calc__formerror { margin: 12px 0 0; padding: 10px 14px; border-radius: 10px; background: #FDECEA; color: var(--c-danger); font-weight: 600; font-size: .9rem; }
.gh-calc__foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--c-line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }
.gh-calc__privacy { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--c-muted); }

/* Mode switch (segmented control) */
.gh-mode { border: 0; margin: 0 0 14px; padding: 4px; display: inline-flex; gap: 4px; background: var(--c-ice); border-radius: 14px; }
.gh-mode__opt { position: relative; cursor: pointer; }
.gh-mode__opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.gh-mode__opt span { display: inline-flex; align-items: center; min-height: 42px; padding: 0 16px; border-radius: 10px; font-weight: 700; font-size: .92rem; color: var(--c-muted); transition: background .25s var(--c-ease), color .2s, box-shadow .25s; }
.gh-mode__opt input:checked + span { background: #fff; color: var(--c-navy); box-shadow: 0 2px 8px rgba(16, 27, 53, .10); }
.gh-mode__opt:hover span { color: var(--c-navy); }

/* Quick target pills */
.gh-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; font-size: .9rem; color: var(--c-muted); font-weight: 600; }
.gh-pill { min-width: 48px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--c-line); background: #fff; color: var(--c-navy); font: inherit; font-weight: 700; cursor: pointer; transition: border-color .2s, background .2s, transform .2s var(--c-ease), color .2s; }
.gh-pill:hover { border-color: var(--c-blue); color: var(--c-blue-deep); transform: translateY(-1px); }
.gh-pill[aria-pressed="true"] { background: var(--c-blue); border-color: var(--c-blue); color: #fff; }

/* Scale settings */
/* Scale settings open INSIDE the form (full width, pushing content down) at every screen size,
   so the panel can never float over the Calculate / Clear / row buttons. */
.gh-scale { position: relative; }
.gh-scale[open] { flex: 1 1 100%; }
.gh-scale__summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--c-ice); border: 1px solid var(--c-line); font-size: .85rem; font-weight: 600; color: var(--c-navy); cursor: pointer; transition: border-color .2s, background .2s; }
.gh-scale__summary::-webkit-details-marker { display: none; }
.gh-scale__summary:hover { border-color: #9DB0E8; background: #fff; }
.gh-scale__change { color: var(--c-blue-deep); font-weight: 700; }
.gh-scale[open] .gh-scale__summary { border-color: var(--c-blue); background: #fff; }
.gh-scale__panel { margin-top: 10px; width: 100%; max-width: 560px; padding: 16px; border-radius: 16px; border: 1px solid var(--c-line); background: #fff; box-shadow: 0 6px 18px rgba(16, 27, 53, .08); display: grid; gap: 12px; animation: gh-row-in .25s var(--c-ease); }
.gh-scale__intro { margin: 0; font-size: .875rem; color: var(--c-muted); }
.gh-scale__grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
.gh-scale__cutoffs { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.gh-scale__cutoffs legend { font-size: .85rem; font-weight: 700; margin-bottom: 6px; padding: 0; }
.gh-mini { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.gh-mini .gh-input { width: 72px; min-height: 44px; padding: 0 10px; }
.gh-mini--wide .gh-input { width: 84px; }

/* Result card — the dark "instrument panel" */
.gh-result { position: relative; overflow: hidden; border-radius: 22px; padding: 22px; color: #fff; background:
	radial-gradient(80% 60% at 100% 0%, rgba(34, 211, 238, .22), transparent 60%),
	radial-gradient(70% 80% at 0% 100%, rgba(53, 99, 255, .45), transparent 60%),
	var(--c-navy);
	box-shadow: 0 24px 50px rgba(16, 27, 53, .25); min-height: 220px; }
.gh-result::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; background: linear-gradient(140deg, rgba(34, 211, 238, .55), rgba(53, 99, 255, .15) 40%, rgba(255, 255, 255, .06)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; }
.gh-result.is-updated::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(34, 211, 238, .16) 50%, transparent 70%); transform: translateX(-100%); animation: gh-sheen .9s var(--c-ease) forwards; pointer-events: none; }
.gh-result__label { margin: 0 0 6px !important; font-size: .82rem !important; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: #AAB6D3 !important; font-family: inherit !important; }
.gh-result__empty { margin: 14px 0 0; color: #C9D3EA; font-size: 1rem; }
.gh-result__main { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gh-result__num { font-family: var(--gh-font-display, inherit); font-size: clamp(3rem, 6vw, 4.2rem); font-weight: 700; line-height: 1; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: #fff; text-shadow: 0 0 24px rgba(34, 211, 238, .2); }
.gh-result__main--warn .gh-result__num { color: #FFD7A8; text-shadow: none; }
.gh-result__main--good .gh-result__num { color: #9FF0D0; font-size: 2.6rem; }
.gh-result__unit { font-weight: 700; color: #AAB6D3; }
.gh-result__letter { font-family: var(--gh-font-display, inherit); font-weight: 700; font-size: 1.6rem; padding: 4px 14px; border-radius: 12px; background: rgba(34, 211, 238, .14); color: var(--c-cyan); border: 1px solid rgba(34, 211, 238, .35); }
.gh-result__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gh-result__pair .gh-result__num { font-size: clamp(2.4rem, 4.6vw, 3.2rem); display: block; }
.gh-result__cap { display: block; font-size: .8rem; color: #AAB6D3; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.gh-result__verdict { margin: 10px 0 0; color: #DCE3F5; }
.gh-result__verdict.is-warn { color: #FFD7A8; }
.gh-result__verdict.is-good { color: #9FF0D0; }
.gh-result__note { margin: 12px 0 0; font-size: .85rem; color: #C9D3EA; }
.gh-result__note.is-warn { color: #FFD7A8; }
.gh-badge { display: inline-flex; margin-top: 10px; padding: 4px 10px; border-radius: 999px; font-size: .82rem; font-weight: 700; }
.gh-badge.is-up { background: rgba(34, 211, 238, .14); color: var(--c-cyan); }
.gh-badge.is-down { background: rgba(255, 183, 120, .14); color: #FFD7A8; }
.gh-stats { margin: 16px 0 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.gh-stats div { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(143, 166, 255, .14); }
.gh-stats dt { font-size: .78rem; color: #AAB6D3; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.gh-stats dd { margin: 2px 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.gh-mini-table { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: .9rem; }
.gh-mini-table caption { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #AAB6D3; font-weight: 700; padding-bottom: 6px; }
.gh-mini-table th, .gh-mini-table td { padding: 8px 10px; border-bottom: 1px solid rgba(143, 166, 255, .14); text-align: left; font-variant-numeric: tabular-nums; }
.gh-mini-table thead th { color: #AAB6D3; font-size: .78rem; }
.gh-mini-table td { font-weight: 700; }

.gh-math { margin-top: 16px; border-top: 1px solid rgba(143, 166, 255, .18); padding-top: 12px; }
.gh-math summary { list-style: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; font-weight: 700; color: var(--c-cyan); border-radius: 8px; }
.gh-math summary::-webkit-details-marker { display: none; }
.gh-math summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform .25s var(--c-ease); }
.gh-math[open] summary::before { transform: rotate(45deg); }
.gh-math summary:hover { color: #fff; }
.gh-math__steps { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: .88rem; }
.gh-calc .gh-math__steps li { margin: 0; display: flex; justify-content: space-between; gap: 12px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); color: #DCE3F5; font-variant-numeric: tabular-nums; }
.gh-math__formula { margin: 10px 0 0; font-size: .88rem; font-weight: 700; color: #fff; }
.gh-result__actions { margin-top: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.gh-result__toast { font-size: .85rem; color: var(--c-cyan); font-weight: 600; word-break: break-all; }

/* Plan panel */
.gh-plan { border-radius: 22px; padding: 20px; background: linear-gradient(180deg, #F4F7FF, #fff); border: 1px solid #D9E2FA; }
.gh-plan__title { display: flex; align-items: center; gap: 8px; margin: 0 0 12px !important; font-size: 1.05rem !important; color: var(--c-navy); }
.gh-plan__title svg { color: var(--c-blue-deep); }
.gh-plan__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.gh-plan__text { margin: 0; color: var(--c-muted); font-size: .95rem; }
.gh-plan__out { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid var(--c-line); font-size: .95rem; color: var(--c-muted); transition: background .3s, border-color .3s; }
.gh-plan__out.is-good { border-color: rgba(53, 99, 255, .35); color: var(--c-navy); background: #F7F9FF; }
.gh-plan__out.is-warn { border-color: #F3C89B; background: #FFF8EF; color: #6B3A00; }
.gh-plan__out strong { color: var(--c-blue-deep); }
.gh-plan__out.is-warn strong { color: #8A4300; }
.gh-plan__links { margin: 12px 0 0; font-size: .9rem; color: var(--c-muted); }
.gh-plan__links { line-height: 1.9; }
.gh-plan__links a { display: inline-block; padding-block: 5px; color: var(--c-blue-deep); font-weight: 600; text-underline-offset: 3px; }

@keyframes gh-row-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes gh-sheen { to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
	.gh-calc *, .gh-calc *::before, .gh-calc *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* Tablet / mobile */
@media (max-width: 960px) {
	.gh-calc__grid { grid-template-columns: minmax(0, 1fr); }
	.gh-calc__side { position: static; }
}
@media (max-width: 640px) {
	.gh-rows__head { display: none; }
	.gh-row, .gh-rows--hs .gh-row, .gh-rows--cat .gh-row, .gh-rows--pts .gh-row, .gh-rows--term .gh-row { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 12px; border: 1px solid var(--c-line); border-radius: 16px; background: #FBFCFF; position: relative; }
	.gh-row .gh-field--name { grid-column: 1 / -1; padding-right: 44px; }
	.gh-row .gh-field__label { position: static; width: auto; height: auto; clip: auto; overflow: visible; white-space: normal; }
	.gh-row__remove { position: absolute; top: 6px; right: 6px; }
	.gh-pair, .gh-pair--3, .gh-plan__fields { grid-template-columns: minmax(0, 1fr); }
	.gh-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.gh-scale__panel { position: static; width: auto; }
	.gh-calc__actions .gh-cbtn--primary { flex: 1 1 100%; }
	.gh-result { min-height: 0; scroll-margin-top: calc(var(--gh-header-h, 68px) + 12px); }
	.gh-mode { display: flex; }
	.gh-mode__opt { flex: 1; }
	.gh-mode__opt span { justify-content: center; width: 100%; }
}
