/* A CHARACTER'S SHEET (create/CharacterSheet.astro; Maayan's chosen style 6, 2026-11-20): A4 pages one under the other, the
   sheet's own colours and lines (--g-sheet*, --g-ink*), its labels printed, what is written on it in a hand (Patrick Hand,
   /fonts). Each page is drawn at A4's size and scaled to its room (creator-sheet.js: zoom). Its sizes are the page's own
   (--cs-*), its colours the kit's tokens. */
/* its labels at their own size on a phone too: iOS Safari's text autosizing blew a shrunk sheet's small labels up until
   they broke mid-word (Maayan, 2026-11-22, the monster sheet page on his phone: "fonts break not nice") */
.g-csheet { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.g-csheet { --cs-w: 560px; --cs-line: 1.5px; --cs-gap: 14px; display: flex; flex-direction: column; align-items: center; gap: var(--g-6); }
.g-csheet__page { box-sizing: border-box; width: var(--cs-w); min-height: calc(var(--cs-w) * 297 / 210); padding: 26px; overflow-x: clip; background: var(--g-sheet); color: var(--g-ink);
  font-family: var(--g-font-display); box-shadow: 0 6px 24px rgb(0 0 0 / .35); }   /* at least A4, longer when its words need it: never cut (Maayan, 2026-11-25: "make sure sheet content absolutely never gets cut off") */
.g-csheet [contenteditable] { display: block; width: 100%; box-sizing: border-box; outline: none; text-align: center; cursor: text; font: 400 18px/1.15 "Patrick Hand", cursive; color: var(--g-ink); min-height: 1.15em; }
.g-csheet [contenteditable]:focus { background: var(--g-sheet); box-shadow: 0 0 0 var(--cs-line) var(--g-sheet-edge); border-radius: 2px; }
.g-csheet [data-cs-box] { cursor: text; }
.g-csheet--read [data-cs-box], .g-csheet--read [contenteditable] { cursor: inherit; }   /* read only (a maker page's gallery) */
.cs-lab { display: block; font: 600 10px system-ui, sans-serif; color: var(--g-ink-3); text-align: center; }
/* page 1: its picture at the left, the rest beside it, its attacks and coins across */
.g-csheet__page--1 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "side main" "att att" "coins coins"; grid-template-rows: auto auto 1fr; gap: 10px var(--cs-gap); align-content: stretch; }
/* ITS PICTURE A PORTRAIT'S SHAPE, ITS FRAME HUGGING IT (Maayan, 2026-11-26: "our growl image in sheet is too narrow ... make it
   less narrow helps bring things a bit up and align things better"): no empty strip above and below it; its armor and hit
   points straight under it, their foot on the bonuses' foot */
