/* Coder theme (anytime; terminal green accent).
   Loaded only while the theme is on: <html data-festive="coder"> in base.html.
   Switched from Admin Insights -> Manage Themes (site_themes app). The navy
   background, text colours and the gold site name stay as they are. */

/* ---- Accent: olive drab replaces cinnamon ----
   #6B8E23 is the darkest olive that still reads as text on the navy background
   (#556B2F was too dim for text). Links use a lighter tint of it. */
:root[data-theme][data-festive="coder"] {
  --clr-accent: #6B8E23;       --clr-accent-rgb: 107, 142, 35;
  --clr-accent-hover: #8DB043; --clr-accent-hover-rgb: 141, 176, 67;
  --clr-on-accent: #0F1A05;
  --clr-link: #A3BE6A;
  --clr-link-hover: #C2D894;
}

/* ---- Greeting: "// happy coding" after the time-of-day greeting ---- */
:root[data-festive="coder"] #sidebar-greeting:not(:empty)::after,
:root[data-festive="coder"] #mobile-greeting:not(:empty)::after {
  content: "  // happy coding";
  color: #A3BE6A;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-style: normal;
  font-weight: 600;
  white-space: pre;
}

/* ---- Decoration layer (binary ticker, neon sign) ---- */
.fx-coder {
  position: relative;
  height: 0;              /* takes no space: the page layout is untouched */
  z-index: 50;
  pointer-events: none;
}

/* A slow line of binary under the ticker (it spells "Hello, World! Happy coding.") */
.fx-binary {
  position: absolute;
  top: 5px; left: 0; right: 0;
  overflow: hidden;
  white-space: nowrap;
  font: 11px/1 ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  color: rgba(163, 190, 106, .42);
}
.fx-binary span {
  display: inline-block;
  padding-right: 2em;
  animation: fx-marquee 140s linear infinite;
}
@keyframes fx-marquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }

/* Neon </> sign, top right. Sized to fit the 40px strip right of the page content,
   so it never covers search boxes or buttons in page headers. */
