/* Base16 Moss Color Scheme */
:root {
  /* Base colors */
  --bg: #0d0f0f;       /* base00 - background */
  --bg1: #161a19;      /* base01 - lighter bg */
  --bg2: #1e2625;      /* base02 - selection bg */
  --comment: #5a6a5a;  /* base03 - comments */
  --fg-dark: #8a9a8a;  /* base04 - dark fg */
  --fg: #b0c0b0;       /* base05 - default fg */
  --fg1: #c5d5c5;      /* base06 - light fg */
  --fg2: #daeada;      /* base07 - lightest fg */

  /* Accent colors */
  --red: #c07070;      /* base08 - errors */
  --orange: #d4a067;   /* base09 - numbers */
  --yellow: #b5c06a;   /* base0A - classes */
  --green: #7fb080;    /* base0B - strings */
  --cyan: #6aacac;     /* base0C - regex */
  --blue: #70a0b0;     /* base0D - functions */
  --purple: #a08aad;   /* base0E - keywords */
  --brown: #c08070;    /* base0F - deprecated */

  /* Semantic aliases (for backwards compatibility) */
  --foreground: var(--fg);
  --background: var(--bg);
  --cursor-color: var(--fg);

  --black: var(--bg);
  --dark-grey: var(--bg1);

  --light-red: #d08080;
  --light-green: #8fc090;
  --light-yellow: #c5d07a;
  --light-blue: #80b0c0;
  --magenta: var(--purple);
  --light-magenta: #b09abd;
  --light-cyan: #7abcbc;
  --white: var(--fg2);
  --light-white: var(--fg2);

  --border: var(--bg2);
  --highlight-border: var(--cyan);
  --accent: var(--cyan);
}

html {
  font-size: 14px;
  color: var(--foreground);
  background-color: var(--background);
}

/* Custom selection color */
::selection {
  background-color: var(--cyan);
  color: var(--bg);
}

::-moz-selection {
  background-color: var(--cyan);
  color: var(--bg);
}

.dark-grey {
  background-color: var(--black);
  color: var(--white);
}

.hack h1 {
  font-size: 1.5rem;
  font-style: normal;
  font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
    Bitstream Vera Sans Mono, Courier New, monospace, serif;
}

a {
  cursor: pointer;
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid var(--bg2);
  transition: all 0.2s ease;
}

a:hover {
  color: var(--fg2);
  border-bottom-color: var(--cyan);
  background-color: transparent;
}

.code-highlight {
  border: 1px solid var(--border) !important;
  padding: 1em !important;
}

/* Inline code */
code:not([class]) {
  background-color: var(--bg1);
  color: var(--cyan);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

/* Horizontal rule */
hr {
  border: none;
  border-top: 1px solid var(--bg2);
  margin: 2em 0;
}

/* Article metadata */
article small {
  display: block;
  color: var(--comment);
  margin-bottom: 1.5em;
  padding-bottom: 1em;
  border-bottom: 1px solid var(--bg2);
}

/* Tags */
article code:not([class]) {
  background-color: var(--bg2);
  color: var(--fg-dark);
  font-size: 0.8em;
}

.logo {
  color: var(--white);
  border: none;
  font-size: 1.2em;
}

.logo::after {
  content: "|";
  -webkit-animation: cursor 1s infinite;
  animation: cursor 1s infinite;
}

.hidden-input {
  border: none;
  background: transparent;
  color: var(--white);
  caret-color: transparent;
  font-size: 1em;
  position: relative;
}

.hidden-input:focus {
  outline: none;
}

@-webkit-keyframes cursor {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes cursor {
  0% {
    opacity: 0;
  }

  50% {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

.container {
  max-width: 50rem;
}

.yt-video-container {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  max-width: 100%;
  max-height: 500px;
  margin: 0 auto 1.5em auto;
  border: 1px solid var(--border) !important;
}


.video-container {
  display: block;
  max-width: 100%;
  max-height: 500px;
  margin: 0 auto 1.5em auto;
  border: 1px solid var(--border) !important;
}

.yt-video-container iframe,
.yt-video-container object,
.yt-video-container embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

article img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  margin: 0 auto 1.5em auto;
  border: 1px solid var(--border) !important;
}

#wcb.carbonbadge {
  font-size: 11px !important;
  text-align: left !important;
  color: var(--black) !important;
}

#wcb_g {
  font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
    Bitstream Vera Sans Mono, Courier New, monospace, serif !important;
  color: var(--black) !important;
}

#wcb_a {
  color: var(--black) !important;
  font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono,
    Bitstream Vera Sans Mono, Courier New, monospace, serif !important;
}

