/* Base variables and theme tokens */
:root {
  --radius-small: 4px;
  --radius-medium: 8px;
  --radius-large: 16px;
  --container-max: 1200px;
  --shadow-strong: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-medium: 0 2px 10px rgba(0, 0, 0, 0.15);
  --underline-height: 2px;
  --navbar-offset: 54px;
  /* Welcoming Navbar Gradient */
  --navbar-gradient: linear-gradient(
    135deg,
    #d63535 0%,
    #c04488 22%,
    #8b5cbf 45%,
    #5b8fee 70%,
    #6db8fb 88%,
    #9dd4ff 100%
  );
  /* Accent Underline */
  --navbar-underline: linear-gradient(
    90deg,
    #ff6b6b 0%,
    #e86db8 25%,
    #b08ee0 50%,
    #70aaff 75%,
    #a8dcff 100%
  );
  --btn-gradient: #7c3aed;
  --btn-gradient-hover: #6d28d9;
}

/* DARK THEME */
body.theme-dark {
  isolation: isolate; /* create stacking context so ::before z-index:-1 stays behind children */
  background-image: none; /* black SVG invisible on dark bg — use ::before with filter instead */
  --bg-gradient: #1d161c;
  --text-color: #eeeeee;
  --muted-text: #bebebe;
  --heading-color: #f5f5f5;
  --heading-sub: #f5f5f5;
  --container-bg: #303037;
  --border-color: #43434a;
  --table-header-bg: #1c1c20;
  --card-bg: #2a2a30;
  --info-item-bg: rgba(178, 126, 215, 0.09);
  --input-bg: #1c1c20;
  --link: #c084fc;
  --link-hover: #dba8ff;
  --blockquote: #b98ff5;
  --dropdown-bg: #303037;
  --shadow-elev: 0 10px 40px rgba(0, 0, 0, 0.4);
  --primary-blue: #b98ff5;
  --primary-blue-hover: #a070e0;
  --accent-blue: #b98ff5;
  --accent-blue-light: #ead8ff;
  --light-blue-text: #d5b5ff;
  --bg-dark: #1c1c20;
  --footer-bottom-bg: #1c1c20;
  --footer-border: #43434a;
  --footer-section-bg: #252529;
  --text-primary: #eeeeee;
  --text-secondary: #a7a7a7;
  --card-header-bg: #2a2a30;
  --item-bg: #2a2a30;
  --item-hover-bg: #35353c;
  --primary-color: #0282aa;
  --primary-hover: #0095c1;
  --primary-shadow: rgba(2, 130, 170, 0.4);
  --info-text: #a3d5f0;
  --info-bg: #1a3a4a;
  --info-border: #2a5264;
  --shadow-color: rgba(2, 130, 170, 0.3);
  --button-disabled-bg: rgba(148, 163, 184, 0.2);
  --button-disabled-border: rgba(148, 163, 184, 0.32);
  --button-disabled-text: rgba(226, 232, 240, 0.72);
  --button-disabled-shadow: none;
  --btn-gradient: #ebebeb;
  --btn-gradient-hover: #ffffff;
}

/* Filter converts white SVG fills → rgb(145,79,87) so blended at .22 opacity over #0D0B0E = #2A1A1E */
body.theme-dark::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/assets/img/contour-pattern-bg.svg') repeat;
  filter: brightness(0.85) sepia(1) hue-rotate(315deg) brightness(0.674)
    saturate(2);
  opacity: 0.35;
  pointer-events: none;
  z-index: -1;
}