.fx-neon {
  position: absolute;
  top: 0;
  right: 5px;
  width: 32px;
  height: auto;
  transform-origin: 50% 0;
  animation: fx-swing 6s ease-in-out infinite;
}
@keyframes fx-swing { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.fx-neon-text { filter: drop-shadow(0 0 2px #A3BE6A) drop-shadow(0 0 5px rgba(163, 190, 106, .7)); animation: fx-flicker 7s linear infinite; }
@keyframes fx-flicker {
  0%, 18%, 20%, 54%, 56%, 100% { opacity: 1; }
  19%, 55% { opacity: .35; }
}

/* ---- Behind the page: falling code ----
   z-index -1 keeps it under cards, sidebar and text: it only shows in empty space. */
.fx-night {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.fx-rain span {
  position: absolute;
  top: 0;
  width: 1ch;
  word-break: break-all;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  line-height: 1.2;
  color: #A3BE6A;
  text-shadow: 0 0 6px rgba(163, 190, 106, .6);
  -webkit-mask-image: linear-gradient(transparent, #000 75%);
          mask-image: linear-gradient(transparent, #000 75%);
  transform: translateY(-100%);
  animation: fx-rain 13s linear infinite;
  will-change: transform;
}
@keyframes fx-rain { from { transform: translateY(-100%); } to { transform: translateY(100vh); } }
.fx-rain span:nth-child(1) { left: 3.0%; opacity: 0.26; font-size: 12px; animation-duration: 12.4s; animation-delay: -1.7s; }
.fx-rain span:nth-child(2) { left: 8.9%; opacity: 0.19; font-size: 12px; animation-duration: 13.2s; animation-delay: -8.0s; }
.fx-rain span:nth-child(3) { left: 16.3%; opacity: 0.27; font-size: 15px; animation-duration: 10.5s; animation-delay: -9.9s; }
.fx-rain span:nth-child(4) { left: 20.8%; opacity: 0.21; font-size: 12px; animation-duration: 11.1s; animation-delay: -1.2s; }
.fx-rain span:nth-child(5) { left: 28.9%; opacity: 0.15; font-size: 14px; animation-duration: 12.5s; animation-delay: -9.3s; }
.fx-rain span:nth-child(6) { left: 33.5%; opacity: 0.26; font-size: 14px; animation-duration: 11.0s; animation-delay: -8.7s; }
.fx-rain span:nth-child(7) { left: 41.9%; opacity: 0.15; font-size: 12px; animation-duration: 12.6s; animation-delay: -4.3s; }
.fx-rain span:nth-child(8) { left: 48.0%; opacity: 0.21; font-size: 12px; animation-duration: 9.5s; animation-delay: -3.6s; }
.fx-rain span:nth-child(9) { left: 52.3%; opacity: 0.27; font-size: 12px; animation-duration: 15.6s; animation-delay: -13.3s; }
.fx-rain span:nth-child(10) { left: 58.2%; opacity: 0.17; font-size: 12px; animation-duration: 14.2s; animation-delay: -12.7s; }
.fx-rain span:nth-child(11) { left: 66.8%; opacity: 0.21; font-size: 15px; animation-duration: 10.2s; animation-delay: -9.4s; }
.fx-rain span:nth-child(12) { left: 72.0%; opacity: 0.17; font-size: 12px; animation-duration: 10.8s; animation-delay: -0.7s; }
.fx-rain span:nth-child(13) { left: 78.7%; opacity: 0.24; font-size: 12px; animation-duration: 10.3s; animation-delay: -9.7s; }
.fx-rain span:nth-child(14) { left: 83.0%; opacity: 0.16; font-size: 14px; animation-duration: 14.0s; animation-delay: -8.5s; }
.fx-rain span:nth-child(15) { left: 91.3%; opacity: 0.26; font-size: 15px; animation-duration: 14.2s; animation-delay: -0.5s; }
.fx-rain span:nth-child(16) { left: 98.2%; opacity: 0.15; font-size: 14px; animation-duration: 11.1s; animation-delay: -6.8s; }

/* Cards get their colour from `.content a` (white at 10% opacity), which would let
   the falling code show through. Same colour, made solid, while this theme is on.
   Hover keeps its own background. */
:root[data-festive="coder"] .content a.post-card:not(:hover),
:root[data-festive="coder"] .content a.related-card:not(:hover) {
  background-color: #25323F;
}

/* ---- Syntax-coloured code tokens in place of the line under page titles ---- */
:root[data-festive="coder"] .title-separator {
  height: 18px;
  background: url("coder-tokens.svg") repeat-x left center / 120px 18px;
}

/* ---- Laptop and coffee on top of the subscribe bar ---- */
:root[data-festive="coder"] .footer-subscribe-bar { position: relative; }
:root[data-festive="coder"] .footer-subscribe-bar::before {
  content: "";
  position: absolute;
  left: 24px;
  bottom: 100%;
  width: 150px;
  height: 90px;
  background: url("coder-laptop.svg") no-repeat center bottom / contain;
  pointer-events: none;
}

/* ---- Rubber debugging duck in the footer corner ---- */
:root[data-festive="coder"] .site-footer {
  background-image: url("coder-duck.svg");
  background-repeat: no-repeat;
  background-position: right 14px bottom 4px;
  background-size: 46px 55px;
}

/* ---- Tablets and phones ---- */
@media (max-width: 900px) {
  .fx-neon { width: 30px; right: 4px; }   /* clears the full-width mobile badge */
  /* No empty column above the subscribe bar here, so the laptop moves into the footer beside the duck */
  :root[data-festive="coder"] .footer-subscribe-bar::before { display: none; }
  :root[data-festive="coder"] .site-footer {
    background-image: url("coder-duck.svg"), url("coder-laptop.svg");
    background-position: right 10px bottom 4px, right 58px bottom 0;
    background-size: 46px 55px, 80px 48px;
  }
}
@media (max-width: 480px) {
  .fx-neon { width: 26px; right: 3px; }
  .fx-rain span:nth-child(2n) { display: none; }   /* fewer columns on small screens */
  :root[data-festive="coder"] .site-footer { background-position: right 8px bottom 4px, right 50px bottom 0; background-size: 42px 50px, 56px 34px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .fx-neon { width: 26px; }
}

/* ---- Visitors who turn on reduced motion: no falling code, nothing moving ---- */
@media (prefers-reduced-motion: reduce) {
  .fx-binary span, .fx-neon, .fx-neon-text { animation: none; }
  .fx-rain { display: none; }
  :root[data-festive="coder"] .footer-subscribe-bar::before { background-image: url("coder-laptop-still.svg"); }
}
@media (prefers-reduced-motion: reduce) and (max-width: 900px) {
  :root[data-festive="coder"] .site-footer { background-image: url("coder-duck.svg"), url("coder-laptop-still.svg"); }
}
