gram/packages/renderer/gram.css
abiwab e29a5a638b
All checks were successful
CI / Build, Test & Publish (pull_request) Successful in 3m16s
feat(renderer): write when each step happens in a recipe on the calendar, and the sheet after it
2026-10-04 17:46:26 +02:00

1375 lines
32 KiB
CSS

:root {
--gram-font-sans: system-ui, -apple-system, sans-serif;
--gram-font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
/* Semantic Colors - Base (Light Mode defaults) */
--item-ingredient-text: #7c3aed;
/* Purple */
--item-cookware-text: #2563eb;
/* Blue */
--item-timer-text: #d97706;
/* Yellow/Orange */
--item-temp-text: #dc2626;
/* Red */
--item-ref-text: #059669;
/* Green (Intermediates) */
--item-decl-text: #059669;
/* Green (Declarations) */
--item-qty-text: var(--color-text-strong);
/* Grays */
--gray-0: oklch(100% 0 0);
--gray-25: oklch(98.5% 0 0);
--gray-50: oklch(97% 0 0);
--gray-100: oklch(93% 0 0);
--gray-200: oklch(88% 0 0);
--gray-300: oklch(80% 0 0);
--gray-400: oklch(70% 0 0);
--gray-500: oklch(58% 0 0);
--gray-600: oklch(46% 0 0);
--gray-700: oklch(35% 0 0);
--gray-800: oklch(25% 0 0);
--gray-900: oklch(15% 0 0);
--gray-950: oklch(10% 0 0);
--gray-1000: oklch(0% 0 0);
--bg-dark-anchor: var(--vp-c-bg, #1a1a1a);
--color-bg: var(--gray-0);
--color-bg-subtle: var(--gray-25);
--color-bg-muted: var(--gray-100);
--color-surface: var(--gray-25);
--color-surface-raised: var(--gray-0);
--color-border: var(--gray-200);
--color-border-strong: var(--gray-300);
--color-text-muted: var(--gray-500);
--color-text: var(--gray-700);
--color-text-strong: var(--gray-900);
}
.dark,
body.vscode-dark,
:root[class~="dark"],
:root[data-theme="dark"] {
--item-ingredient-text: #c68aff;
--item-cookware-text: #60a5fa;
--item-timer-text: #fbbf24;
--item-temp-text: #f87171;
--item-ref-text: #34d399;
--item-decl-text: #34d399;
--item-qty-text: var(--color-text-strong);
--color-bg: var(--bg-dark-anchor);
--color-bg-subtle: oklch(from var(--bg-dark-anchor) calc(l - 0.03) c h);
--color-bg-muted: oklch(from var(--bg-dark-anchor) calc(l + 0.02) c h);
--color-surface: oklch(from var(--bg-dark-anchor) calc(l + 0.035) c h);
--color-surface-raised: oklch(from var(--bg-dark-anchor) calc(l + 0.06) c h);
--color-border: oklch(from var(--bg-dark-anchor) calc(l + 0.14) c h);
--color-border-strong: oklch(from var(--bg-dark-anchor) calc(l + 0.22) c h);
--color-text-muted: oklch(from var(--bg-dark-anchor) calc(l + 0.42) c h);
--color-text: oklch(from var(--bg-dark-anchor) calc(l + 0.60) c h);
--color-text-strong: oklch(100% 0 0);
}
.gram-preview details.shopping-list,
.gram-preview details.cookware,
.gram-preview details.section-ingredients,
.gram-preview details.recipe-meta-secondary,
.section-ingredients,
.gram-preview div.cookware {
background-color: red;
}
/* Base styles for GRAM HTML output */
.gram-preview {
font-family: var(--gram-font-sans);
line-height: 1.6;
color: var(--vscode-editor-foreground, inherit);
font-size: 15px;
}
.gram-preview svg.gicon,
.gram-preview .gicon,
svg.gicon {
display: inline-block;
vertical-align: -0.125em;
width: 1em;
height: 1em;
}
.gram-preview h1 {
font-size: 2rem;
font-weight: 700;
margin-bottom: 24px;
border-bottom: 2px solid var(--color-border);
padding-bottom: 16px;
}
.gram-preview h2,
.gram-preview h3,
.gram-preview h4 {
color: var(--vscode-editor-foreground, inherit);
}
.gram-preview h3 {
font-size: 1.25rem;
margin-top: 2rem;
margin-bottom: 1rem;
font-weight: 600;
}
.gram-preview h4 {
display: none;
}
/* Metadata & Sections (Time info) */
/* Recipe Timings Grid (Cards) */
.gram-preview .recipe-timings-grid {
display: flex;
flex-wrap: wrap;
gap: 16px;
margin-bottom: 10px;
}
.gram-preview .timing-card {
display: flex;
flex-direction: column;
align-items: flex-start;
padding: 10px 14px;
border-radius: 8px;
min-width: 120px;
border: 1px solid var(--color-border);
flex-grow: 1;
}
.gram-preview .timing-card .meta-label {
color: var(--color-text-muted);
text-transform: uppercase;
font-size: 0.75em;
font-weight: 700;
display: flex;
align-items: center;
gap: 6px;
}
.gram-preview .timing-card .meta-label i {
font-size: 1.2em;
}
.gram-preview .timing-card .meta-value {
font-weight: 600;
font-size: 0.9em;
font-family: var(--gram-font-mono);
}
/* Secondary Metadata (Frontmatter) */
.gram-preview .metadata-grid {
display: flex;
flex-direction: column;
/* Requested: write them one below the other */
gap: 5px;
margin-bottom: 10px;
padding-block: 20px;
border-block: 1px dashed var(--color-border);
}
.gram-preview .meta-secondary-item {
display: flex;
align-items: baseline;
gap: 12px;
font-size: 0.9em;
}
.gram-preview .meta-secondary-item .label {
color: var(--color-text-muted);
text-transform: uppercase;
font-size: 0.85em;
font-weight: 600;
width: 140px;
/* Align values */
flex-shrink: 0;
}
.gram-preview .meta-secondary-item .value {
font-weight: 500;
font-family: var(--gram-font-mono);
}
/* Accordions */
.gram-preview details {
margin-bottom: 16px;
}
.gram-preview details>summary {
cursor: pointer;
list-style: none;
user-select: none;
margin: 0;
display: flex;
justify-content: space-between;
align-items: center;
}
.gram-preview details>summary::-webkit-details-marker {
display: none;
}
.gram-preview details>summary>h2 {
display: inline-flex;
align-items: center;
margin: 0;
border: none;
padding: 0;
font-size: 1rem;
}
.gram-preview details>summary::after {
content: "";
display: inline-block;
width: 1.2em;
height: 1.2em;
margin-left: 8px;
background-color: var(--color-text-muted);
-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z'/%3E%3C/svg%3E") no-repeat center / contain;
mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M11.9999 10.8284L7.0502 15.7782L5.63599 14.364L11.9999 8L18.3639 14.364L16.9497 15.7782L11.9999 10.8284Z'/%3E%3C/svg%3E") no-repeat center / contain;
transition: transform 0.2s ease;
transform: rotate(180deg);
}
.gram-preview details[open]>summary::after {
transform: rotate(0deg);
}
.gram-preview details>summary+ul {
margin-top: 10px !important;
}
/* Callouts for Shopping List & Ingredients */
.gram-preview details.shopping-list,
.gram-preview details.cookware,
.gram-preview details.section-ingredients,
.section-ingredients,
.gram-preview div.cookware {
background-color: var(--color-surface);
border: 1px solid var(--color-border);
border-radius: 8px;
padding: 13px 20px;
margin: 10px 0 10px 0;
}
.gram-preview details.section-ingredients,
.section-ingredients {
margin: 16px 0 24px 0;
}
.gram-preview .section-ingredients h4,
.gram-preview div.cookware h2 {
margin: 0 0 12px 0;
font-size: 1.1em;
font-weight: 600;
border-bottom: 1px solid var(--color-border);
padding-bottom: 8px;
color: var(--color-text-strong);
border-top: none;
padding-top: 0;
}
.gram-preview .shopping-list ul,
.gram-preview .section-ingredients ul,
.gram-preview .cookware ul {
margin: 0;
padding: 0;
list-style: none;
/* No bullets */
}
.gram-preview .section-ingredients ul {
margin-top: 0 !important;
}
.gram-preview .shopping-list ul li,
.gram-preview .section-ingredients ul li,
.gram-preview details.cookware ul li {
display: flex;
justify-content: space-between;
align-items: baseline;
padding: 3px 0;
margin: 0;
border-bottom: 1px dashed var(--color-border);
/* Dashed lines between ingredients */
}
.gram-preview .shopping-list ul li:first-child,
.gram-preview .section-ingredients ul li:first-child,
.gram-preview details.cookware ul li:first-child {
border-top: none;
padding-top: 0;
}
.gram-preview .shopping-list ul li:last-child,
.gram-preview .section-ingredients ul li:last-child,
.gram-preview details.cookware ul li:last-child {
border-bottom: none;
padding-bottom: 0;
}
/* A composite/mixed-units shopping-list or cookware entry wraps a nested
<ul> of its own — the flex row layout above (meant for a single
name+quantity leaf item) squishes that sub-list onto the same line as the
label instead of letting it flow underneath. Switch back to block layout
for these wrapper items only; their own nested <li> children still match
the flex rule above and lay out normally. */
.gram-preview .shopping-list ul li.list-item-group,
.gram-preview .section-ingredients ul li.list-item-group,
.gram-preview details.cookware ul li.list-item-group {
display: block;
}
.gram-preview .shopping-list ul li.list-item-group>ul,
.gram-preview .section-ingredients ul li.list-item-group>ul,
.gram-preview details.cookware ul li.list-item-group>ul {
margin-top: 6px;
padding-left: 16px;
}
/* Steps */
.gram-preview .steps {
list-style: none;
counter-reset: gram-step;
padding-left: 0;
margin-top: 16px;
}
.gram-preview .steps li {
position: relative;
counter-increment: gram-step;
padding-left: 36px;
margin-bottom: 16px;
line-height: 1.6;
}
/* Standalone comment */
.gram-preview .steps li.step-comment {
counter-increment: none;
/* Do not count as a step */
list-style: none !important;
display: flex;
align-items: flex-start;
gap: 8px;
margin: 12px 0 16px 0;
/* Align with step text, skipping the number column */
padding: 6px 10px;
border-radius: 6px;
color: var(--color-text);
font-size: 0.9em;
border: 1px solid var(--color-border);
}
.gram-preview .steps li::before {
content: counter(gram-step);
position: absolute;
left: 0;
top: 2px;
width: 24px;
height: 24px;
background-color: var(--color-bg-muted);
/* Discreet colored circle */
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.8em;
font-weight: 600;
color: var(--color-text);
}
/* Standalone Comments */
.gram-preview .step-comment::before {
display: none !important;
}
.gram-preview .step-comment .comment-icon {
font-size: 1.2em;
color: var(--gray-500);
height: 22px;
}
/* Footnote References */
.gram-preview .footnote-ref {
font-size: 0.75em;
line-height: 0;
vertical-align: super;
margin-left: 2px;
}
.gram-preview .footnote-ref a {
color: var(--color-text-muted);
text-decoration: none;
font-weight: 600;
transition: color 0.2s ease;
}
.gram-preview .footnote-ref a:hover {
color: var(--color-text-strong);
text-decoration: underline;
}
/* Recipe Notes Section */
.gram-preview .recipe-notes {
margin-top: 32px;
padding-top: 16px;
border-top: 1px solid var(--color-border);
}
.gram-preview .recipe-notes h3 {
font-size: 1.1em;
font-weight: 600;
margin-top: 0;
margin-bottom: 12px;
color: var(--color-text-strong);
}
.gram-preview .recipe-notes ol {
padding-left: 20px;
margin: 0;
color: var(--color-text-muted);
font-size: 0.9em;
line-height: 1.6;
}
.gram-preview .recipe-notes li {
margin-bottom: 8px;
padding: 0px 8px;
border-radius: 6px;
transition: background-color 0.3s ease;
}
.gram-preview .note-return {
text-decoration: none;
color: var(--color-text-muted);
margin-left: 6px;
font-size: 1.1em;
transition: color 0.2s ease;
}
.gram-preview .note-return:hover {
color: var(--color-text-strong);
}
/* Target Highlighting */
.gram-preview .target-highlight {
animation: targetFlash 2s ease-out;
}
@keyframes targetFlash {
0% {
background-color: var(--color-bg-muted, rgba(200, 200, 200, 0.3));
}
100% {
background-color: transparent;
}
}
/* Step Action */
.gram-preview .action {
font-weight: 700;
text-transform: uppercase;
font-size: 0.8em;
margin-right: 6px;
padding: 2px 5px;
border-radius: 4px;
border: 1px solid var(--color-border);
}
/* Semantic Elements */
.gram-preview .ingredient {
font-weight: 600;
color: var(--item-ingredient-text);
}
.gram-preview .ingredient-alt-badge {
color: var(--color-text-muted);
font-size: 0.85em;
cursor: help;
text-decoration: underline dotted;
text-underline-offset: 2px;
}
.gram-preview span.cookware {
font-weight: 600;
color: var(--item-cookware-text);
}
.gram-preview .reference,
.gram-preview .declaration {
font-weight: 600;
color: var(--item-ref-text);
}
.gram-preview .declaration {
font-size: 0.9rem;
}
.gram-preview .timer,
.gram-preview .temp {
font-family: var(--gram-font-mono);
font-weight: 600;
font-size: 0.9em;
display: inline-flex;
align-items: center;
gap: 2px;
margin: 0 2px;
}
.gram-preview .timer {
color: var(--item-timer-text);
}
.gram-preview .temp {
color: var(--item-temp-text);
font-weight: 600;
}
/* Quantities and Masses */
.gram-preview .quantity {
font-family: var(--gram-font-mono);
font-size: 0.85em;
flex-shrink: 0;
color: var(--color-text-strong);
font-weight: 600;
padding: 2px 8px;
border-radius: 20px;
border: 1px solid var(--color-border);
}
.gram-preview .mass-badge {
font-family: var(--gram-font-mono);
font-size: 0.85em;
color: var(--color-text-muted);
font-weight: 500;
/* Discreet/Grayed calculated mass */
vertical-align: baseline;
cursor: help;
background-color: var(--color-bg-subtle);
border: 1px solid var(--color-border);
padding: 2px 6px;
border-radius: 4px;
}
.gram-preview .bakers-badge {
font-family: var(--gram-font-mono);
font-size: 0.85em;
color: var(--color-text);
vertical-align: baseline;
cursor: help;
background-color: var(--color-bg-subtle);
border: 1px dashed var(--color-text-muted);
padding: 2px 6px;
border-radius: 4px;
}
.hide-mass-badges .mass-badge {
display: none !important;
}
.gram-preview .gross-mass {
color: var(--color-text-muted);
font-size: 0.85em;
margin-left: 2px;
}
.gram-preview .unit {
color: var(--color-text-muted);
font-size: 0.9em;
margin-left: 2px;
}
/* Prep and modifiers */
.gram-preview .prep {
color: var(--color-text-muted);
/* Dark gray */
font-size: 0.95em;
font-style: italic;
}
.gram-preview .composite-parent {
color: var(--color-text-muted);
font-size: 0.95em;
font-style: italic;
}
.gram-preview .optional {
font-style: italic;
color: var(--color-text-muted);
font-size: 0.85em;
margin-left: 0.25em;
}
/* Nutrition Panel */
.gram-preview .nutrition-panel {
display: none;
margin-top: 32px;
padding-top: 16px;
background-color: var(--color-bg-subtle);
padding: 20px;
border-radius: 12px;
border: 1px solid var(--color-border);
}
.show-macros .nutrition-panel {
display: block;
}
.gram-preview .nut-header {
font-size: 1.1em;
font-weight: 600;
margin-bottom: 16px;
display: flex;
align-items: center;
gap: 8px;
}
.gram-preview .est-badge {
font-size: 0.6em;
text-transform: uppercase;
background-color: var(--color-bg-muted);
padding: 2px 6px;
border-radius: 4px;
font-weight: 700;
}
.gram-preview .nut-grid {
display: grid;
gap: 12px;
grid-template-columns: repeat(2, 1fr);
/* Rows size to their content. This used to be `1fr 1fr`, which was harmless
while every card was one line tall — but once a card can hold sub-macros,
it forced every row to the height of the tallest card in the panel. */
grid-auto-rows: min-content;
}
@media (min-width: 480px) {
.gram-preview .nut-grid {
grid-template-columns: repeat(3, 1fr);
}
}
@media (min-width: 768px) {
.gram-preview .nut-grid {
grid-template-columns: repeat(4, 1fr);
}
}
.gram-preview .nut-warnings {
color: var(--vscode-errorForeground, #f87171);
font-size: 0.85em;
margin-bottom: 10px;
padding: 10px;
background-color: color-mix(in srgb, var(--vscode-errorForeground, #f87171) 10%, transparent);
border-radius: 6px;
}
.gram-preview .nut-warnings p {
margin: 0;
padding: 0;
}
.gram-preview .nut-item {
display: flex;
flex-direction: column;
gap: 2px;
background-color: var(--color-bg);
padding: 12px 14px;
border-radius: 12px;
border: 1px solid var(--color-bg-muted);
}
.gram-preview .nut-item .label {
font-size: 0.65em;
text-transform: uppercase;
font-variant: small-caps;
color: var(--color-text);
font-weight: 600;
}
.gram-preview .nut-item strong {
font-size: 1.1em;
font-family: var(--gram-font-mono);
}
.gram-preview .nut-item-sugar {
font-size: 0.6em;
color: var(--color-text-muted);
display: block;
}
.gram-preview .nut-item small {
font-size: 0.8em;
color: var(--color-text-muted);
}
/* Nutrition basis switch — pure CSS, no JS: the radios sit before the grids
and reveal the matching one as a later sibling. This HTML is also written
to a standalone file by `gram export`, where no script would ever run. */
.gram-preview .nut-basis-radio {
position: absolute;
opacity: 0;
pointer-events: none;
}
.gram-preview .nut-basis-switch {
display: inline-flex;
gap: 2px;
margin-bottom: 14px;
padding: 2px;
border-radius: 999px;
background-color: var(--color-bg-muted);
}
.gram-preview .nut-basis-switch label {
font-size: 0.7em;
font-weight: 600;
padding: 5px 12px;
border-radius: 999px;
cursor: pointer;
color: var(--color-text-muted);
white-space: nowrap;
}
.gram-preview .nut-basis-switch label:hover {
color: var(--color-text);
}
.gram-preview .nut-basis-single {
font-size: 0.7em;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--color-text-muted);
margin-bottom: 14px;
}
.gram-preview .nut-basis-note {
grid-column: 1 / -1;
margin: 0;
font-size: 0.7em;
color: var(--color-text-muted);
}
/* Sub-macros sit inside their parent's card rather than in cards of their own:
"of which saturates" in a cell the same size as Protein reads as a nutrient
in its own right instead of a part of the fat beside it. */
.gram-preview .nut-item-children {
list-style: none;
margin: 8px 0 0 0;
padding: 6px 0 0 0;
border-top: 1px solid var(--color-bg-muted);
display: flex;
flex-direction: column;
gap: 2px;
}
.gram-preview .nut-item-children li {
display: flex;
flex-direction: column;
font-size: 0.72em;
color: var(--color-text-muted);
}
.gram-preview .nut-item-children .label {
font-size: 1em;
text-transform: none;
font-variant: normal;
font-weight: 400;
color: inherit;
}
.gram-preview .nut-item-children .value {
font-family: var(--gram-font-mono);
white-space: nowrap;
font-weight:bold;
color: var(--color-text);
}
/* Only the checked basis is shown. Keyed off `data-basis` on both sides so
adding a basis needs no new rule beyond one pairing. */
.gram-preview .nut-basis-radio ~ .nut-grid {
display: none;
}
.gram-preview .nut-basis-radio[data-basis="perPortion"]:checked ~ .nut-grid[data-basis="perPortion"],
.gram-preview .nut-basis-radio[data-basis="per100g"]:checked ~ .nut-grid[data-basis="per100g"],
.gram-preview .nut-basis-radio[data-basis="total"]:checked ~ .nut-grid[data-basis="total"] {
display: grid;
}
/* Fallback when no radio in this panel is checked. Two panels rendered on one
page without distinct `renderId`s share a radio group, so the browser keeps
only the last `checked` one and the other panel would hide every grid and
show nothing at all. The default basis is tagged in the markup rather than
picked positionally — `:first-of-type` matches the first element of that
*tag*, which is the header, not the first grid. */
.gram-preview
.nutrition-panel:not(:has(.nut-basis-radio:checked))
.nut-grid[data-default] {
display: grid;
}
.gram-preview .nut-basis-radio[data-basis="perPortion"]:checked ~ .nut-basis-switch label[for$="-perPortion"],
.gram-preview .nut-basis-radio[data-basis="per100g"]:checked ~ .nut-basis-switch label[for$="-per100g"],
.gram-preview .nut-basis-radio[data-basis="total"]:checked ~ .nut-basis-switch label[for$="-total"] {
background-color: var(--color-bg);
color: var(--color-text);
}
.gram-preview .nut-basis-radio:focus-visible ~ .nut-basis-switch {
outline: 2px solid var(--color-text-muted);
outline-offset: 2px;
}
/* Tooltips */
.gram-preview [data-tooltip] {
position: relative;
cursor: help;
}
.gram-preview [data-tooltip]:not(.timer):not(.formula-qty):not(.mass-badge):not(.bakers-badge):not(.timing-card):not(.gross-mass):not(.section-meta-badge):not(.section-declaration-badge):not(.est-badge) {
text-decoration: underline dotted;
text-underline-offset: 3px;
text-decoration-thickness: 1px;
}
.gram-preview .timer {
text-decoration: none !important;
}
.gram-preview .timer .timer-text {
text-decoration: underline dotted;
text-underline-offset: 3px;
text-decoration-thickness: 1px;
}
/* Pseudo elements setup */
.gram-preview [data-tooltip]::before,
.gram-preview [data-tooltip]::after {
position: absolute;
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
z-index: 100;
pointer-events: none;
}
/* Tooltip Body */
.gram-preview [data-tooltip]::after {
content: attr(data-tooltip);
bottom: 100%;
left: 50%;
transform: translateX(-50%) translateY(-2px);
background: var(--color-surface-raised);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid var(--color-border);
color: var(--color-text-strong);
padding: 6px 12px;
border-radius: 6px;
font-size: 13px;
font-weight: 500;
font-family: var(--gram-font-sans);
white-space: pre-wrap;
width: max-content;
max-width: 220px;
text-align: center;
line-height: 1.4;
box-shadow: 0 4px 12px color-mix(in srgb, var(--gray-1000) 15%, transparent);
}
/* Tooltip Arrow */
.gram-preview [data-tooltip]::before {
content: '';
bottom: 100%;
left: 50%;
transform: translateX(-50%) translateY(2px);
border: 5px solid transparent;
border-top-color: var(--color-surface-raised);
}
/* Hover State */
.gram-preview [data-tooltip]:hover::before,
.gram-preview [data-tooltip]:hover::after {
opacity: 1;
visibility: visible;
}
.gram-preview [data-tooltip]:hover::after {
transform: translateX(-50%) translateY(-8px);
}
.gram-preview [data-tooltip]:hover::before {
transform: translateX(-50%) translateY(-3px);
}
/* Timing Tooltips (HTML Content) */
.gram-preview .timing-card {
position: relative;
}
.gram-preview .timing-tooltip {
position: absolute;
top: 100%;
left: 50%;
transform: translateX(-50%) translateY(2px);
background: var(--color-surface-raised);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
border: 1px solid var(--color-border);
color: var(--color-text-strong);
padding: 10px 14px;
border-radius: 8px;
font-size: 13px;
font-weight: 500;
font-family: var(--gram-font-sans);
width: max-content;
max-width: 300px;
box-shadow: 0 4px 12px color-mix(in srgb, var(--gray-1000) 15%, transparent);
opacity: 0;
visibility: hidden;
transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
z-index: 100;
pointer-events: none;
display: flex;
flex-direction: column;
gap: 6px;
}
.gram-preview .timing-card:hover .timing-tooltip {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(8px);
}
/* Smart Edge Alignment: Leftmost card */
.gram-preview .timing-card:first-child .timing-tooltip {
left: 0;
transform: translateY(2px);
}
.gram-preview .timing-card:first-child:hover .timing-tooltip {
transform: translateY(8px);
}
.gram-preview .timing-card:first-child .timing-tooltip::before {
left: 24px;
transform: none;
}
/* Smart Edge Alignment: Rightmost card */
.gram-preview .timing-card:last-child .timing-tooltip {
left: auto;
right: 0;
transform: translateY(2px);
}
.gram-preview .timing-card:last-child:hover .timing-tooltip {
transform: translateY(8px);
}
.gram-preview .timing-card:last-child .timing-tooltip::before {
left: auto;
right: 24px;
transform: none;
}
.gram-preview .timing-tooltip::before {
content: '';
position: absolute;
bottom: 100%;
left: 50%;
transform: translateX(-50%);
border: 6px solid transparent;
border-bottom-color: var(--color-surface-raised);
}
.gram-preview .timing-tooltip-title {
font-weight: 700;
color: var(--color-text);
margin-bottom: 2px;
text-align: center;
}
.gram-preview .timing-divider {
height: 1px;
background-color: var(--color-border);
margin: 2px 0;
}
.gram-preview .timing-row {
display: flex;
justify-content: space-between;
align-items: baseline;
gap: 16px;
}
.gram-preview .timing-label {
text-align: left;
}
.gram-preview .timing-detail-type {
color: var(--color-text-muted);
font-size: 0.9em;
font-style: italic;
font-weight: 400;
}
.gram-preview .timing-val {
text-align: right;
font-family: var(--gram-font-mono);
font-weight: 600;
color: var(--color-text-strong);
}
/* Declarations */
.gram-preview .declaration-block {
display: block;
margin-top: 8px;
font-size: 0.85em;
font-weight: 600;
color: var(--item-decl-text);
width: fit-content;
border-top: 1px dashed var(--color-border);
padding-top: 4px;
}
.gram-preview .section-header {
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 8px;
}
.gram-preview .formula-qty {
color: var(--color-text-muted);
border: 1px dashed var(--color-border);
}
.gram-preview .section-meta-retroplanning {
font-size: 0.6em;
color: var(--item-timer-text);
border: 1px solid var(--item-timer-text);
border-radius: 4px;
padding: 2px 6px;
line-height: 1.5;
font-weight: 500;
}
.gram-preview .section-meta-mass {
font-size: 0.6em;
color: var(--color-text-muted);
border: 1px solid var(--color-border);
border-radius: 4px;
padding: 2px 6px;
line-height: 1.5;
font-weight: 500;
}
.gram-preview .section-prep {
margin: 0 0 8px;
font-size: 0.9em;
font-weight: 600;
color: var(--color-text-muted);
}
/* As the caption of a section's ingredient list: a label sitting on the box's top border. */
.gram-preview .section-ingredients {
position: relative;
}
.gram-preview .section-ingredients:has(> .section-prep) {
padding-top: 25px;
margin-top: 20px;
}
.gram-preview .section-prep [data-tooltip] {
text-decoration: none !important;
}
.gram-preview .section-ingredients > .section-prep {
position: absolute;
top: 0;
left: 16px;
transform: translateY(-50%);
margin: 0;
padding: 2px 8px;
font-size: 0.85em;
line-height: 1.6;
white-space: nowrap;
color: var(--color-text-muted);
background: var(--color-bg);
}
/* The label hugs the box's left edge: anchor its tooltip there instead of centring it, or the start is cut off. */
.gram-preview .section-prep[data-tooltip]::after,
.gram-preview .section-prep [data-tooltip]::after {
left: 0;
transform: translateY(-2px);
text-align: left;
}
.gram-preview .section-prep[data-tooltip]:hover::after,
.gram-preview .section-prep [data-tooltip]:hover::after {
transform: translateY(-8px);
}
.gram-preview .section-prep[data-tooltip]::before,
.gram-preview .section-prep [data-tooltip]::before {
left: 12px;
transform: translateY(2px);
}
.gram-preview .section-prep[data-tooltip]:hover::before,
.gram-preview .section-prep [data-tooltip]:hover::before {
transform: translateY(-3px);
}
.gram-preview .section-meta-module {
font-size: 0.6em;
color: var(--color-text-muted);
background: var(--color-bg-muted);
border: 1px solid var(--color-border);
border-radius: 4px;
padding: 2px 6px;
line-height: 1.5;
font-weight: 500;
display: inline-flex;
align-items: center;
gap: 4px;
margin-left: auto;
}
.gram-preview .section-declaration-badge {
font-size: 0.65em;
font-weight: 700;
color: var(--item-decl-text);
border: 1px solid var(--item-decl-text);
padding: 2px 8px;
border-radius: 4px;
margin-left: auto;
line-height: 1.5;
display: inline-flex;
align-items: center;
gap: 4px;
}
.gram-preview .section-declaration-badge.has-module {
padding: 0;
overflow: hidden;
gap: 0;
}
.gram-preview .section-declaration-badge .section-module-source {
background: var(--color-surface);
color: var(--color-text-muted);
font-weight: 500;
padding: 2px 8px;
border-right: 1px solid var(--color-border);
display: inline-flex;
align-items: center;
gap: 4px;
}
.gram-preview .section-declaration-badge .section-decl-target {
padding: 2px 8px;
display: inline-flex;
align-items: center;
gap: 4px;
color: var(--item-decl-text);
}
/* Anchor tooltip to the right so it doesn't overflow */
.gram-preview .section-declaration-badge[data-tooltip]::after,
.gram-preview .section-meta-module[data-tooltip]::after {
left: auto;
right: 0;
transform: translateY(-2px);
}
.gram-preview .section-declaration-badge[data-tooltip]:hover::after,
.gram-preview .section-meta-module[data-tooltip]:hover::after {
transform: translateY(-8px);
}
.gram-preview .section-declaration-badge[data-tooltip]::before,
.gram-preview .section-meta-module[data-tooltip]::before {
left: auto;
right: 16px;
transform: translateY(2px);
}
.gram-preview .section-declaration-badge[data-tooltip]:hover::before,
.gram-preview .section-meta-module[data-tooltip]:hover::before {
transform: translateY(-3px);
}
/* Interactive Scaling */
.gram-preview .interactive-portions {
display: inline-flex;
align-items: center;
gap: 6px;
}
.gram-preview .scale-btn {
background: transparent;
border: 1px solid var(--color-border);
color: var(--color-text-muted);
border-radius: 4px;
cursor: pointer;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 2px;
transition: all 0.2s ease;
}
.gram-preview .scale-btn.minus,
.gram-preview .scale-btn.plus {
width: 20px;
height: 20px;
}
.gram-preview .scale-multipliers {
display: inline-flex;
gap: 4px;
margin-left: 8px;
border-left: 1px solid var(--color-border);
padding-left: 8px;
}
.gram-preview .scale-btn.factor {
padding: 2px 6px;
font-size: 0.85em;
font-weight: 600;
}
.gram-preview .scale-btn:hover {
background-color: var(--color-bg-muted, rgba(200, 200, 200, 0.3));
color: var(--color-text-strong);
}
.gram-preview .scale-input-inline {
width: 4ch;
background: transparent;
border: none;
border-bottom: 1px solid var(--color-text-strong);
color: inherit;
font: inherit;
outline: none;
text-align: center;
padding: 0;
}
/* Hide spin buttons for scale input */
.gram-preview .scale-input-inline::-webkit-outer-spin-button,
.gram-preview .scale-input-inline::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
.gram-preview .scale-input-inline[type=number] {
-moz-appearance: textfield;
}
/* The production sheet (runSheetToHTML). */
.gram-run-sheet .run-sheet-served {
color: var(--color-text-muted);
}
.gram-run-sheet .run-sheet-day h3 {
margin-top: 1.5em;
padding-bottom: 0.25em;
border-bottom: 1px solid var(--color-border);
}
.gram-run-sheet ul {
list-style: none;
padding: 0;
}
.gram-run-sheet .run-sheet-entry {
margin: 0.6em 0;
}
.gram-run-sheet .run-sheet-when {
display: inline-block;
min-width: 9em;
color: var(--color-text-muted);
}
.gram-run-sheet .run-sheet-entry.active .run-sheet-title {
font-weight: 600;
color: var(--color-text-strong);
}
.gram-run-sheet .run-sheet-entry.passive .run-sheet-title {
font-style: italic;
}
.gram-run-sheet .run-sheet-detail,
.gram-run-sheet .run-sheet-note {
margin: 0.1em 0 0 9em;
font-size: 0.9em;
color: var(--color-text);
}
.gram-run-sheet .run-sheet-note {
font-weight: 600;
}
.gram-run-sheet .run-sheet-problems li {
list-style: disc;
margin-left: 1.2em;
}
/* A recipe placed on the calendar (the `projection` option): the plan's summary
at the top, the day between steps, and the time next to each step. */
.plan-summary {
margin: 0 0 1em;
padding: 0.6em 0.9em;
border: 1px solid var(--color-border);
border-radius: 6px;
background: var(--color-bg-muted);
}
.plan-summary .plan-served {
margin: 0;
font-weight: 600;
color: var(--color-text-strong);
}
.plan-summary .plan-problems {
margin: 0.3em 0 0;
padding-left: 1.2em;
}
.steps li.step-day {
list-style: none;
margin: 1.2em 0 0.3em -1.5em;
font-weight: 600;
color: var(--color-text-muted);
}
.step-plan {
margin: 0.3em 0 0;
font-size: 0.9em;
color: var(--color-text-muted);
}
.step-plan .step-note {
color: var(--color-text);
font-weight: 600;
}