.cs-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; } .cs-side--pic { grid-area: side; } .cs-side--main { grid-area: main; } .cs-side--pic > .cs-pic { flex: none; }   /* two stacks: its picture over its armor and hit points; its name, abilities and bonuses */
/* ITS SHAPE THE SHEET'S ONE FACT (lib/growl/creator.js SHEET_PICTURE, on the root as --cs-pic-ratio): a portrait, a landscape; the form's picture field draws the same shape (creator.css) */
.cs-pic { grid-area: pic; position: relative; min-height: 0; aspect-ratio: var(--cs-pic-ratio); border: var(--cs-line) solid var(--g-sheet-edge); background: var(--g-sheet-2); }
.cs-pic img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.cs-key { position: absolute; z-index: 1; width: 22px; height: 22px; background: linear-gradient(var(--g-sheet), var(--g-sheet)) 0 0 / 10px 10px no-repeat; }
.cs-key svg { width: 100%; height: 100%; display: block; }
.cs-key--tl { top: -1.5px; left: -1.5px; } .cs-key--tr { top: -1.5px; right: -1.5px; scale: -1 1; } .cs-key--bl { bottom: -1.5px; left: -1.5px; scale: 1 -1; } .cs-key--br { bottom: -1.5px; right: -1.5px; scale: -1 -1; }
.cs-head { grid-area: head; display: grid; gap: 10px; }
.cs-name { padding: 6px 12px 8px 30px; border: var(--cs-line) solid var(--g-sheet-edge); background: var(--g-sheet-2); }
.cs-name [contenteditable] { font-size: 24px; text-align: left; }
.cs-sub { position: relative; }
.cs-lvl { position: absolute; left: -2px; top: 50%; translate: 0 -50%; z-index: 1; display: grid; place-items: center; width: 48px; height: 48px; border: var(--cs-line) solid var(--g-sheet-edge); border-radius: 50%; background: var(--g-sheet-2); }
.cs-lvl [contenteditable] { font-size: 24px; }
.cs-xp { display: flex; align-items: center; gap: 14px; margin-left: 14px; padding: 6px 12px 6px 46px; border: var(--cs-line) solid var(--g-sheet-edge); background: var(--g-sheet-2); }
.cs-xp .cs-lab { flex: none; }
.cs-xp [contenteditable] { text-align: left; width: auto; min-width: 4ch; flex: none; }
.cs-next { flex: none; }
.cs-next [contenteditable] { display: inline-block; width: auto; min-width: 3ch; font: inherit; color: inherit; text-align: left; }   /* its max EXP: written on, the same size as it reads */
.cs-tags { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; }
.cs-tag { padding: 3px 10px; border: var(--cs-line) solid var(--g-sheet-edge); background: var(--g-sheet-2); }
.cs-tag .cs-lab, .cs-stat .cs-lab, .cs-sq .cs-lab { font-size: 9px; text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere; }
.cs-stat .cs-lab { font-size: 7.5px; letter-spacing: 0; overflow-wrap: normal; white-space: nowrap; }
.cs-stat { padding-inline: 2px; }
.cs-tag .cs-lab { text-align: left; }
.cs-tag [contenteditable] { text-align: left; font-size: 15px; }
.cs-abil { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 10px; padding-bottom: 12px; }
.cs-stat { position: relative; display: flex; flex-direction: column; align-items: center; margin: 4px; padding: 4px 4px 18px; border: var(--cs-line) solid var(--g-sheet-edge); outline: var(--cs-line) solid var(--g-sheet-edge); outline-offset: 3px; background: var(--g-sheet-2); }
.cs-stat__v[contenteditable] { font-size: 26px; }
.cs-dia { position: absolute; bottom: -19px; left: 50%; translate: -50% 0; display: grid; place-items: center; width: 26px; height: 26px; rotate: 45deg; border: var(--cs-line) solid var(--g-sheet-edge); background: var(--g-sheet); box-sizing: border-box; }
.cs-dia > span { rotate: -45deg; font: 400 13px "Patrick Hand", cursive; }
.cs-life { display: flex; justify-content: center; align-items: flex-start; gap: 18px; }
.cs-shape { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; box-sizing: border-box; height: 114px; padding-top: 24px; }
.cs-shape--ac { width: 98px; } .cs-shape--hp { width: 124px; }
.cs-shape__bg { position: absolute; inset: 0; } .cs-shape__bg svg { width: 100%; height: 100%; display: block; }
.cs-shape > :not(.cs-shape__bg) { position: relative; }
.cs-shape__v[contenteditable] { font-size: 30px; }
.cs-max { display: flex; justify-content: center; gap: 3px; margin-top: 4px; font: 600 13px system-ui, sans-serif; color: var(--g-ink-3); }
.cs-max [contenteditable] { display: inline-block; width: auto; min-width: 2ch; font: 600 13px system-ui, sans-serif; color: var(--g-ink-3); text-align: left; }
.cs-bon { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.cs-sq { display: flex; flex-direction: column; align-items: center; padding: 6px 4px 12px; border: var(--cs-line) solid var(--g-sheet-edge); background: var(--g-sheet-2); }
.cs-sq [contenteditable] { font-size: 26px; }
/* its attacks: a panel with curled corners, written on lines, its name at its foot */
.cs-panel { position: relative; padding: 14px 20px 28px; }
.cs-panel__bg { position: absolute; inset: 0; } .cs-panel__bg svg { width: 100%; height: 100%; display: block; }
.cs-panel > :not(.cs-panel__bg) { position: relative; }
.cs-panel__t { position: absolute !important; bottom: 10px; left: 0; right: 0; text-align: center; font: 600 11px system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: var(--g-ink-3); }
.cs-att { grid-area: att; }
.cs-att__row { display: grid; grid-template-columns: 2.2fr .8fr 1fr .9fr 1fr; gap: 8px; }
.cs-att__row--head > span { font: 600 10px system-ui, sans-serif; color: var(--g-ink-3); text-transform: uppercase; letter-spacing: .04em; }
.cs-att__row [contenteditable] { min-height: 26px; line-height: 26px; border-bottom: var(--cs-line) solid var(--g-sheet-edge); text-align: left; font-size: 17px; }
.cs-coins { grid-area: coins; align-self: start; display: grid; grid-template-columns: 52px repeat(3, 1fr); gap: 8px 12px; align-items: center; padding: 0 6px; }
.cs-pouch svg { width: 46px; height: auto; display: block; }
.cs-coin [contenteditable] { border-bottom: var(--cs-line) solid var(--g-sheet-edge); }
/* page 2, the same hand: its items, magic, abilities and notes, each a double-ruled box written on lines */
.g-csheet__page--2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: 1fr 1fr; gap: 18px var(--cs-gap); }
.cs-box { display: flex; flex-direction: column; margin: 4px; padding: 10px 14px 14px; border: var(--cs-line) solid var(--g-sheet-edge); outline: var(--cs-line) solid var(--g-sheet-edge); outline-offset: 3px; background: var(--g-sheet-2); min-height: 0; }
.cs-box__t { display: block; margin-bottom: 6px; text-align: center; font: 600 10px system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: var(--g-ink-3); }
.cs-ruled[contenteditable] { flex: 1; overflow: hidden; white-space: pre-wrap; text-align: left; font-size: 16px; line-height: 26px; background: repeating-linear-gradient(transparent 0 25px, var(--g-sheet-edge) 25px 26.5px); }
/* an item's, a spell's or a skill's page (card): its picture beside its name and words, its effects and notes across */
.g-csheet__page--card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "pic head" "att att" "notes notes"; grid-template-rows: auto auto 1fr; gap: 14px var(--cs-gap); }
.g-csheet__page--card .cs-head { grid-template-rows: auto auto 1fr; }
.cs-box--grow { min-height: 0; }
.cs-att--4 .cs-att__row { grid-template-columns: 2.2fr 1fr .8fr 1fr; }
.cs-notes { grid-area: notes; }
/* a place's page: its name, its picture wide, its words, what is there and its notes */
.g-csheet__page--place { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) minmax(0, 1.3fr); gap: 14px; }
.cs-name__type { text-align: left; margin-top: 2px; text-transform: uppercase; letter-spacing: .05em; font-size: 9px; }
.g-csheet__page--place > * { grid-area: auto; }   /* one under the other (the character page's areas not its own) */
.cs-pic--wide { min-height: 0; }
.cs-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px var(--cs-gap); min-height: 0; }
/* its bricks under what was written (CharacterSheet.astro): each action or trait a line in the sheet's hand, read only */
/* A NUMBER IN A SHAPE (Maayan, 2026-11-24: "dont exit the element unless there's many numbers"): written on, its box hugs
   the number (a heart, a shield, a stat, the level); only a long one grows, never past its shape */