#wcb.wcb-d #wcb_a {
  background: var(--highlight-border) !important;
  border-color: var(--highlight-border) !important;
}

#wcb_g {
  border: 0.13em solid var(--highlight-border) !important;
}

/* Footer navigation */
footer nav {
  text-align: center;
  padding: 1em 0;
}

footer nav a {
  color: var(--fg-dark);
  border-bottom: none;
}

footer nav a:hover {
  color: var(--cyan);
}

/* Terminal button */
.termx-open {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--bg1) !important;
  border: 1px solid var(--bg2) !important;
  color: var(--cyan) !important;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.termx-open:hover {
  opacity: 1;
  border-color: var(--cyan) !important;
}

#termx {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  z-index: 1000;
  height: 350px;
  background: var(--black);
  overflow-y: auto;
}

.resize-notch {
  width: 60px;
  height: 4px;
  background-color: var(--comment);
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
  border-radius: 4px;
  margin: 8px;
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.resize-notch:hover {
  opacity: 1;
}

.cloud-shell-title {
  margin: 0 !important;
  text-align: left;
}

#termx .card-header {
  padding-left: 30px;
  padding-right: 30px;
  position: fixed;
  width: 100%;
  background: var(--black);
}

#termx .card-content {
  padding-left: 30px;
  padding-right: 30px;
  margin-top: 40px;
}

#termx-results {
  white-space: pre-wrap;
  margin-top: 10px;
}

#termx .user {
  color: var(--green);
  font-weight: bold;
}

#termx .path {
  margin-right: 5px;
  margin-left: 5px;
  color: var(--blue);
}

#terminal-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--white); /* Text color */
  font-family: inherit;
  font-size: inherit;
  margin-right: 5px;
}

.exec {
  flex-wrap: wrap;
  display: flex;
  margin-bottom: 10px;
}

.exec .cmd {
  white-space: pre-wrap;
  flex-basis: 100%;
}

.exec .result {
  flex-basis: 100%;
}


/* Carousel styles */
.main-carousel {
  margin-bottom: 1.5em;
}

