/* =============================================================================
   Inheritor RPG - Custom Publish CSS
   A clean, minimal stylesheet for Obsidian Publish
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Google Fonts Import
   ----------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Alegreya:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* -----------------------------------------------------------------------------
   Base Theme Variables
   ----------------------------------------------------------------------------- */
body {
  --font-editor-theme: 'Alegreya', Georgia, serif;
  --font-editor: var(--font-editor-override), var(--font-text-override), var(--font-editor-theme);
  
  /* Typography */
  --normal-weight: 400;
  --bold-weight: 900;
  --line-height: 1.5;
  --line-width: 40rem;
  --max-width: 88%;
  --font-text-size: 1.25rem;
  
  /* Images */
  --image-muted: 1;
  --image-radius: 4px;
  
  /* Headings */
  --h1-size: 1.125em;
  --h2-size: 1.05em;
  --h3-size: 1em;
  --h4-size: 0.90em;
  --h5-size: 0.85em;
  --h6-size: 0.85em;
  --h1-weight: 600;
  --h2-weight: 600;
  --h3-weight: 500;
  --h4-weight: 500;
  --h5-weight: 500;
  --h6-weight: 400;
  
  /* Spacing */
  --p-spacing: 1rem;
  --heading-spacing: 2em;
  --nested-padding: 1.1em;
}

/* -----------------------------------------------------------------------------
   Dark Theme Colors
   ----------------------------------------------------------------------------- */
.theme-dark {
  --color-red: #d04255;
  --color-orange: #d5763f;
  --color-yellow: #e5b567;
  --color-green: #a8c373;
  --color-cyan: #73bbb2;
  --color-blue: #6c99bb;
  --color-purple: #9e86c8;
  --color-pink: #b05279;
  
  --background-primary: #262626;
  --background-secondary: hsl(0, 0%, 13%);
  --background-modifier-border: hsl(0, 0%, 21%);
  --background-modifier-border-hover: hsl(0, 0%, 27%);
  --background-modifier-hover: hsla(0, 0%, 55%, 0.12);
  
  --text-normal: #E8E8E8;
  --text-muted: hsl(0, 1%, 51%);
  --text-faint: hsl(0, 0%, 35%);
  
  --text-accent: hsl(201, 17%, 60%);
  --interactive-accent: hsl(201, 17%, 55%);
}

/* -----------------------------------------------------------------------------
   Site-Specific: Inheritor
   ----------------------------------------------------------------------------- */
.site-inheritor .site-body-left-column-site-name {
  display: none;
}

.site-inheritor .site-header-text {
  display: none;
}

/* Font - Apply Alegreya explicitly to all elements */
.site-inheritor,
.site-inheritor p,
.site-inheritor li,
.site-inheritor td,
.site-inheritor th,
.site-inheritor span,
.site-inheritor h1,
.site-inheritor h2,
.site-inheritor h3,
.site-inheritor h4,
.site-inheritor h5,
.site-inheritor h6,
.site-inheritor .markdown-preview-view {
  font-family: 'Alegreya', Georgia, serif !important;
}

