/* =========================================================
   Breakpoints (matching w3.css):
     Phone:   up to 600px
     Tablet:  601px – 992px
     Desktop: 993px and up
   ========================================================= */

* { box-sizing: border-box; }

body, h1, h2, h3, h4, h5, h6 {
  font-family: "Newsreader", serif;
}

.section-divider {
  width: 400px;
  max-width: 100%;
  margin: 60px 0;
}

body { font-size: 17px; }

/* Headings never justified; balance line lengths when they wrap */
h1, h2, h3, h4, h5, h6 {
  text-align: left;
  text-wrap: balance;
}

/* =========================================================
   CALENDAR DATE
   ========================================================= */

.calendar-date {
  display: grid;
  grid-template-rows: repeat(4, auto);
  width: 160px;
  background: #f5f5f5;
  color: #222;
  border-radius: 8px;
  overflow: hidden;
  text-align: center;
  justify-self: end;
  align-self: center;
}

.calendar-day {
  background: #336600;
  color: #fff;
  font-size: 20px;
  font-weight: bold;
  padding: 8px;
}

.calendar-number {
  font-size: 64px;
  font-weight: bold;
  line-height: 1.2;
  padding-top: 8px;
}

.calendar-number sup {
  font-size: 24px;
  vertical-align: super;
}

.calendar-month {
  font-size: 22px;
  font-weight: bold;
  color: #336600;
  padding-bottom: 4px;
}

.calendar-time {
  font-size: 18px;
  font-weight: bold;
  color: #222;
  text-align: center;
  line-height: 1.2;
  padding: 0 8px 12px;
}

.calendar-datetime {
  font-weight: bold;
}

/* =========================================================
   CALENDAR EVENTS
   ========================================================= */

.calendar-event {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  align-items: center;
  gap: 24px;
  padding: 20px 0;
}

.calendar-details {
  text-align: left;
}

.calendar-details p {
  margin: 8px 0;
  white-space: pre-line;
}

@media (max-width: 600px) {
  .calendar-event {
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-date {
    justify-self: center;
  }
}




/* Keep images from ever pushing wider than their container */
img { max-width: 100%; }

/* Allow long links and enlarged text to reflow. */
#main { min-width: 0; }
#main p a, #main li a { overflow-wrap: anywhere; }
#main input, #main textarea, #main select { max-width: 100%; }

.press-start-2p-regular {
  font-family: "Press Start 2P", system-ui;
  font-weight: 400;
  font-style: normal;
}

.svg-icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: currentColor;
  flex-shrink: 0;
}


/* =========================================================
   PHOTO GRID
   ========================================================= */

.photo-grid {
  column-count: 2;
  column-gap: 12px;
}

.photo-grid img {
  display: block;
  width: 100%;
  margin-bottom: 12px;
}


/* =========================================================
   SIDEBAR
   ========================================================= */

/* Keep the sidebar and content offset synchronized. */
:root {
  --sidebar-width: min(8rem, 35vw);
}

.w3-sidebar {
  width: var(--sidebar-width);
  background: #222;
}

#main {
  margin-left: var(--sidebar-width);
}

nav.w3-sidebar {
  display: flex;
  flex-direction: column;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
}

nav.w3-sidebar .w3-bar-item {
  flex: 1 0 auto;
  min-width: 0;
  min-height: 44px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(4px, 1vh, 12px) 8px !important;
  gap: clamp(3px, 0.8vh, 10px);
  white-space: normal;
  overflow-wrap: anywhere;
}

nav.w3-sidebar .w3-bar-item p {
  margin: 0;
  min-width: 0;
  max-width: 100%;
  font-size: 1rem;
  line-height: 1.25;
}

nav.w3-sidebar .svg-icon {
  font-size: clamp(1.25rem, 3.2vh, 2rem) !important;
}

nav.w3-sidebar img {
  height: clamp(32px, 10vh, 100px);
  width: auto;
  max-width: 100%;
  padding: 4px !important;
  object-fit: contain;
  flex-shrink: 0;
}