.carousel-cell {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-cell img {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 500px;
  object-fit: contain;
  border: 1px solid var(--border);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.carousel-cell img.flickity-lazyloaded,
.carousel-cell img.flickity-lazyerror {
  opacity: 1;
}

/* Loading placeholder */
.carousel-cell img:not(.flickity-lazyloaded):not(.flickity-lazyerror) {
  background-color: var(--bg1);
  min-width: 300px;
  min-height: 200px;
}

.flickity-enabled:focus .flickity-viewport {
  outline: none;
}

/* Flickity navigation arrows */
.flickity-button {
  background: var(--bg1) !important;
  color: var(--fg) !important;
  transition: all 0.2s ease;
}

.flickity-button:hover {
  background: var(--bg2) !important;
  color: var(--cyan) !important;
}

.flickity-button:disabled {
  opacity: 0.3;
}

.flickity-prev-next-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.flickity-prev-next-button .flickity-button-icon {
  fill: currentColor;
}

.card {
  margin-bottom: 20px;
  padding: 0.4em;
}

/* Tables */
article table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: nowrap;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
}

th, td {
  padding: 0.75em;
  text-align: left;
  border-bottom: 1px solid var(--bg2);
}

th {
  color: var(--fg1);
  border-bottom: 2px solid var(--comment);
}

tr:hover {
  background-color: var(--bg1);
}

/* Paragraph spacing */
p {
  line-height: 1.7;
  margin-bottom: 1em;
}

/* Focus states for accessibility */
a:focus,
button:focus,
input:focus {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* Export as PDF button */
.btn-export-pdf {
  display: inline-block;
  font-size: 0.75em;
  padding: 0.1em 0.4em;
  margin-left: 0.5em;
  vertical-align: middle;
  cursor: pointer;
  color: inherit;
  border: none;
  background: transparent;
  transition: color 0.2s ease;
}

.btn-export-pdf:hover {
  color: var(--cyan);
}

.btn-export-pdf i {
  margin-right: 0.2em;
}

/* Print styles for PDF export */
@media print {
  /* Reset to light theme for readable PDFs */
  :root {
    --bg: #ffffff;
    --bg1: #f5f5f5;
    --bg2: #e0e0e0;
    --comment: #666666;
    --fg-dark: #444444;
    --fg: #222222;
    --fg1: #111111;
    --fg2: #000000;
    --red: #c04040;
    --orange: #b07020;
    --yellow: #808020;
    --green: #207040;
    --cyan: #106060;
    --blue: #205080;
    --purple: #604080;
    --brown: #804030;
    --border: #cccccc;
  }

  html {
    font-size: 12pt;
    color: #222;
    background: #fff;
  }

  body {
    background: #fff !important;
    color: #222 !important;
  }

  /* Hide non-content elements */
  .progress,
  .termx-open,
  #termx,
  header,
  footer,
  .btn-export-pdf,
  .cf-turnstile,
  .flickity-button,
  .flickity-page-dots {
    display: none !important;
  }

  /* Container full width */
  .container {
    max-width: 100%;
    margin: 0;
    padding: 0;
  }

  /* Article styling */
  article {
    margin: 0;
    padding: 0;
  }

  article h1 {
    font-size: 22pt;
    color: #000;
    margin-bottom: 0.3em;
    page-break-after: avoid;
  }

  article small {
    color: #555;
    border-bottom-color: #ccc;
  }

  article img {
    max-width: 100%;
    max-height: none;
    border: 1px solid #ccc !important;
    page-break-inside: avoid;
  }

  /* Typography */
  h1, h2, h3, h4, h5, h6 {
    color: #000;
    page-break-after: avoid;
    page-break-inside: avoid;
  }

  p, li, td, th {
    color: #222;
    orphans: 3;
    widows: 3;
  }

  a {
    color: #205080;
    text-decoration: underline;
    border-bottom: none;
  }

  /* Show link URLs in print */
  article a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
    word-break: break-all;
  }

  /* Don't show URL for image links or anchor links */
  article a[href^="#"]::after,
  article a:has(img)::after {
    content: none;
  }

  /* Code blocks */
  pre, .code-highlight {
    background: #f5f5f5 !important;
    border: 1px solid #ddd !important;
    page-break-inside: avoid;
    font-size: 9pt;
    overflow-x: visible;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  code:not([class]) {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
  }

  /* Tables */
  table {
    border-collapse: collapse;
    page-break-inside: avoid;
  }

  th {
    background: #f0f0f0;
    color: #000;
  }

  th, td {
    border: 1px solid #ccc;
    padding: 0.5em;
  }

  /* Images in carousels - show all */
  .main-carousel .carousel-cell {
    display: block !important;
    width: 100% !important;
    position: static !important;
    transform: none !important;
  }

  .carousel-cell img {
    opacity: 1 !important;
    border: 1px solid #ccc;
    margin-bottom: 1em;
  }

  /* YouTube embeds - show placeholder */
  .yt-video-container {
    border: 1px solid #ccc;
    padding: 2em;
    text-align: center;
    height: auto;
    padding-bottom: 0;
  }

  .yt-video-container iframe {
    display: none;
  }

  .yt-video-container::after {
    content: "[Video embed - visit the web version to watch]";
    color: #666;
    font-style: italic;
  }

  /* Page breaks */
  hr {
    page-break-after: avoid;
    border-top: 1px solid #ccc;
  }

  /* Alert boxes */
  .alert {
    border: 1px solid #ccc !important;
    background: #f9f9f9 !important;
    color: #222 !important;
  }

  /* Details/summary */
  details {
    border: 1px solid #ccc;
    padding: 0.5em;
    page-break-inside: avoid;
  }

  /* Tags at bottom */
  article + hr + p code:not([class]) {
    background: #eee;
    color: #444;
  }

  /* Page margins */
  @page {
    margin: 2cm;
    size: A4;
  }

  /* First page - no top margin for title */
  @page :first {
    margin-top: 1.5cm;
  }
}

