/* Dry Matter Basis Calculator page: the calculator is the opener */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.calc-open { background: var(--oat) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0V32' fill='none' stroke='%231F3B2D' stroke-opacity='.07'/%3E%3C/svg%3E") 0 0 / 32px 32px; padding: calc(var(--hdr) + clamp(20px, 3vw, 40px)) 0 clamp(40px, 5vw, 72px); position: relative; overflow: clip; }
.calc-open::before { content: ''; position: absolute; width: 56vw; height: 56vw; left: -18vw; top: -22vw; background: radial-gradient(closest-side, rgba(94, 143, 138, .3), transparent 70%); animation: drift 9s ease-in-out infinite alternate; pointer-events: none; }
.calc-open__grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 4vw, 64px); align-items: start; position: relative; }
.calc-open h1 { font-size: clamp(2.1rem, 3.2vw, 3.2rem); margin-bottom: .25em; }
.calc-open .crumb { margin-bottom: 4px; }
.calc-open__lede { color: var(--ink-soft); font-size: 1.06rem; margin-bottom: .9em; }
.dmbf { background: var(--white); border-radius: var(--r); padding: clamp(18px, 2vw, 28px); box-shadow: 0 18px 40px rgba(18, 36, 27, .08); }
.dmbf__example { font-size: .92rem; color: var(--brass-deep); font-weight: 600; margin-bottom: 10px; }
.dmbf__moist { display: grid; grid-template-columns: 200px 1fr; gap: 18px; align-items: end; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid #E3E8DF; }
.dmbf__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.field--pct label { font-size: .92rem; }
.field--pct label span { display: block; font-weight: 400; color: var(--ink-soft); font-size: .875rem; }
.pct { position: relative; }
.pct input { padding-right: 34px; font-variant-numeric: tabular-nums; font-size: 1.1rem; }
.pct span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); pointer-events: none; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: .95rem; color: var(--ink-soft); cursor: pointer; min-height: 44px; }
.check input { width: 22px; height: 22px; margin: 2px 0 0; accent-color: var(--forest); flex: none; }
.dmbf__err { color: #8A2B1E; font-weight: 600; margin: 0 0 14px; }

.calc-open__result { background: var(--forest); color: var(--on-dark); border-radius: var(--r); padding: clamp(20px, 2.4vw, 32px); position: relative; overflow: hidden; }
.res__h { font-size: clamp(1.7rem, 2.4vw, 2.3rem); margin-bottom: .2em; }
.res__sub { color: var(--on-dark-soft); margin-bottom: 18px; }
.res__sub strong { color: var(--wheat); font-variant-numeric: tabular-nums; }
.res__body { display: grid; grid-template-columns: 120px 1fr; gap: 24px; align-items: end; }
.res__tube { position: relative; height: min(40vh, 330px); border: 1px solid rgba(242, 237, 226, .35); border-top: 0; border-radius: 0 0 var(--r) var(--r); overflow: hidden; }
.res__fill { position: absolute; left: 0; right: 0; bottom: 0; height: 100%; display: flex; flex-direction: column-reverse; transform-origin: 50% 100%; }
.res__fill .seg { display: block; flex: none; height: 0; transition: height .9s var(--ease); }
.seg--water { background: var(--water); }
.seg--protein, .key--protein { background: var(--brass); }
.seg--fat, .key--fat { background: var(--wheat); }
.seg--fibre, .key--fibre { background: #8FB09A; }
.seg--ash, .key--ash { background: #B7B19E; }
.seg--carb, .key--carb { background: var(--sage); }
.res__tube-label { position: absolute; left: 0; right: 0; top: 8px; margin: 0; text-align: center; font-size: .875rem; font-weight: 600; color: var(--on-dark); }
.res__table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.res__table th, .res__table td { padding: 10px 8px; text-align: right; border-bottom: 1px solid rgba(242, 237, 226, .14); }
.res__table th[scope="row"] { text-align: left; font-weight: 500; display: flex; align-items: center; gap: 10px; }
.res__table thead th { font-size: .875rem; color: var(--on-dark-soft); font-weight: 600; }
.res__table thead th:first-child { text-align: left; }
.res__table td[data-dmb] { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: 1.45rem; color: var(--wheat); }
.key { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; }
.res__note { font-size: .9rem; color: var(--on-dark-soft); margin: 14px 0 10px; }
.res__toggle { background: none; border: 1px solid rgba(242, 237, 226, .5); color: var(--on-dark); min-height: 44px; padding: 10px 16px; border-radius: var(--rb); font-weight: 600; cursor: pointer; }
.res__toggle:hover { background: var(--wheat); color: var(--pine); border-color: var(--wheat); }

/* Why */
.why { background: var(--white); padding: var(--sec) 0; overflow: clip; }
.why__grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: clamp(32px, 5vw, 88px); align-items: center; }
.why__photo { margin: 0; position: relative; }
.why__photo [data-par] { aspect-ratio: 4 / 5; max-height: min(66vh, 600px); }
.why__photo figcaption { position: absolute; left: 16px; bottom: 16px; right: 16px; background: rgba(242, 237, 226, .95); padding: 10px 14px; border-radius: calc(var(--r) - 2px); font-weight: 600; font-size: .95rem; }
.why__list { display: grid; gap: 12px; margin-top: 8px; }
.wpoint { padding: 18px 20px; border-left: 3px solid var(--brass); background: var(--oat); border-radius: 0 var(--r) var(--r) 0; }
.wpoint h3 { font-size: 1.3rem; margin-bottom: .25em; }
.wpoint p { margin: 0; color: var(--ink-soft); }

/* Label flip, pinned */
.flip { background: var(--forest); color: var(--on-dark); position: relative; }
.flip__pin { min-height: 100svh; display: flex; align-items: center; padding: calc(var(--hdr) - 8px) 0 36px; overflow: clip; position: relative; }
.flip__pin::before { content: ''; position: absolute; width: 60vw; height: 60vw; right: -24vw; bottom: -30vw; background: radial-gradient(closest-side, rgba(94, 143, 138, .25), transparent 70%); animation: drift 16s ease-in-out infinite alternate; pointer-events: none; }
.flip .wrap { position: relative; }
.sec-head--dark h2 em { color: var(--wheat); }
.sec-head--dark .lede { color: var(--on-dark-soft); }
.flip__labels { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(18px, 3vw, 44px); }
.tag { background: var(--oat); color: var(--ink); border-radius: var(--r); padding: clamp(18px, 2vw, 28px); box-shadow: 0 24px 50px rgba(0, 0, 0, .25); transform-style: preserve-3d; }
.tag__name { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: clamp(1.6rem, 2.2vw, 2.2rem); margin: 0; }
.tag__mode { font-size: .92rem; font-weight: 700; color: var(--brass-deep); margin: 0 0 12px; }
.tag__rows { margin: 0 0 14px; }
.tag__rows div { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 0; border-bottom: 1px dashed #C9CFC2; }
.tag__rows dt { color: var(--ink-soft); }
.tag__rows dd { margin: 0; font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: clamp(1.5rem, 2.2vw, 2.1rem); font-variant-numeric: tabular-nums; }
.tag__protein dd { color: var(--forest); }
.tag__bar { height: 12px; border-radius: 6px; background: var(--sage); position: relative; overflow: hidden; display: flex; }
.tag__bar i { display: block; height: 100%; }
.tag__p { background: var(--brass); }
.tag__w { background: var(--water); margin-left: auto; }
.flip__verdict { margin: 24px 0 0; font-size: 1.1rem; padding: 14px 18px; border-left: 2px solid var(--wheat); background: rgba(18, 36, 27, .35); border-radius: 0 var(--r) var(--r) 0; }
.flip__verdict strong { color: var(--wheat); }

/* Label decoder */
.decode { background: var(--sage) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Cpath d='M32 0H0V32' fill='none' stroke='%231F3B2D' stroke-opacity='.07'/%3E%3C/svg%3E") 0 0 / 32px 32px; padding: var(--sec) 0; overflow: clip; }
.decode__grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(32px, 5vw, 80px); align-items: center; }
.decode__label { background: var(--white); border: 2px solid var(--ink); border-radius: var(--r); padding: 18px 20px; margin-top: 8px; }
.decode__title { font-weight: 700; margin: 0 0 6px; padding-bottom: 8px; border-bottom: 2px solid var(--ink); }
.decode__line { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 10px; margin: 0 -10px; background: none; border: 0; border-radius: calc(var(--r) - 4px); cursor: pointer; text-align: left; font-weight: 600; color: var(--ink); transition: background .3s; width: calc(100% + 20px); }
.decode__line:hover { background: var(--oat); }
.decode__line.is-active { background: var(--forest); color: var(--on-dark); }
.decode__dots { flex: 1; border-bottom: 2px dotted currentColor; opacity: .35; transform: translateY(4px); }
.decode__line > span:last-child { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1px solid currentColor; font-size: .9rem; }
.decode__panels { position: relative; background: var(--forest); color: var(--on-dark); border-radius: var(--r); padding: clamp(24px, 3vw, 44px); min-height: 380px; overflow: hidden; display: grid; }
.decode__panel { grid-area: 1 / 1; align-self: end; }
.decode__panel[hidden] { display: none; }
.decode__big { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; font-size: clamp(3.4rem, 6vw, 5.6rem); line-height: 1; color: rgba(217, 198, 143, .22); margin: 0 0 24px; }
.decode__panel h3 { color: var(--wheat); }
.decode__panel p:last-child { color: var(--on-dark-soft); font-size: 1.1rem; margin: 0; }
.decode__ring { position: absolute; right: 30px; top: 30px; width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--wheat); }
.decode__ring::after { content: ''; position: absolute; inset: -14px; border-radius: 50%; border: 1px solid rgba(217, 198, 143, .8); animation: ringPulse 2.6s var(--ease) infinite; }

/* Limits */
.limits { background: var(--white); padding: var(--sec) 0; overflow: clip; }
.limits__grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(32px, 5vw, 88px); align-items: center; }
.limits__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.limits__list li { padding: 12px 16px 12px 46px; position: relative; background: var(--oat); border-radius: var(--r); color: var(--ink-soft); }
.limits__list li::before, .limits__list li::after { content: ''; position: absolute; left: 17px; top: 50%; width: 14px; height: 2px; background: var(--brass-deep); transform: rotate(45deg); }
.limits__list li::after { transform: rotate(-45deg); }
.limits__photo { margin: 0; }
.limits__photo [data-par] { aspect-ratio: 4 / 5; max-height: min(66vh, 600px); }

/* Next */
.calc-next { background: var(--wheat); padding: var(--sec) 0; overflow: clip; position: relative; }
.calc-next::before { content: ''; position: absolute; width: 50vw; height: 50vw; right: -15vw; top: -25vw; background: radial-gradient(closest-side, rgba(255, 255, 255, .6), transparent 70%); animation: drift 9s ease-in-out infinite alternate; }
.calc-next__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(32px, 5vw, 80px); align-items: center; position: relative; }
.calc-next .lede { color: #3D3A26; }
.calc-next .next-link { background: rgba(255, 255, 255, .6); }
.calc-next .next-link:hover { background: var(--white); }

@media (max-width: 1100px) { .dmbf__grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 900px) {
  .calc-open__grid, .why__grid, .decode__grid, .limits__grid, .calc-next__grid { grid-template-columns: 1fr; }
  .flip__labels { grid-template-columns: 1fr; gap: 14px; }
  .flip__pin { min-height: 0; padding: var(--sec) 0; }
  .decode__panels { min-height: 300px; }
}
@media (max-width: 600px) {
  .dmbf__moist { grid-template-columns: 1fr; }
  .res__body { grid-template-columns: 1fr; gap: 14px; }
  .res__tube { height: 150px; border-top: 1px solid rgba(242, 237, 226, .35); border-radius: var(--r); }
  .res__table th, .res__table td { padding: 8px 4px; }
  .res__table td[data-dmb] { font-size: 1.2rem; }
  .tag__rows div { padding: 6px 0; }
}

/* short screens (1280x720): the form's buttons stay on the first screen */
@media (min-width: 901px) and (max-height: 760px) {
  .calc-open h1 { font-size: 2.1rem; }
  .calc-open__lede { margin-bottom: .5em; font-size: 1rem; }
  .dmbf { padding: 14px 18px; }
  .dmbf__example { display: none; }
  .dmbf__moist { padding-bottom: 8px; margin-bottom: 8px; }
  .dmbf__grid { margin-bottom: 12px; }
}
