/* GROWLMASTER V2: THE SHEET (Maayan, 2026-10-31: "I want growlmaster to look like you can print it out, because you can.
   it's half digital, half real life"; 2026-11-01: "look at dnd sheets, learn about the ux"). v1's A4 sheet
   (public/growlmaster/character-sheet-example.webp) as every sheet the kit draws: hero, foe, NPC, object, item, spell,
   ability, location. The kit's sheet parts (kit.js sheetBox … sheetNote) are the only things drawn on a page; this is
   their look, every value a token. What a D&D sheet is:
     the page     plain sheet paper in a ruled edge, square corners
     a box        a fact: its name small above, its value large in the sheet's serif; two that belong together share
                  one box (hit points now / most); a number worked out from others is gold, and a tap says how
     the top      the picture, and beside it the boxes that matter most in play
     a section    a ruled frame, its name in gold capitals on top: a table, lines, boxes or notes inside, Add at its foot
     a line       a dotted line written on (inventory, magic): no chevrons, no form boxes
     a table      column names once, a dotted line per row (attacks)
     notes        ruled lines to write on */
.g-sheetpage { border-radius: 0; box-shadow: var(--g-shadow); color: var(--g-ink); gap: var(--g-3);
  background: var(--g-sheet); border: var(--g-sheet-border) solid var(--g-sheet-line); }
.g-sheet__body { container-type: inline-size; }
/* EVERY PANE IS ITS OWN SCREEN (Maayan, 2026-11-06: "if a panel is small, it needs to take the same rules as mobile"):
   what is in a pane follows the pane's width, never the window's (tokens.css --g-narrow): a narrow panel beside the
   Table is drawn as a phone draws it. Only the table's panes: anywhere else (a maker page's sheet, the lobby's growl
   window) the page itself is the "pane", so its sheet is as wide as the screen says, as before */
.g-app, .gm2-inside > [data-pane] { container: pane / inline-size; }

/* ---- a box ---- */
.g-boxes { display: grid; grid-template-columns: repeat(var(--g-cols), minmax(0, 1fr)); gap: var(--g-2); }
.g-boxes[data-cols="1"] { --g-cols: 1; } .g-boxes[data-cols="2"] { --g-cols: 2; } .g-boxes[data-cols="3"] { --g-cols: 3; } .g-boxes[data-cols="4"] { --g-cols: 4; } .g-boxes[data-cols="5"] { --g-cols: 5; }
.g-box[data-span="2"] { grid-column: span 2; } .g-box[data-span="3"] { grid-column: span 3; }
.g-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--g-1); min-width: 0;
  padding: var(--g-2) var(--g-3); background: var(--g-sheet-2); border: var(--g-sheet-border) solid var(--g-sheet-edge); text-align: center; color: var(--g-ink); }
.g-box__label { font-size: var(--g-sheet-label); font-weight: var(--g-w-bold); line-height: 1.15; color: var(--g-ink-3); }
.g-box__values { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 0 var(--g-2); max-width: 100%;
  font-family: var(--g-font-display); font-size: var(--g-sheet-value); font-weight: var(--g-w-bold); line-height: 1.1; overflow-wrap: break-word; }
.g-box__sep { color: var(--g-ink-3); }
.g-box--name .g-box__values { font-size: var(--g-sheet-name); }
.g-box--score .g-box__values { font-size: var(--g-sheet-score); font-weight: var(--g-w-black); line-height: 1; }
.g-box__sub { font-size: var(--g-sheet-label); font-weight: var(--g-w-bold); color: var(--g-sheet-gold); }
.g-box__bar { width: 100%; height: var(--g-sheet-bar); margin-top: var(--g-1); background: var(--g-sheet); border: var(--g-hair) solid var(--g-sheet-edge); overflow: hidden; }
.g-box__bar > i { display: block; width: var(--g-box-pct); height: 100%; background: var(--g-sheet-gold); }
.g-box__bar[data-tone="hp"] > i { background: var(--g-sheet-hp); }
.g-box__bar[data-hp="is-ok"] > i { background: var(--g-bt-hp-ok); } .g-box__bar[data-hp="is-warn"] > i { background: var(--g-bt-hp-warn); } .g-box__bar[data-hp="is-bad"] > i { background: var(--g-bt-hp-bad); }
.g-box.is-tappable, .g-line.is-tappable { cursor: pointer; }
.g-box.is-tappable:hover { border-color: var(--g-sheet-gold); }
.is-gold { color: var(--g-sheet-gold); }

