/* ==========================================================================
   Forbidden Lands (FoundryVTT system 13.0.5) look-and-feel, extracted as a
   standalone stylesheet. Selectors are re-named (.fbl-*) so it works on any
   webpage. Values are copied from forbidden-lands.css; see DESIGN-SPEC.md.
   Paths are relative to this file: ./assets/borders, ./assets/fonts
   Default theme = parchment (Foundry "theme-dark"). Add class "fbl-light" to
   <body> for the white theme.
   ========================================================================== */

/* ---------- Fonts ---------- */
@font-face{font-family:"IM Fell DW Pica";src:url(./assets/fonts/imfe-dprm.otf)}
@font-face{font-family:"IM Fell DW Pica";font-style:italic;src:url(./assets/fonts/imfe-dpit.otf)}
@font-face{font-family:"IM Fell DW Pica SC";src:url(./assets/fonts/imfe-dwpscr.ttf)}
@font-face{font-family:"IM Fell Three Line Pica";src:url(./assets/fonts/imfe-tlrm.otf)}
@font-face{font-family:"IM Fell Great Primer";src:url(./assets/fonts/imfe-gprm.otf)}
@font-face{font-family:"IM Fell Great Primer";font-style:italic;src:url(./assets/fonts/imfe-gpit.otf)}
@font-face{font-family:Author;size-adjust:110%;src:url(./assets/fonts/author-medium.otf)}
@font-face{font-family:Author;font-weight:700;size-adjust:110%;src:url(./assets/fonts/author-semibold.otf)}
@font-face{font-family:Author;font-style:italic;size-adjust:110%;src:url(./assets/fonts/author-medium-italic.otf)}
@font-face{font-family:Author;font-style:italic;font-weight:700;size-adjust:110%;src:url(./assets/fonts/author-semibold-italic.otf)}
@font-face{font-family:skullz;src:url(./assets/fonts/skullz.ttf)}      /* glyph "l" = skull   */
@font-face{font-family:Swordlings;src:url(./assets/fonts/swordlings.ttf)} /* glyph "x" = crossed swords */

