/* Supplementary rules on top of css/legacy/energon.css (the real, live
   stylesheet — see site.blade.php). Everything there is scoped under
   `body.tweak-*` classes computed by site.js, matching the site's own
   original "Tweaker" JS logic — these rules follow the same convention. */

/* #mainMenuPresenter is always in the DOM here (static Blade markup),
   unlike the original where the mobile-menu tweak's JS created it on
   the fly — so the hamburger button needs an explicit hide outside
   that tweak instead of simply not existing yet. */
body:not(.tweak-mobile-menu) #mainMenuPresenter .button {
  display: none;
}

/* Fix menu reading order on mobile without replicating the original's
   DOM-swapping JS: the desktop <li> order is DOM-reversed on purpose
   (ul#mainMenu li is float:right in energon.css, which un-reverses it
   visually) — stacked/column mode needs that undone again. */
body.tweak-mobile-menu #mainMenuPresenter #mainMenu {
  display: flex;
  flex-direction: column-reverse;
}

/* Extra "ENERGON" home link (see menu.blade.php) — desktop already has
   the logo for that, so it's mobile-only. The desktop selector below
   matches energon.css's `body.tweak-bootstrap-full ul#mainMenu li`
   specificity (which sets display:inline + float:right on every li,
   this one included) so our display:none actually wins the cascade —
   otherwise the extra item was rendered as an 8th tab and wrapped
   below the real menu row. */
#home-page-item {
  display: none;
}
body.tweak-bootstrap-full ul#mainMenu li#home-page-item {
  display: none;
}
body.tweak-mobile-menu #home-page-item {
  display: block;
}

/* energon.css assumes a pre-resized ~70x70 thumbnail file for desktop;
   we serve the original attachment (full resolution) under the same
   URL, so it needs constraining down here instead, plus a safety clip
   in case anything is still larger than expected. Scoped to desktop
   only — body.tweak-smallscreen-gallery in energon.css already handles
   the (deliberately larger, fluid) mobile sizing correctly. */
body.tweak-bootstrap-full #content div.projectBox {
  overflow: hidden;
}
body.tweak-bootstrap-full #content div.projectBox div.projectImage img {
  width: 70px;
  height: 70px;
  object-fit: cover;
}

/* lightbox — replaces the legacy site's two different jQuery gallery
   plugins (lightbox for portfolio/zoom images, thickbox for references)
   with one implementation for both. See public/js/site.js. */
.thumb-trigger {
  display: inline-block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
}
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.9);
  align-items: center;
  justify-content: center;
  padding: 48px;
  z-index: 1000;
}
.lightbox-overlay.is-open { display: flex; }
.lightbox-overlay img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.lightbox-close {
  position: absolute;
  top: 24px;
  right: 32px;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  border-radius: 2px;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.18); }

.hp-field { position: absolute; left: -9999px; }

/* Fix: energon.css's reset.css (Eric Meyer's, deliberately) never resets
   form controls, so #CommentAddForm's width:100% inputs/textarea keep
   their browser-default padding/border ADDED ON TOP of that 100% — the
   classic content-box overflow bug, present on both the original site
   and this port until now. box-sizing:border-box makes width:100%
   actually mean 100%, padding and border included. Also caps the map
   embed and any in-content image to the viewport it's given, since
   nothing in energon.css does that generally. */
#CommentAddForm input,
#CommentAddForm textarea,
#CommentAddForm select {
  box-sizing: border-box;
}
.google-maps-holder,
.google-maps-holder * {
  box-sizing: border-box;
  max-width: 100%;
}
#content img {
  max-width: 100%;
  height: auto;
}

/* Requested UX change: on mobile, stack each label above its field
   instead of the legacy's floated-right label + margin-reserved input
   (energon.css's body.tweak-smallscreen-commentform rules) — that
   pattern squeezed the input into whatever width was left after a
   120px label + 135px margin reservation, which is what was making
   the field look clipped/cut off on the left at narrow widths. Same
   selectors/specificity as the legacy rules, loaded after them, so no
   !important is needed — cascade order wins. */
body.tweak-smallscreen-commentform form#CommentAddForm div.input {
  display: block;
  margin-bottom: 15px;
}
body.tweak-smallscreen-commentform form#CommentAddForm label {
  float: none;
  clear: both;
  display: block;
  width: auto;
  margin-bottom: 6px;
  line-height: normal;
  text-align: left;
}
body.tweak-smallscreen-commentform form#CommentAddForm div.input div.input-wrap {
  float: none;
  width: 100%;
  margin-right: 0;
  margin-bottom: 0;
}
body.tweak-smallscreen-commentform form#CommentAddForm input[type="text"] {
  float: none;
  width: 100%;
}
body.tweak-smallscreen-commentform form#CommentAddForm input[type="submit"] {
  float: none;
}

/* optional stat tiles under a page title — no legacy equivalent, kept
   simple/inline so it doesn't fight the ported grid system */
.stat-tiles { margin-bottom: 20px; }
.stat-tile { margin-bottom: 10px; }
.stat-tile-value { font-weight: bold; font-size: 15px; }
.stat-tile-label { color: #555; font-size: 12px; }


/* Editable footer uses the same 975px breakpoint as site.js. */
body div#footer.editable-footer {
  height: auto;
  width: auto;
  float: none;
  clear: both;
  padding: 20px 0;
  margin: 0 30px;
  font-size: 11px;
  line-height: 1.5;
}
.footer-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 20px 16px;
  align-items: start;
}
.footer-layout--mobile { display: none; }
.footer-section { min-width: 0; overflow-wrap: anywhere; }
.footer-span-1 { grid-column: span 1; }
.footer-span-2 { grid-column: span 2; }
.footer-span-3 { grid-column: span 3; }
.footer-span-4 { grid-column: span 4; }
.footer-span-5 { grid-column: span 5; }
.footer-span-6 { grid-column: span 6; }
.footer-span-7 { grid-column: span 7; }
.footer-span-8 { grid-column: span 8; }
.footer-span-9 { grid-column: span 9; }
.footer-span-10 { grid-column: span 10; }
.footer-span-11 { grid-column: span 11; }
.footer-span-12 { grid-column: span 12; }
.footer-align-left { text-align: left; }
.footer-align-center { text-align: center; }
.footer-align-right { text-align: right; }
#footer .footer-image { display: inline-block; max-width: 100%; height: auto; margin-bottom: 8px; }
#footer .footer-text p { margin: 0 0 6px; }
#footer .footer-text ul, #footer .footer-text ol { padding-left: 20px; margin: 0 0 6px; }
#footer .footer-text ul { list-style: disc; }
#footer .footer-text ol { list-style: decimal; }
@media (max-width: 975px) {
  .footer-layout--desktop { display: none; }
  .footer-layout--mobile { display: grid; }
}


/* One shared desktop page, two mobile views, as in legacy separate-about.
   The classes live inside #content so PJAX also replaces the selected view. */
.mobile-about-title { display: none; }
@media (max-width: 975px) {
  #content .mobile-about-hidden { display: none; }
  #content .mobile-about-title { display: block; margin-top: 30px; }
}