/* a value written in place: v1's dotted ink line; a choice of a few: the system's own list, drawn as ink */
.g-sheetpage .g-inline { border-bottom: var(--g-sheet-border) dotted var(--g-sheet-edge); }
.g-sheetpage .g-inline:focus { border-bottom-color: var(--g-accent); background: var(--g-sheet); }
.g-pick { appearance: none; -webkit-appearance: none; max-width: 100%; padding: 0 var(--g-1); border: 0; border-bottom: var(--g-sheet-border) dotted var(--g-sheet-edge);
  border-radius: 0; background: none; color: inherit; font: inherit; text-align: center; text-align-last: center; cursor: pointer; }
.g-pick:disabled { border-bottom-color: transparent; cursor: default; opacity: 1; }

/* ---- the top: the picture, the boxes beside it ---- */
.g-sheettop { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--g-2); align-items: stretch; }
.g-sheettop > .g-picture { aspect-ratio: auto; height: 100%; min-height: var(--g-sheet-pic-h); }
.g-sheettop > :not(.g-picture) { align-self: start; display: grid; gap: var(--g-2); }

/* a picture on the page: v1's ruled box, dashed while empty, the whole picture shown in it (never cropped) */
.g-sheetpage .g-picture { border-radius: 0; background: var(--g-sheet-2); border: var(--g-sheet-border) solid var(--g-sheet-edge); }
.g-sheetpage .g-picture:not(:has(> .g-picture__img:not([hidden]))) { border-style: dashed; }
.g-sheetpage .g-picture__img { position: absolute; inset: 0; object-fit: contain; }
/* a place's picture (location, shop): large, across the page, in its own shape */
.g-sheetpage > .g-picture { aspect-ratio: auto; min-height: var(--g-sheet-pic-h); }
.g-sheetpage > .g-picture > .g-picture__img:not([hidden]) { position: static; display: block; width: auto; height: auto; max-width: 100%; max-height: var(--g-sheet-pic-max); margin-inline: auto; }

/* ---- a section ---- */
.g-section { display: flex; flex-direction: column; gap: var(--g-2); padding: var(--g-3) var(--g-4) var(--g-4); border: var(--g-sheet-border) solid var(--g-sheet-edge); }
.g-section__title { margin: 0; text-align: center; color: var(--g-sheet-gold); font-size: var(--g-sheet-title); font-weight: var(--g-w-black); letter-spacing: var(--g-track-caps); text-transform: uppercase; }
.g-section__adds { display: flex; flex-wrap: wrap; gap: var(--g-2); }
.g-section__adds .g-btn { color: var(--g-sheet-gold); }

/* ---- lines ---- */
.g-lines { margin: 0; padding: 0; list-style: none; }
.g-line { display: flex; align-items: baseline; gap: var(--g-3); min-height: var(--g-sheet-line-h); padding: var(--g-2) var(--g-1) var(--g-1);
  border-bottom: var(--g-sheet-border) dotted var(--g-sheet-edge); }
.g-line.is-tappable:hover { background: var(--g-sheet-2); }
.g-line__label { flex: none; min-width: calc(var(--g-8) * 2); font-size: var(--g-sheet-label); font-weight: var(--g-w-bold); color: var(--g-ink-3); }
.g-line__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.g-line .g-line__text.g-inline { border-bottom: 0; }
.g-line__note { flex: none; color: var(--g-ink-3); font-size: var(--g-t-caption); }
.g-line.is-quiet .g-line__text { color: var(--g-ink-3); }
.g-line__more { flex: none; align-self: center; margin-block: calc(var(--g-2) * -1); }