/* Compact spacing, not smaller text, on short desktop windows. */
@media (max-height: 750px) {
  nav.w3-sidebar .w3-bar-item {
    padding: 4px 6px !important;
    gap: 3px;
  }
  nav.w3-sidebar img { height: 40px; }
}

/* Let the menu scroll vertically rather than compressing labels. */
@media (max-height: 600px) {
  nav.w3-sidebar .w3-bar-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
  }
  nav.w3-sidebar .w3-bar-item p { flex: 1 1 0; }
  nav.w3-sidebar img { height: 28px; }
}


/* =========================================================
   HEADER
   ========================================================= */

.title-block {
  position: relative;
  isolation: isolate;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
}

h1.press-start-2p-regular {
  position: relative;
  z-index: 1;
  line-height: 1;
  margin-bottom: 0;
}

/* Full-width animation with overlaid rotating subtitle */
.title-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: end;
  position: relative;
  width: 100%;
  overflow: visible;
}

/* Compact animation with upward overlap and a soft left-edge fade. */
.title-bottom [data-rock-stacker] {
  position: relative;
  width: 100%;
  height: 80px;
  min-width: 0;
  overflow: visible !important;
  z-index: 5;
  pointer-events: none;
}

.title-bottom [data-rock-stacker] > svg {
  position: absolute;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible !important;
  /* Extend the fade mask beyond the SVG viewport so falling rocks
     can overlap the subtitle and the heading. */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 15%, black 100%);
  -webkit-mask-size: 100% 300%;
  mask-size: 100% 300%;
  -webkit-mask-position: left bottom;
  mask-position: left bottom;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-clip: no-clip;
  mask-clip: no-clip;
}

/* Hide only the ground line; the physics remain unchanged. */
.title-bottom [data-rock-stacker] > svg > path {
  stroke: none;
}

.rotator {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 12px;
  z-index: 1;
  width: 50%;
  min-width: 0;
  max-width: 100%;
  contain: inline-size;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
  margin: 0;
  font-size: 17px;
  transition: opacity .6s ease;
  font-variant-ligatures: none;
}

.rotator.fade {
  opacity: 0;
}

@media (prefers-reduced-motion: reduce) {
  .rotator {
    transition: none;
  }
}

/* =========================================================
   CALL TO ACTION
   ========================================================= */

#cta {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  background: #336600;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
  margin-top: 32px;
  margin-bottom: 32px;
}

#cta .cta-svg {
  width: 80%;
  height: auto;
  display: block;
  justify-self: end;
  align-self: center;
}


/* =========================================================
   PREVIOUS WORK
   ========================================================= */

#work {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 48px;
}

#work .cta {
  grid-column: 1 / -1;
  background: #336600;
  padding: 10px 20px;
  font-size: 16px;
  border-radius: 5px;
}

#work .div3 { grid-row-start: 3; }
#work .div4 { grid-row-start: 3; }
#work .div5 { grid-row-start: 4; }
#work .div6 { grid-row-start: 4; }

#work li {
  padding: 10px;
}


/* =========================================================
   LUNCH AND LEARN
   ========================================================= */

#learn {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto auto;
  gap: 8px 48px;
}

#learn .div1 {
  grid-column: 1 / -1;
}

#learn .div2 {
  grid-column: 1;
  grid-row-start: 2;
}

#learn .div4 {
  grid-column: 2 / span 2;
  grid-row-start: 2;
  min-width: 0;
}

#learn .div2 img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
}

#learn .learn-intro {
  margin: 0 0 16px;
  text-align: left;
}

#learn .calendar-event {
  padding-top: 0;
}

#learn .calendar-details h3 {
  margin-top: 0;
}


/* =========================================================
   SLIDESHOW
   ========================================================= */

.slideshow-container {
  --slides-per-view: 3;
  max-width: 900px;
  position: relative;
  margin: auto;
  overflow: hidden;
}

/* The row of slides that moves */
.slides-track {
  display: flex;
  transition: transform 0.6s ease;
}