/* LIGHT THEME — Clean white + gray */
body.theme-light {
  isolation: isolate;
  --bg-gradient: linear-gradient(
    135deg,
    #fffcfd 0%,
    #fdf9fa 30%,
    #fcf7f9 60%,
    #fdfafb 100%
  );
  --text-color: #1a1a1a;
  --muted-text: #6b7280;
  --heading-color: #111111;
  --heading-sub: #111111;
  --container-bg: #ffffff;
  --border-color: #e2e4e7;
  --table-header-bg: #f3f4f6;
  --card-bg: rgba(243, 244, 246, 0.6);
  --info-item-bg: rgba(124, 58, 237, 0.05);
  --input-bg: #ffffff;
  --link: var(--primary-blue);
  --link-hover: var(--primary-blue-hover);
  --blockquote: var(--primary-blue);
  --dropdown-bg: #ffffff;
  --shadow-elev: 0 4px 20px rgba(0, 0, 0, 0.08);
  --primary-blue: #7c3aed;
  --primary-blue-hover: #6d28d9;
  --light-blue-text: #c4b5fd;
  --accent-blue: #a78bfa;
  --bg-dark: #e5e7eb;
  --footer-nav-bg: #f3f4f6;
  --footer-bottom-bg: #eaecee;
  --footer-border: #e2e4e7;
  --footer-section-bg: #f3f4f6;
  --text-primary: #1a1a1a;
  --text-secondary: #6b7280;
  --card-header-bg: #f3f4f6;
  --item-bg: #f3f4f6;
  --item-hover-bg: #ffffff;
  --primary-color: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-shadow: rgba(124, 58, 237, 0.25);
  --info-text: #5b21b6;
  --info-bg: #f5f0ff;
  --info-border: #e9d5ff;
  --shadow-color: rgba(0, 0, 0, 0.06);
  --button-disabled-bg: rgba(124, 58, 237, 0.07);
  --button-disabled-border: rgba(124, 58, 237, 0.15);
  --button-disabled-text: rgba(26, 26, 26, 0.4);
  --button-disabled-shadow: none;
}

body.theme-light::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/assets/img/contour-pattern-bg.svg') repeat;
  filter: invert(1) sepia(0.2) hue-rotate(310deg) saturate(0.9);
  mix-blend-mode: multiply;
  opacity: 0.22;
  pointer-events: none;
  z-index: -1;
}

/* Global Resets & Layout */
* {
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  background: var(--bg-gradient);
  color: var(--text-color);
  line-height: 1.6;
  padding: 0;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--container-bg);
  border-radius: 0 0 var(--radius-large) var(--radius-large);
  padding: 20px;
  padding-top: 20px;
  padding-left: 20px;
  padding-right: 20px;
  box-shadow: var(--shadow-strong);
  border-top: none;
}

.container.container-90 {
  max-width: 90%;
  width: 90%;
}

.container.container-70 {
  max-width: 70%;
  width: 70%;
}

.container.container-1200 {
  max-width: 1200px;
}

.container.container-fullwidth {
  max-width: 100%;
  width: 100%;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.container .card,
.container pre,
.container code {
  border-radius: var(--radius-large);
}

h1 {
  font-size: 42px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 16px 0;
  color: var(--heading-color);
}
h2 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 40px 0 12px 0;
  color: var(--heading-color);
  border: none;
  padding: 0;
}

/* Shared section heading style for project content blocks */
h2.base-section-title {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 8px 0;
  color: var(--heading-color);
  text-align: center;
  border: none;
  padding: 0;
}

@media (max-width: 768px) {
  h2.base-section-title {
    font-size: 24px;
  }
}

/* Hero product title: "BrandName - tagline" pattern */
h1.base-hero-title {
  font-size: 40px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.4px;
  color: var(--text-color);
  margin: 0 0 12px 0;
}

.base-hero-title-brand {
  font-weight: 800;
  letter-spacing: -0.3px;
  background: linear-gradient(120deg, #c084fc 0%, #a855f7 50%, #9333ea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.theme-light .base-hero-title-brand {
  background: linear-gradient(120deg, #c084fc 0%, #a855f7 50%, #9333ea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@media (max-width: 768px) {
  h1.base-hero-title {
    font-size: 30px;
  }
}

@media (max-width: 480px) {
  h1.base-hero-title {
    font-size: 26px;
  }
}

h3 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 28px 0 10px 0;
  color: var(--heading-color);
}
h4 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.3;
  margin: 20px 0 8px 0;
  color: var(--heading-color);
}
h5 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.4;
  margin: 16px 0 6px 0;
  color: var(--heading-color);
}
h6 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1.5;
  margin: 14px 0 6px 0;
  color: var(--muted-text);
}
p {
  margin-bottom: 15px;
  color: var(--muted-text);
}

.button:disabled,
.button[disabled],
button:disabled,
button[disabled] {
  background: var(--button-disabled-bg) !important;
  border-color: var(--button-disabled-border) !important;
  color: var(--button-disabled-text) !important;
  box-shadow: var(--button-disabled-shadow);
  cursor: not-allowed;
  opacity: 1;
  pointer-events: none;
  transform: none;
  filter: saturate(0.7);
}