/* Headers - Desaturated, weathered tones */
.site-inheritor h1 { color: #a65d5d !important; } /* Dried blood */
.site-inheritor h2 { color: #a67c52 !important; } /* Tarnished bronze */
.site-inheritor h3 { color: #8a8455 !important; } /* Aged gold */
.site-inheritor h4 { color: #5d7a5d !important; } /* Verdigris */
.site-inheritor h5 { color: #5a7a7a !important; } /* Weathered copper */
.site-inheritor h6 { color: #6a6a8a !important; } /* Faded violet */

/* CSS Snippets */
.dried-blood      { color: #a65d5d;}
.tarnished-bronze { color: #a67c52;}
.aged-gold        { color: #8a8455; }
.verdigris        { color: #5d7a5d; }
.weathered-copper { color: #5a7a7a; }
.faded-violet     { color: #6a6a8a; }
.bone-parchment   { color: #fff2de; }
.ash-gray         { color: #9a9590; }

/* Bold - Bone/parchment, high contrast */
.site-inheritor b,
.site-inheritor strong {
  color: #fff2de; 
}

/* Italic - Ash gray, recedes slightly */
.site-inheritor i,
.site-inheritor em {
  color: #9a9590;
}

/* Text size - center column */
.site-inheritor .site-body-center-column {
  font-size: var(--font-text-size) !important;
  line-height: 1.6 !important;
}

/* Links - Cool teal accent */
.site-inheritor .site-body-center-column a {
  color: #6aadad !important;
  font-weight: 600 !important;
  text-decoration: underline;
  text-decoration-color: #4a8a8a;
}

.site-inheritor .site-body-center-column a:hover {
  color: #8acaca !important;
}

.site-inheritor figcaption {
  color: #949494;
  font-size: small;
  text-align: center;
  font-style: italic;
  font-weight: 800;
}

.site-inheritor .kofi-button {
  background: linear-gradient(to right, rgb(168, 62, 62), rgb(134, 86, 83)) !important;
  background-color: transparent !important;
  text-decoration: none !important;
}

/* -----------------------------------------------------------------------------
   Site-Specific: Nate
   ----------------------------------------------------------------------------- */
.site-nate .kofi-button {
  background: linear-gradient(to right, #2476b9ff, #2bc0b4ff) !important;
  background-color: transparent !important;
  text-decoration: none !important;
}

.site-header-text {
  background: linear-gradient(to right, #2196f3, #eeff41, #f9a825, #ff5722);
  background-clip: border-box;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* -----------------------------------------------------------------------------
   Dice Roller
   ----------------------------------------------------------------------------- */
#dice-roller {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 5px;
  gap: 4px;
}

#dice-history {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-family: monospace;
  width: 300px;
  text-align: right;
}

.dice-history-item {
  color: #fff;
  transition: opacity 0.3s;
}

.dice-history-item:nth-last-child(1) { opacity: 0.85; }
.dice-history-item:nth-last-child(2) { opacity: 0.7; }
.dice-history-item:nth-last-child(3) { opacity: 0.5; }
.dice-history-item:nth-last-child(4) { opacity: 0.35; }
.dice-history-item:nth-last-child(5) { opacity: 0.2; }

.dice-history-item.success { color: #6c6; }
.dice-history-item.failure { color: #c66; }

#dice-input {
  padding: 8px 12px;
  border: 1px solid #444;
  border-radius: 20px;
  background: #2a2a2a;
  color: #fff;
  font-size: 14px;
  width: 300px;
  outline: none;
  text-align: right;
}

#dice-input::placeholder {
  color: #888;
}

#dice-input:focus {
  border-color: #666;
}

#dice-input.has-result {
  color: #fff;
}

#dice-input.success {
  border-color: #4a4;
}

#dice-input.failure {
  border-color: #a44;
}

/* Shadows for footer elements */
#dice-roller,
#kofi-button-container {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5));
}

/* Dice roller attention animation */
@keyframes dice-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.9);
  }
  50% {
    box-shadow: 0 0 0 12px rgba(235, 101, 101, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(235, 101, 101, 0);
  }
}

#dice-input.dice-attention {
  animation: dice-pulse 1.5s ease-out 5;
}

/* -----------------------------------------------------------------------------
   Stacked Panes (Andy Matuschak Mode)
   ----------------------------------------------------------------------------- */
.publish-renderer.mod-squished {
  filter: brightness(0.6);
}

.publish-renderer.mod-overlay:not(.mod-squished) {
  box-shadow: -10px 0 25px rgba(0, 0, 0, 0.45);
}

/* -----------------------------------------------------------------------------
   Playtest Nav Item - Split Reveal Animation
   ----------------------------------------------------------------------------- */
.link-split {
  overflow: visible;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
  display: block;
  position: relative;
}

a[href*="Playtest"] {
  overflow: visible;
}

.tree-item,
.nav-file,
.nav-file-title {
  overflow: visible;
}

.link-split .link-split-text {
  visibility: hidden;
  display: inline-block;
}

.link-split span:nth-child(2) {
  position: absolute;
  top: 0;
  left: 0;
  color: #60a5fa;
  transition: 0.5s;
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%);
}

.link-split:hover span:nth-child(2) {
  transform: translateY(-6px);
}

.link-split span:nth-child(3) {
  position: absolute;
  top: 0;
  left: 0;
  color: #60a5fa;
  transition: 0.5s;
  clip-path: polygon(0 50%, 100% 50%, 100% 100%, 0 100%);
}

.link-split:hover span:nth-child(3) {
  transform: translateY(6px);
}

.link-split span:nth-child(4) {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translateY(-50%) scaleY(0);
  color: #fff;
  background: linear-gradient(90deg, #3b82f6, #818cf8);
  font-size: 0.65em;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-align: center;
  padding: 1px 4px;
  white-space: nowrap;
  transition: 0.5s;
}

.link-split:hover span:nth-child(4) {
  transform: translateY(-50%) scaleY(1);
}

/* -----------------------------------------------------------------------------
   Hover Popovers
   ----------------------------------------------------------------------------- */
.popover.hover-popover {
  border: 2px #eb6565 groove !important;
  border-radius: 0 !important;
}

.popover.hover-popover > .markdown-embed {
  padding: 1rem !important;
}

/* -----------------------------------------------------------------------------
   Graph Colors
   ----------------------------------------------------------------------------- */
.graph-view.color-circle,
.graph-view.color-fill-highlight {
  background-color: #a200ff !important;
}

/* -----------------------------------------------------------------------------
   Links
   ----------------------------------------------------------------------------- */
.cm-s-obsidian .cm-link.cm-hmd-barelink {
  color: var(--color-red);
}

/* -----------------------------------------------------------------------------
   Scrollbars (Styled)
   ----------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 11px;
  background-color: transparent;
}

::-webkit-scrollbar:horizontal {
  height: 11px;
}

::-webkit-scrollbar-corner {
  background-color: transparent;
}

::-webkit-scrollbar-track {
  background-color: transparent;
}

::-webkit-scrollbar-thumb {
  background-clip: padding-box;
  border-radius: 20px;
  border: 3px solid transparent;
  background-color: var(--background-modifier-border);
  min-height: 45px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--background-modifier-border-hover);
}

/* -----------------------------------------------------------------------------
   Animated Gradient for Playtest Content
   ----------------------------------------------------------------------------- */
.gradient-text {
  background: linear-gradient(90deg, #a0850c, #9c7223, #f8d849, #6e4611);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent !important;
  animation: gradient-shift 1.5s linear infinite;
}

@keyframes gradient-shift {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

/* -----------------------------------------------------------------------------
   Hiding Back links on desktop
   ----------------------------------------------------------------------------- */
@media screen and (min-width: 751px) {
  sub {
    display: none;
  }
}

/* -----------------------------------------------------------------------------
   Mobile Adjustments
   ----------------------------------------------------------------------------- */
@media screen and (max-width: 750px) {
  #dice-roller {
    display: none;
  }
}

/* Hide converted tables, show cards everywhere */
table.table-converted {
  display: none;
}

.table-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Table card styles */
.table-card {
  background: var(--background-secondary, #1e1e1e);
  border: 1px solid var(--background-modifier-border, #363636);
  border-radius: 8px;
  font-size: 0.85em;
  overflow: hidden;
}

.table-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  gap: 12px;
}

.table-card-header:hover {
  background: var(--background-modifier-hover, rgba(255,255,255,0.05));
}

.table-card-header .table-card-value {
  color: #a65d5d !important;
  font-weight: 600;
  flex-grow: 1;
}

.table-card-header .table-card-value b,
.table-card-header .table-card-value strong {
  color: #a65d5d !important;
}

.table-card-chevron {
  color: var(--text-muted, #888);
  font-size: 0.8em;
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.table-card.expanded .table-card-chevron {
  transform: rotate(180deg);
}

.table-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
  border-top: 1px solid var(--background-modifier-border, #2a2a2a);
}

.table-card.expanded .table-card-body {
  max-height: max-content !important;
}

.table-card-field {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  border-bottom: 1px solid var(--background-modifier-border, #2a2a2a);
}

.table-card-field:last-child {
  border-bottom: none;
}

.table-card-label {
  color: var(--text-muted, #888);
  font-size: 0.8em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.table-card-value {
  color: var(--text-normal, #ddd);
  font-weight: 500;
  font-size: 0.95em;
}

/* -----------------------------------------------------------------------------
   Floating Chat Plugin (if used)
   ----------------------------------------------------------------------------- */
.floatingchat-container-wrap {
  background: transparent !important;
  padding: 0 !important;
}

.floatingchat-container-wrap-mo498 {
  margin: 10px !important;
}