/* Graphite + violet skin. Bulma owns controls; Grimora owns its card layouts. */
:root {
  --canvas: #f3f3f6; --surface: #ffffff; --ink: #292830; --muted: #696775;
  --line: #d9d8e1; --control-line: #a5a1b2; --soft: #eae8f0;
  --accent: #7451b8; --focus: #7451b8; --frame: #303039; --frame-line: #62616f;
  --bulma-family-primary: Inter, Arial, sans-serif;
  --bulma-family-secondary: Inter, Arial, sans-serif;
  --bulma-primary-h: 260deg; --bulma-primary-s: 42%; --bulma-primary-l: 52%;
  --bulma-primary-invert-l: 100%; --bulma-link-h: 260deg; --bulma-link-s: 42%; --bulma-link-l: 42%;
  --bulma-scheme-h: 250deg; --bulma-scheme-s: 8%;
  --bulma-radius: 8px; --bulma-radius-small: 5px;
  font-family: Inter, Arial, sans-serif; color-scheme: light;
}
:root[data-theme=dark] {
  --canvas: #1c1c22; --surface: #28282f; --ink: #f0eff5; --muted: #b9b6c6;
  --line: #45444f; --control-line: #777382; --soft: #36333f;
  --accent: #b69ae7; --focus: #c1a3f2; --frame: #292830; --frame-line: #63616e;
  --bulma-link-l: 76%; color-scheme: dark;
}
body { font-family: Inter, Arial, sans-serif; background: var(--canvas); color: var(--ink); }
/* Native details internals can reset inherited sizing; preserve Grimora's
   explicit box model across disclosures and dialogs. */
*, ::before, ::after { box-sizing: border-box; }
body strong { color: inherit; }
a { color: inherit; }
.page-heading h1 { font-size: clamp(26px,3vw,34px); font-weight: 550; line-height: 1.25; letter-spacing: -1.15px; }
.masthead .wordmark { color: var(--ink); }
.search-icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.masthead { background: var(--surface); box-shadow: 0 1px 0 var(--line),0 5px 24px #20202a05; }
.nav-link { color: var(--muted); }
.nav-link:hover, .nav-link.active { color: var(--ink); }
.bulma-button { font-family: inherit; font-weight: 550; border-radius: 8px; min-height: 44px; transition: background-color .15s,box-shadow .15s; }
.bulma-button:not(.bulma-is-primary):not(.bulma-is-ghost) { --bulma-button-background-l: 100%; --bulma-button-border-l: 81%; color: var(--ink); background: var(--surface); }
.bulma-button.bulma-is-primary { color: #fff; box-shadow: 0 2px 3px #29164116,inset 0 1px 0 #ffffff24; }
.bulma-button.bulma-is-ghost { color: var(--accent); }
.bulma-button:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
#search-form { border-color: var(--control-line); border-radius: 12px; padding: 7px 7px 7px 20px; background: var(--surface); box-shadow: 0 3px 10px #20202a09; }
#search-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb,var(--accent) 18%,transparent); }
#search.bulma-input { box-shadow: none; background: transparent; border: 0; color: var(--ink); padding-left: 0; font-size: 18px; }
#search::placeholder { color: var(--muted); }
.search-submit { min-width: 130px; border-radius: 7px; }
.card-image-wrap { box-shadow: 0 2px 3px #22212d1a,0 7px 18px #22212d12; }
.card-tile:hover .card-image-wrap { box-shadow: 0 4px 8px #22212d26,0 12px 26px #22212d20; }
.card-name { font-weight: 600; }
.card-meta { color: var(--muted); }
.card-keyboard-help > summary, .card-size-control { color: var(--muted); }
.grimora-select, .entry-controls input.bulma-input, .form-dialog input.bulma-input, .form-dialog textarea.bulma-textarea {
  border: 1px solid var(--control-line); background: var(--surface); color: var(--ink); border-radius: 8px; font-family: inherit;
}
.entry-controls input.bulma-input { width: 80px; }
.collection-entries[data-view=grid] .entry-controls input.bulma-input { width: 100%; }
.form-dialog select:disabled { opacity: .65; cursor: not-allowed; }
.entry-row { border-radius: 12px; border-color: var(--line); box-shadow: 0 2px 5px #22212d08; padding: 18px; }
.entry-card strong { font-weight: 600; }
.entry-edit > summary { color: var(--accent); border-top: 1px solid var(--line); margin-top: 14px; }
.entry-select, .check-field input { accent-color: var(--accent); }
.collection-link[aria-pressed=true] { border-color: var(--line); box-shadow: inset 3px 0 var(--accent),0 2px 6px #22212d08; }
.form-dialog { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 80px #11111a50,inset 0 1px 0 #ffffff12; }
dialog::backdrop { background: #1c172b75; backdrop-filter: blur(3px); }
.close-button { color: var(--ink); background: var(--soft); }
.detail-type { color: var(--muted); }
[data-theme=dark] .bulma-button:not(.bulma-is-primary):not(.bulma-is-ghost) { --bulma-button-background-l: 17%; --bulma-button-border-l: 40%; }
[data-theme=dark] .bulma-button.bulma-is-ghost:hover { color: #e1d1ff; }
@media(max-width:540px) { .search-submit { min-width: 94px; padding-inline: 12px; }.search-submit span { display: none; } }
@media(max-width:540px) { .entry-controls input.bulma-input { width: 100%; } }
@media(prefers-reduced-motion:reduce) { .bulma-button { transition: none; } }

/* Native select contract: callers retain select.value/options/labels directly. */
select.grimora-select {
  appearance: none; padding-right: 2.5em;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%237451b8' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .7em center; background-size: 16px;
}
:root[data-theme=dark] select.grimora-select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23b69ae7' stroke-width='1.8'/%3E%3C/svg%3E"); }
select.grimora-select[multiple] { background-image: none; padding-right: .75em; }
.card-size-control select.grimora-select { min-height: 40px; width: auto; }
input[type=checkbox], input[type=radio], input[type=range] { accent-color: var(--accent); }
.form-dialog input[type=checkbox], .form-dialog input[type=radio] { min-height: auto; }
textarea.bulma-textarea { background: var(--surface); color: var(--ink); }
.bulma-input:focus-visible, .bulma-textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
/* Bulma's reset must not change icons, charts, or existing accessible hiding. */
.search-icon:not(.ui-icon), .settings-trigger svg:not(.ui-icon), button svg:not(.ui-icon) { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; }
[hidden] { display: none !important; }
.entry-controls select.grimora-select { width: auto; max-width: 100%; }
.collection-entries[data-view=grid] .entry-controls select.grimora-select { width: 100%; }