/* Each slide takes 1/--slides-per-view of the width */
.mySlides {
  flex: 0 0 calc(100% / var(--slides-per-view));
  position: relative;
  padding: 0 4px;
}

.mySlides img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #222;
  object-position: top;
  border-radius: 5px;
}

/* Next and previous buttons */
.prev, .next {
  cursor: pointer;
  position: absolute;
  top: 50%;
  margin-top: -22px;
  padding: 16px;
  color: white;
  font-weight: bold;
  font-size: 18px;
  transition: 0.6s ease;
  border-radius: 0 3px 3px 0;
  user-select: none;
  z-index: 1;
}

.next {
  right: 0;
  border-radius: 3px 0 0 3px;
}

.prev:hover, .next:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

/* Slide captions */
.text {
  color: #000;
  font-size: 15px;
  padding: 8px 12px;
  position: absolute;
  bottom: 8px;
  left: 4px;
  right: 4px;
  text-align: center;
  background: #fff;
  text-wrap: balance;
}

/* Slideshow navigation dots */
.dot {
  cursor: pointer;
  height: 15px;
  width: 15px;
  margin: 0 2px;
  background-color: #bbb;
  border-radius: 50%;
  display: inline-block;
  transition: background-color 0.6s ease;
}

.dot.active, .dot:hover {
  background-color: #717171;
}


/* =========================================================
   SURVEY
   ========================================================= */

.ws.ws {
  --ws-accent: #336600;
}

#survey {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 48px;
}


/* =========================================================
   SERVICES
   ========================================================= */

#services .services {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(6, auto);
  grid-auto-flow: column;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.w3-section p {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* =========================================================
   CONTACT FORM STATUS
   ========================================================= */

.contact-success,
.contact-error {
  padding: 12px 16px;
  margin-top: 16px;
  border-radius: 4px;
  color: #f5f5f5;
}

.contact-success {
  background: #336600;
}

.contact-error {
  background: #992222;
}

#contact-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.contact-honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}


/* =========================================================
   TABLET (601px – 992px)
   ========================================================= */

@media only screen and (max-width: 992px) {

/* Lunch and Learn: stack on tablets */
#learn {
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#learn .div1,
#learn .div2,
#learn .div4 {
  grid-column: 1 / -1;
  grid-row-start: auto;
}

  #work {
    gap: 8px 32px;
  }

}


/* =========================================================
   PHONE (up to 600px)
   ========================================================= */

@media only screen and (max-width: 600px) {

  /* -------------------------------------------------------
     MOBILE HEADER
     ------------------------------------------------------- */

  /* Header: one word per line */
  h1.press-start-2p-regular {
    width: min-content;
    font-size: min(13vw, 4rem) !important;
    line-height: 1.15;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: none;
  }

  /* Keep the subtitle over the animation on phones */
  .title-bottom {
    grid-template-columns: 1fr;
  }

  .title-bottom [data-rock-stacker] > svg {
    -webkit-mask-size: 100% 300%;
    mask-size: 100% 300%;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 15%, black 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 15%, black 100%);
  }

  .rotator {
    text-align: right !important;
    font-size: 12px;
    bottom: 5px;
  }


  /* -------------------------------------------------------
     MOBILE PHOTO GRID
     ------------------------------------------------------- */

  .photo-grid {
    column-count: 1;
  }


  /* -------------------------------------------------------
     MOBILE PREVIOUS WORK
     ------------------------------------------------------- */

  /* One column, with fixed row assignments removed */
  #work {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  #work .div3,
  #work .div4,
  #work .div5,
  #work .div6 {
    grid-row-start: auto;
  }

  #work li {
    padding: 6px 0;
  }


  /* -------------------------------------------------------
     MOBILE LUNCH AND LEARN
     ------------------------------------------------------- */

  /* One column, everything stacked in order */
  #learn {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }

  #learn .div1,
  #learn .div2,
  #learn .div3,
  #learn .div4 {
    grid-column: auto;
    grid-row-start: auto;
  }

  #learn li {
    padding: 6px 0;
  }

  /* -------------------------------------------------------
     MOBILE SLIDESHOW
     ------------------------------------------------------- */

  /* Place captions below images */
  .mySlides {
    display: flex;
    flex-direction: column;
  }

  .text {
    position: static;
    flex: 1;
    font-size: 12px;
    line-height: 1.3;
    padding: 6px 4px;
  }

  .dot {
    height: 18px;
    width: 18px;
    margin: 0 5px;
  }

  /* To show one slide at a time on phones, uncomment below.
     Only do this once the slideshow JavaScript reads
     --slides-per-view. */

  /* .slideshow-container {
    --slides-per-view: 1;
  } */


  /* -------------------------------------------------------
     MOBILE SURVEY
     ------------------------------------------------------- */

  #survey {
    grid-template-columns: minmax(0, 1fr);
  }


  /* -------------------------------------------------------
     MOBILE SERVICES
     ------------------------------------------------------- */

  #services .services {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-auto-flow: row;
  }