.g-csheet :is(.cs-shape__v, .cs-stat__v, .cs-lvl [contenteditable], .cs-sq [contenteditable])[contenteditable] { width: fit-content; min-width: 2ch; max-width: 100%; margin-inline: auto; padding-inline: 2px; }
/* AN ATTACK AN ITEM OWNS (sheetAttacks.js): the item's name under it, the growl icon before it; a tap opens the item; put away: faint */
.cs-att__row.is-linked > [data-cs-box]:first-child { display: flex; flex-direction: column; }
.g-csheet .cs-att__of { display: inline-flex; align-items: center; width: fit-content; margin-top: 1px; font: 600 11px system-ui, sans-serif; color: var(--g-sheet-gold); letter-spacing: .02em; cursor: pointer; }
.g-csheet .cs-att__of .g-gmb__t::before { width: 12px; height: 12px; margin-inline-end: 3px; vertical-align: -2px; }
.cs-att__row.is-off { opacity: .45; }
.cs-att__row.is-lit [contenteditable] { background: var(--g-sheet); box-shadow: 0 0 0 1.5px var(--g-sheet-gold); }
/* A SHEET OF PAPER (kit-paper.js; Maayan, 2026-11-25): in a [data-paper] box, drawn at its own size and scaled down whole */
[data-paper] { overflow: hidden; } [data-paper] > .g-csheet { width: max-content; transform-origin: 0 0; }