/* ---------- Tokens ---------- */
:root{
  /* Foundry core font-size scale (Foundry supplies these; defined here for standalone use) */
  --font-size-11:.6875rem; --font-size-12:.75rem; --font-size-13:.8125rem; --font-size-14:.875rem;
  --font-size-16:1rem; --font-size-18:1.125rem; --font-size-20:1.25rem; --font-size-24:1.5rem;
  --font-size-28:1.75rem; --font-size-32:2rem; --font-size-48:3rem;

  --color-theme-text:#222020;
  --color-theme-background:#bcb192;      /* parchment (light theme overrides to #fff) */
  --color-theme-accent:#a00404;          /* blood red: broken things, hover glow, links */
  --color-theme-gray-200:#ddd;           /* odd table rows, hover bg, dice-roll box   */
  --color-theme-gray-400:#999;
  --color-theme-gray-600:#707070;
  --color-theme-gray-800:#333;           /* tab bar background                         */
  --color-theme-alt-200:#ffb994;
  --color-theme-alt-600:#36b5a7;         /* teal: input focus glow                     */
  --color-theme-alt-800:#005d67;
  --color-theme-alt-900:#433a3f;
  --color-theme-alt-1000:#bcb192;        /* parchment                                  */
  --color-border:#333;                   /* approximation of Foundry --color-border (dark ink) */
  --color-shadow-primary:var(--color-theme-alt-600);

  --font-header:"IM Fell DW Pica",serif;
  --font-header-sc:"IM Fell DW Pica SC",serif;   /* h2/h3 small caps headings */
  --font-title:"IM Fell Three Line Pica",serif;  /* big page titles           */
  --font-alternative:"IM Fell Great Primer",serif; /* labels, tabs, prose     */
  --font-primary:Author,Ubuntu,sans-serif;       /* body / UI text (Author)   */
  --font-body:var(--font-primary);

  --art:./assets/borders;
}
body.fbl-light{ --color-theme-background:#fff; }

/* ---------- Page ---------- */
[class^="fbl-"],[class*=" fbl-"]{ box-sizing:border-box; }
.fbl-page{ background:var(--color-theme-background); color:var(--color-theme-text);
  font-family:var(--font-body); font-size:var(--font-size-14); line-height:1.4; }

/* ---------- Window frame: thorny hand-drawn outer border ----------
   box-border-large.webp is 1992x2789; slice 110px; width 11 (x2px = 22px); outset 3 (x2px = 6px) */
.fbl-window{
  color:var(--color-theme-text);
  border:2px solid transparent;
  border-image:url(./assets/borders/box-border-large.webp) 110/11 repeat;
  border-image-outset:3;
  padding:0 4px 4px; margin:0;
  background:var(--color-theme-background);
}
body.fbl-light .fbl-window{ border-image-source:url(./assets/borders/box-border-large.webp); }
body:not(.fbl-light) .fbl-window{ border-image-source:url(./assets/borders/box-border-large-dark.webp); }
.fbl-window-header{ display:flex; align-items:center; justify-content:space-between; gap:8px; padding:6px 8px; }
.fbl-window-content{ padding:2px 4px; }

/* ---------- Panel: chain-link border (the one around header, lists, chat cards) ----------
   small-border.webp is 4000x4000; slice 100; drawn 10px wide; layout border 6px (image overhangs) */
.fbl-panel{
  border:6px solid transparent;
  border-image:url(./assets/borders/small-border.webp) 100/10px repeat;
  padding:8px;
}

/* ---------- Headings ---------- */
.fbl-h2,.fbl-h3{
  border:0; margin:0; padding:4px; text-align:center; text-transform:uppercase;
  font-family:var(--font-header-sc); font-size:var(--font-size-16); font-weight:700; line-height:initial;
}
.fbl-h3{ padding:0; margin-bottom:4px; }
.fbl-label{ font-family:var(--font-alternative); font-size:var(--font-size-16); font-weight:700; }

/* ---------- Tab bar: dark strip, active tab gets swords + skull glyphs ---------- */
.fbl-tabs{
  display:flex; flex-wrap:nowrap; justify-content:space-evenly;
  background:var(--color-theme-gray-800); color:#fff;
  font-family:var(--font-alternative); margin:8px 0; padding:0 8px;
}
.fbl-tab{
  position:relative; padding:8px 12px; font-size:var(--font-size-16); line-height:1; font-weight:400;
  color:#fff; text-transform:uppercase; white-space:nowrap; text-align:center; cursor:pointer;
  background:none; border:0; font-family:inherit;
}
.fbl-tab:hover{ text-shadow:0 0 6px #fff; }
.fbl-tab.active{ filter:drop-shadow(0 0 2px #999); }
.fbl-tab.active::before{ position:absolute; font-family:Swordlings; text-transform:lowercase; content:"x";
  font-size:var(--font-size-16); left:-6px; top:.55rem; }
.fbl-tab.active::after{ position:absolute; font-family:skullz; text-transform:lowercase; content:"l";
  font-size:var(--font-size-24); top:.3rem; right:-5px; }

/* ---------- Lists (talents / attacks / gear) ---------- */
.fbl-list{ display:flex; flex-direction:column; font-family:var(--font-body); font-size:var(--font-size-14); line-height:16px; padding:4px; }
.fbl-list-header{ display:flex; justify-content:space-between; align-items:center; border-bottom:2px solid var(--color-border);
  margin-bottom:4px; padding:4px; font-weight:700; text-transform:uppercase; }
.fbl-list-item{ display:flex; justify-content:space-between; align-items:center; gap:8px;
  border-bottom:1px solid var(--color-border); padding:2px 4px; }
.fbl-list-item:last-child{ border-bottom:0; }
.fbl-list-item:nth-child(odd){ background:var(--color-theme-gray-200); color:var(--color-theme-gray-800); }
.fbl-list-item img{ object-fit:contain; vertical-align:middle; filter:drop-shadow(0 0 3px rgba(0,0,0,.6)); }
ol.fbl-list-numbered{ list-style:none; counter-reset:item; margin:0; padding:0; }
ol.fbl-list-numbered > li{ counter-increment:item; }
ol.fbl-list-numbered > li > div{ flex:1; }
ol.fbl-list-numbered > li::before{ content:counter(item); font-weight:700; margin-right:8px; }

/* ---------- Controls ---------- */
.fbl-btn{ background:transparent; border:0; border-radius:3px; color:var(--color-theme-text); cursor:pointer;
  font:inherit; font-weight:700; padding:2px 4px; }
.fbl-btn:hover,.fbl-btn:focus{ background:var(--color-theme-gray-200); }
.fbl-btn:disabled{ opacity:.5; cursor:default; }
.fbl-btn-framed{ font-weight:600; border:2px solid var(--color-border); border-radius:6px; box-shadow:0 0 5px transparent;
  display:block; margin:0 auto; width:max(2em,60%); transition:transform 80ms ease-in-out,box-shadow 80ms ease-in-out; }
.fbl-btn-framed:hover,.fbl-btn-framed:focus{ box-shadow:0 0 5px var(--color-theme-accent); border:2px solid var(--color-theme-accent); }
.fbl-btn-framed:active{ transform:scale(.96); }
.fbl-input{ background:var(--color-theme-background); border:1px solid var(--color-border); border-radius:3px;
  box-shadow:inset 0 0 6px var(--color-theme-gray-200); color:var(--color-theme-text);
  font-family:var(--font-body); font-size:var(--font-size-14); width:100%; }
.fbl-input:focus{ box-shadow:0 0 10px var(--color-shadow-primary); outline:none; }
.fbl-input::placeholder{ color:var(--color-theme-text); opacity:.5; }
.fbl-input[type=number]{ text-align:center; }

/* ---------- Dice-roll result box (chat) ---------- */
.fbl-dice-roll{ font-family:var(--font-body); background:var(--color-theme-gray-200); color:var(--color-theme-gray-800);
  border-radius:4px; box-shadow:inset 0 0 2px #9996; padding:1rem; margin-bottom:.8rem; }
.fbl-dice-roll:hover{ box-shadow:inset 0 0 2px #1119; }
.fbl-dice-total{ font-family:var(--font-header-sc); font-size:var(--font-size-20); font-weight:600;
  border-top:2px solid rgba(17,17,17,.13); padding-top:1.3rem; display:flex; justify-content:center; }

/* ---------- Chat card: chain border + parchment ---------- */
.fbl-chat-card{ position:relative; background:var(--color-theme-background); font-size:var(--font-size-14); margin:3px; }
.fbl-chat-card::after{ content:""; position:absolute; top:0; left:0; width:calc(100% - 6px); height:calc(100% - 6px); margin:3px;
  border:10px solid transparent; border-image:url(./assets/borders/small-border.webp) 100/10px repeat; pointer-events:none; z-index:0; }
.fbl-chat-card-header{ position:relative; z-index:1; padding:16px 20px 4px; display:flex; justify-content:space-between; font-size:var(--font-size-12); }
.fbl-chat-card-body{ position:relative; z-index:1; padding:.5em 20px 20px; }

/* ---------- Journal / long-form pieces ---------- */
/* Ornamental banner above a page title */
.fbl-header-ornament::before{ content:""; display:block; height:100px; margin-bottom:-16px;
  background:url(./assets/borders/top_border.webp) center/contain no-repeat; }
.fbl-header-ornament::after{ content:""; display:block; height:25px; margin-top:-6px;
  background:url(./assets/borders/endstop.webp) center/contain no-repeat; }
.fbl-page-title{ font-family:var(--font-title); text-transform:uppercase; text-align:center; }
/* Big illustrated title frame (title-border.webp, 879x342) */
.fbl-title-banner{ min-height:250px; width:min(100%,900px); margin-inline:auto; padding:20px 85px 0;
  display:flex; align-items:center; justify-content:center; text-align:center; text-transform:uppercase;
  font-family:var(--font-title); font-size:var(--font-size-32); line-height:1;
  border:1px solid transparent; border-image:url(./assets/borders/title-border.webp); border-image-slice:50%; border-image-width:100%; }
/* Sidebar / callout box: ornament line top and bottom only (box-border-top-bottom.webp, 977x977) */
.fbl-box{ border-style:solid; border-image:url(./assets/borders/box-border-top-bottom.webp) 60 0 round; border-image-width:20px 0;
  font-family:var(--font-primary); line-height:135%; padding:25px 0; margin:1rem; }
.fbl-box.right{ width:320px; float:right; } .fbl-box.left{ width:320px; float:left; }
/* Dialog heading ornaments (attack = shield+axes, spell = pentagram) */
.fbl-dialog-title.attack::before,.fbl-dialog-title.spell::before{ content:""; display:block; height:56px; width:77%; margin:0 auto; background-size:100%; background-repeat:no-repeat; background-position:top center; }
.fbl-dialog-title.attack::before{ background-image:url(./assets/borders/attack-border.webp); }
.fbl-dialog-title.spell::before{ background-image:url(./assets/borders/pentagram-border.webp); }
.fbl-dialog-title::after{ content:""; display:block; width:147px; height:40px; margin:0 auto; background:url(./assets/borders/endstop.webp) center/100% no-repeat; }
/* Prose */
.fbl-prose{ font-family:var(--font-alternative); line-height:1.75; font-size:var(--font-size-16); }
.fbl-prose ul{ list-style-type:"\2725   "; margin-inline-start:.5rem; }   /* ✥ bullet */
.fbl-prose table{ background:transparent; border:none; font-size:var(--font-size-14); }
.fbl-prose thead{ border-bottom:2px solid var(--color-border); }
.fbl-prose tr{ border-bottom:1px solid var(--color-border); }
.fbl-prose tr:nth-child(odd):not(:has(th)){ background:#cbcccb; }
.fbl-prose h1,.fbl-prose h2,.fbl-prose h3{ font-family:var(--font-title); text-transform:uppercase; text-align:center; border:unset; }

/* ---------- Utility ---------- */
.fbl-flex{display:flex}.fbl-row{flex-direction:row}.fbl-col{flex-direction:column}.fbl-gap{gap:.5rem}.fbl-grow{flex-grow:1}
.fbl-center{align-items:center}.fbl-between{justify-content:space-between}
.fbl-broken{color:var(--color-theme-accent)}