.button:disabled::before,
.button[disabled]::before,
button:disabled::before,
button[disabled]::before {
  display: none;
}

.button:disabled:hover,
.button[disabled]:hover,
button:disabled:hover,
button[disabled]:hover,
.button:disabled:active,
.button[disabled]:active,
button:disabled:active,
button[disabled]:active {
  background: var(--button-disabled-bg);
  border-color: var(--button-disabled-border);
  color: var(--button-disabled-text);
  box-shadow: var(--button-disabled-shadow);
  transform: none;
}

/* Lists */
ul,
ol {
  margin: 15px 0 15px 25px;
  color: var(--muted-text);
}
li {
  margin-bottom: 8px;
}
ul {
  list-style-type: disc;
}

/* Code blocks */
code,
pre {
  font-family: 'Courier New', 'Monaco', monospace;
  background: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-medium);
  padding: 2px 6px;
  font-size: 0.9em;
}
pre {
  padding: 15px;
  margin: 15px 0;
  overflow-x: auto;
  border-radius: var(--radius-medium);
}
body.theme-dark pre code {
  color: #81c784;
  background: transparent;
  border: none;
}
body.theme-light pre code {
  color: #2d8659;
  background: transparent;
  border: none;
}

/* Blockquote with icon support */
blockquote {
  border-left: 4px solid var(--blockquote);
  padding-left: 24px;
  margin: 20px 0;
  font-style: italic;
  color: var(--muted-text);
  position: relative;
  border-radius: 0 var(--radius-medium) var(--radius-medium) 0;
  background: rgba(37, 99, 235, 0.05);
  padding: 16px 24px;
}
blockquote::before {
  content: '';
  color: var(--blockquote);
  position: absolute;
  left: 8px;
  top: 8px;
  width: 1.2em;
  height: 1.2em;
  background-color: currentColor;
  -webkit-mask-image: var(--fa-solid-quote-left);
  mask-image: var(--fa-solid-quote-left);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  opacity: 0.3;
}
body.theme-light blockquote {
  background: rgba(37, 99, 235, 0.03);
}

hr {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 30px 0;
}

/* Grid utility for non-Skeleton sections */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin: 20px 0;
}

main {
  flex: 1;
}

@media (max-width: 750px) {
  .container {
    max-width: 100% !important;
    width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    padding-top: 20px;
    padding-bottom: 20px;
  }
}

.row:has(.six.columns) {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-left: 0;
  margin-right: 0;
}

.row:has(.six.columns) .six.columns {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  margin-bottom: 0 !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
  float: none !important;
}

.row:has(.six.columns) .six.columns .card {
  margin: 0 !important;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.row:has(.six.columns) .six.columns .card h5 {
  margin-top: 0;
  margin-bottom: 12px;
}

.row:has(.six.columns) .six.columns .card p {
  margin-bottom: 0;
  flex: 1;
}

/* Blog card links - remove outline/border and add hover effect */
.card > a {
  outline: none;
  border: none;
  display: block;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.card > a:focus {
  outline: none;
  border: none;
}

/* Add blue bottom border to clickable cards on hover using box-shadow */
.card:has(> a) {
  box-shadow: inset 0 -1px 0 0 transparent;
  transition:
    box-shadow 0.3s ease,
    transform 0.2s ease;
}

.card:has(> a):hover {
  box-shadow:
    inset 0 -1px 0 0 var(--link),
    0 8px 24px rgba(0, 0, 0, 0.15);
}

/* Highlight bottom border on hover for tool-card links */
a.tool-card {
  transition:
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.2s ease;
}

a.tool-card:hover {
  border-bottom-color: var(--link) !important;
}

.card:has(> a):hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  cursor: pointer;
}

.card > a:hover {
  cursor: pointer;
}

/* Responsive: stack cards on mobile */
@media (max-width: 768px) {
  .row:has(.six.columns) {
    grid-template-columns: 1fr;
  }
}

/* Theme switcher styles moved to assets/css/theme_switcher.css */

/* Remove default focus outlines and dotted borders from links */
*:focus {
  outline: none !important;
}

a {
  border-bottom: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