/* -------------------------------------------------------
   MOBILE CALL TO ACTION
   ------------------------------------------------------- */

#cta {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 12px;
  padding: 24px 20px;
}

#cta .cta-svg {
  grid-column: 1;
  grid-row: 1;
  width: 80px;
  height: auto;
  justify-self: center;
  align-self: center;
}

#cta .cta-text {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
}

#cta .cta-text p {
  text-align: left;
}


#cta .cta-text h3 {
  text-align: left !important;
  text-wrap: wrap;
}

/* Bullet the first three headings */
#cta .cta-text h3:nth-of-type(-n+3) {
  position: relative;
  padding-left: 22px;
}

#cta .cta-text h3:nth-of-type(-n+3)::before {
  content: "•";
  position: absolute;
  left: 0;
  font-weight: bold;
}

}


/* =========================================================
   SIMPLIFY ANIMATION
   ========================================================= */

@media (prefers-reduced-motion: no-preference) {

  [data-simplify][data-simplify-hide-initial]:not([data-simplify-hide-initial="false"]):not([data-simplify-revealed]) {
    opacity: 0 !important;
  }

}

/* Add after existing title/rotator rules. Adjust the breakpoint if needed. */
@media (max-width: 600px) {
  .title-bottom .rotator {
    min-width: 0;
    max-width: 100%;
    font-size: clamp(10px, 3.5vw, 18px);
    line-height: 1.2;
    letter-spacing: normal;
    white-space: normal;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
  }
}

/* =========================================================
   RESPONSIVE NAVIGATION / HIGH BROWSER ZOOM
   ========================================================= */

/* Use the top menu on phones, enlarged default fonts and short windows.
   The menu stays in normal document flow so its height is never assumed. */
@media (max-width: 600px), (max-width: 40em), (max-height: 450px) {
  nav.w3-sidebar {
    display: none !important;
  }

    #myNavbar {
        display: block !important;
        position: sticky !important;
        top: 0;
        z-index: 1000;
        width: 100%;
        max-width: 100%;
        max-height: 45vh;
        max-height: 45dvh;
        overflow-y: auto;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
    }

  #myNavbar .w3-flex {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr));
    width: 100%;
    min-width: 0;
  }

  #myNavbar .w3-button {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: initial !important;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 4px !important;
    font-size: 1rem !important;
    line-height: 1.3;
    white-space: normal !important;
    overflow-wrap: anywhere;
  }

  #main {
    margin-left: 0;
    padding-top: 0 !important;
  }

  html { scroll-padding-top: 0; }
}

/* =========================================================
   NARROW-SCREEN OVERFLOW PROTECTION
   ========================================================= */

.calendar-date { max-width: 100%; }
.calendar-details, .mySlides, #work > *, #learn > *,
#survey > *, #services .services > *, #cta > * { min-width: 0; }

/* Preserve whole-word title sizing and animation geometry. */
.title-block { overflow-wrap: normal; word-break: normal; }

/* Allow the menu to scroll away on very short screens
   or when browser zoom significantly reduces viewport height. */
@media (max-height: 450px) {
    #myNavbar {
        position: relative !important;
        max-height: none;
        overflow-y: visible;
    }
}