/* ---- a table ---- */
.g-tablewrap { overflow-x: auto; }
.g-table { width: 100%; border-collapse: collapse; }
.g-table th { white-space: nowrap; padding: var(--g-1) var(--g-2); text-align: start; font-size: var(--g-sheet-label); font-weight: var(--g-w-bold); color: var(--g-ink-2); border-bottom: var(--g-sheet-border) solid var(--g-sheet-edge); }
.g-table td { padding: var(--g-2); border-bottom: var(--g-sheet-border) dotted var(--g-sheet-edge); vertical-align: top; }
.g-table .g-table__v { display: inline-block; min-width: var(--g-6); }
.g-table th:first-child { width: 34%; }
.g-table .g-pick { text-align: start; text-align-last: start; padding: 0; }
.g-table__act { width: var(--g-touch); padding: 0; text-align: end; }
.g-table__none { color: var(--g-ink-3); }

/* a cutout (a hero, a foe, an item: not a place) sits on the paper: what is round it is the paper, white or clear */
.g-sheetpage .g-picture.is-cutout .g-picture__img, .g-tile__pic img, .g-doll__pic img { mix-blend-mode: multiply; }

/* ---- tiles: v1's item grid, a picture each (or its kind's ink icon), its name and a note ---- */
.g-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--g-sheet-tile), 1fr)); gap: var(--g-2); }
.g-tile { display: flex; flex-direction: column; align-items: stretch; gap: var(--g-1); margin: 0; padding: var(--g-2); text-align: start;
  background: var(--g-sheet); border: var(--g-sheet-border) solid var(--g-sheet-edge); color: var(--g-ink); font: inherit; font-weight: var(--g-w-bold); cursor: pointer; }
.g-tile:hover:not(:disabled) { border-color: var(--g-sheet-gold); }
.g-tile:disabled { cursor: default; opacity: 1; }
.g-tile__pic, .g-doll__pic { display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; background: var(--g-sheet-2); color: var(--g-ink-2); font-size: var(--g-sheet-score); }
.g-tile__pic { border: var(--g-hair) solid var(--g-sheet-edge); }
.g-tile__pic img, .g-doll__pic img { width: 100%; height: 100%; object-fit: contain; }
.g-tile__pic svg { width: 58%; height: 58%; }
.g-tile__name { font-size: var(--g-t-caption); line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.g-tile__note { font-size: var(--g-t-caption); color: var(--g-sheet-gold); line-height: 1.2; }

/* ---- the equipment doll: v1's, the figure faint behind, a box per place round it ---- */
.g-doll { display: flex; flex-direction: column; gap: var(--g-2); }
.g-doll__body { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--g-2); width: 100%; max-width: var(--g-sheet-doll); margin: 0 auto; }
.g-doll__figure { position: absolute; inset: 0; width: 42%; height: 100%; margin: 0 auto; color: var(--g-ink-3); opacity: .14; pointer-events: none; }
.g-doll__extra { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--g-sheet-tile), 1fr)); gap: var(--g-2); }
.g-doll__slot { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--g-1); min-width: 0; margin: 0; padding: var(--g-1);
  background: var(--g-sheet); border: var(--g-sheet-border) solid var(--g-sheet-edge); color: var(--g-ink-2); font: inherit; cursor: pointer; }
.g-doll__slot.is-filled { border-color: var(--g-sheet-gold); color: var(--g-ink); }
.g-doll__slot:disabled { cursor: default; opacity: 1; }
.g-doll__slot:not(.is-filled) .g-doll__pic { background: var(--g-sheet-2); }
.g-doll__pic svg { width: 62%; height: 62%; }
.g-doll__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--g-t-caption); font-weight: var(--g-w-bold); line-height: 1.1; }
.g-doll__slot[data-slot="head"] { grid-column: 2; grid-row: 1; } .g-doll__slot[data-slot="back"] { grid-column: 1; grid-row: 2; }
.g-doll__slot[data-slot="neck"] { grid-column: 2; grid-row: 2; } .g-doll__slot[data-slot="handL"] { grid-column: 1; grid-row: 3; }
.g-doll__slot[data-slot="body"] { grid-column: 2; grid-row: 3; } .g-doll__slot[data-slot="handR"] { grid-column: 3; grid-row: 3; }
.g-doll__slot[data-slot="ringL"] { grid-column: 1; grid-row: 4; } .g-doll__slot[data-slot="ringR"] { grid-column: 3; grid-row: 4; }
.g-doll__slot[data-slot="feet"] { grid-column: 2; grid-row: 5; }

/* ---- notes: ruled lines to write on ---- */
.g-note .g-field__input { min-height: calc(var(--g-sheet-line-h) * 4); padding: 0 var(--g-1); border: 0; border-radius: 0; resize: vertical;
  font: inherit; line-height: var(--g-sheet-line-h); color: var(--g-ink); background-color: transparent; background-attachment: local;
  background-image: linear-gradient(to bottom, transparent calc(var(--g-sheet-line-h) - var(--g-hair)), var(--g-sheet-edge) 0); background-size: 100% var(--g-sheet-line-h); }
.g-note .g-field__input:focus { background-color: transparent; box-shadow: none; }
/* READ-ONLY (a sheet that is not mine: a growl's page, /design-system, the home's pictures of sheets; Maayan, 2026-11-08: "can't be
   edited"): a disabled field shows no edit affordance, no resize grip on a note, no dimming, a plain cursor */
.g-sheetpage :is(input, textarea, select):disabled { resize: none; cursor: default; opacity: 1; color: inherit; -webkit-text-fill-color: inherit; }

/* the kit's list and field, where a sheet still has one (a card's effects, a location's map): on paper, ruled */
.g-sheetpage .g-list { border-top: 0; } .g-sheetpage .g-list > li > .g-row { background: none; }   /* a sheet's list: its dotted lines only (below), as before */
.g-sheetpage .g-list .g-row { color: var(--g-ink); padding-inline: var(--g-1); border-bottom: var(--g-sheet-border) dotted var(--g-sheet-edge); }
.g-sheetpage .g-row__value, .g-sheetpage .g-quiet { color: var(--g-ink-2); }
.g-sheetpage .g-list__head { padding: 0; color: var(--g-sheet-gold); font-weight: var(--g-w-black); }

/* ---- in a wide pane: A4 pages of v1's width side by side where they fit, what does not fit on one going on to the
   next (sheet-pages.js); on a narrow page, v1's phone sheet: the picture over its boxes, everything a little smaller ---- */
@container pane (min-width: 900px) {
  .g-sheet__body:has(> .g-sheetpage) { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
  .g-sheet__body:has(> .g-sheetpage) > :not(.g-sheetpage) { flex: 0 0 100%; }
  .g-sheetpage { flex: 0 1 var(--g-sheet-width); max-width: 100%; padding: var(--g-5); aspect-ratio: 210 / 297; }
}
@container (max-width: 460px) {
  .g-sheetpage { --g-sheet-label: 13px; --g-sheet-value: 22px; --g-sheet-name: 26px; --g-sheet-score: 30px; }
  .g-sheettop { grid-template-columns: minmax(0, 1fr); }
  /* who it is: its name over the rest, each across the page */
  .g-boxes[data-cols="4"], .g-boxes[data-cols="5"] { --g-cols: 1; }
  .g-boxes[data-cols="4"] > .g-box, .g-boxes[data-cols="5"] > .g-box { grid-column: auto; }
  .g-sheettop > .g-picture { aspect-ratio: 4 / 3; height: auto; min-height: 0; }
}

/* zoom + and − (battle, map): every one a large round button, edged, its sign big */
.g-iconbtn.g-zoombtn { width: var(--g-touch); height: var(--g-touch); border-radius: 50%; background: var(--g-surface); box-shadow: inset 0 0 0 var(--g-stroke) var(--g-separator), var(--g-shadow); color: var(--g-text); }
.g-iconbtn.g-zoombtn svg { width: var(--g-icon); height: var(--g-icon); stroke-width: var(--g-zoom-stroke) !important; }
