/* ==========================================================================
   Drip Castle in the Sand — site stylesheet
   Palette restored from the original 2009 palm/hammock logo (sand, sea,
   sun, palm green, coral hammock) instead of the later navy/olive scheme.
   Mobile-first: base rules are phone-width, media queries add layout as
   the screen grows.
   ========================================================================== */

@charset "UTF-8";

:root {
  --sand:        #f1e0bb;
  --sand-light:  #faf3e2;
  --sand-dark:   #d8b784;
  --sea:         #4f76c0;
  --sea-dark:    #2f4d85;
  --sky:         #bfe3f7;
  --sun:         #f6d746;
  --palm:        #3e8e41;
  --coral:       #e2574c;
  --ink:         #2b2016;

  /* Procedural textures (inline SVG, no image files) so the darker sand
     areas read as grain and the blue areas read as gentle ripples. */
  --tex-sand: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='200'%20height='200'%3E%3Cfilter%20id='n'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.85'%20numOctaves='2'%20seed='7'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='matrix'%20values='0%200%200%200%200%20%200%200%200%200%200%20%200%200%200%200%200%20%200.28%200.28%200.28%200%200'/%3E%3C/filter%3E%3Crect%20width='100%25'%20height='100%25'%20filter='url(%23n)'/%3E%3C/svg%3E");

  --tex-waves: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='100'%20height='50'%3E%3Cpath%20d='M0%2012%20Q12.5%204%2025%2012%20T50%2012%20T75%2012%20T100%2012'%20stroke='%23ffffff'%20stroke-opacity='0.10'%20stroke-width='2'%20fill='none'/%3E%3Cpath%20d='M0%2030%20Q12.5%2022%2025%2030%20T50%2030%20T75%2030%20T100%2030'%20stroke='%23ffffff'%20stroke-opacity='0.07'%20stroke-width='2'%20fill='none'/%3E%3Cpath%20d='M0%2044%20Q12.5%2038%2025%2044%20T50%2044%20T75%2044%20T100%2044'%20stroke='%23ffffff'%20stroke-opacity='0.05'%20stroke-width='1.5'%20fill='none'/%3E%3C/svg%3E");
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background-color: var(--sea-dark);
  background-image: var(--tex-waves);
  background-size: 140px 70px;
}

body {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background-color: var(--sea-dark);
  background-image: var(--tex-waves);
  background-size: 140px 70px;
  line-height: 1.5;
  font-size: 17px;
}

a {
  color: var(--sea-dark);
}

a:visited {
  color: var(--sea-dark);
}

a:hover,
a:focus {
  color: var(--coral);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.photo-framed {
  border: 4px solid var(--ink);
}

#container {
  max-width: 1100px;
  margin: 0 auto;
  background-color: var(--sand);
}

/* --- Site header / nav ---------------------------------------------- */

#site-header {
  background-color: var(--sea);
  background-image: var(--tex-waves);
  background-size: 140px 70px;
  color: #fff;
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  min-width: 0;
  flex: 1 1 auto;
}

.site-logo img {
  height: 40px;
  width: auto;
  flex: 0 0 auto;
}

.site-logo span {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.1rem;
  font-weight: bold;
  color: #fff;
  min-width: 0;
}

.nav-toggle {
  background: var(--sea-dark);
  border: none;
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  flex: 0 0 auto;
  white-space: nowrap;
}

.nav-toggle:hover,
.nav-toggle:focus {
  background: var(--coral);
}

#site-nav {
  display: none;
  background-color: var(--sea-dark);
  background-image: var(--tex-waves);
  background-size: 140px 70px;
}

#site-nav.is-open {
  display: block;
}

#site-nav ul {
  list-style: none;
}

#site-nav > ul > li {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

#site-nav a {
  display: block;
  padding: 12px 16px;
  color: #fff;
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
}

#site-nav a:hover,
#site-nav a:focus {
  background-color: var(--coral);
  color: #fff;
}

#site-nav .submenu {
  background-color: rgba(0, 0, 0, 0.15);
}

#site-nav .submenu a {
  padding-left: 32px;
}

.submenu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.submenu-toggle .arrow {
  transition: transform 0.15s ease;
}

.has-submenu.is-open > .submenu-toggle .arrow {
  transform: rotate(180deg);
}

.has-submenu .submenu {
  display: none;
}

.has-submenu.is-open .submenu {
  display: block;
}

/* --- Hero banner ------------------------------------------------------ */

#banner {
  border-bottom: 4px solid var(--ink);
}

#banner img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.hero-caption {
  background-color: var(--sand);
  background-image: var(--tex-sand);
  background-size: 120px 120px;
  text-align: center;
  padding: 10px 12px;
}

.hero-caption h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.6rem;
  color: var(--ink);
}

/* --- Main content ------------------------------------------------------ */

main {
  padding: 20px 16px 8px;
}

main::after {
  content: "";
  display: table;
  clear: both;
}

main h2 {
  color: var(--sea-dark);
  margin-bottom: 12px;
}

main p {
  margin-bottom: 1em;
}

.figure {
  margin: 0 0 1.2em;
}

.clear-both {
  clear: both;
}

.figure img {
  width: 100%;
}

.figure figcaption {
  font-size: 0.85rem;
  color: var(--sea-dark);
  padding-top: 4px;
  text-align: center;
}

main h3 {
  color: var(--sea-dark);
  margin: 1.2em 0 0.6em;
  clear: both;
}

.photo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  clear: both;
  margin: 0 0 1.2em;
}

.photo-row img {
  flex: 1 1 220px;
  width: auto;
  max-width: 100%;
  max-height: 280px;
  object-fit: cover;
}

.photo-row.two-up img {
  flex-basis: calc(50% - 6px);
}

.img-center {
  display: block;
  max-width: 320px;
  margin: 0 auto 1.2em;
  clear: both;
}

.img-center.wide {
  max-width: 100%;
  width: 320px;
}


/* --- Gallery grid + lightbox ------------------------------------------- */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  clear: both;
  margin: 1em 0;
}

.gallery-grid a {
  display: block;
  border: 4px solid var(--ink);
  background-color: var(--sand-dark);
  background-image: var(--tex-sand);
  background-size: 120px 120px;
  overflow: hidden;
}

.gallery-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.gallery-grid a:hover img,
.gallery-grid a:focus img {
  transform: scale(1.06);
}

.gallery-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 8, 0.92);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
}

.gallery-lightbox.is-open {
  display: flex;
}

.gallery-lightbox img {
  max-width: 100%;
  max-height: 80vh;
  width: auto;
  border: 4px solid var(--sand-light);
  margin: 0 auto;
}

.gallery-lightbox .lightbox-close,
.gallery-lightbox .lightbox-prev,
.gallery-lightbox .lightbox-next {
  position: absolute;
  background: var(--sea-dark);
  color: #fff;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 4px;
}

.gallery-lightbox .lightbox-close:hover,
.gallery-lightbox .lightbox-prev:hover,
.gallery-lightbox .lightbox-next:hover {
  background: var(--coral);
}

.gallery-lightbox .lightbox-close {
  top: 14px;
  right: 14px;
}

.gallery-lightbox .lightbox-prev {
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox .lightbox-next {
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
}

.gallery-lightbox .lightbox-caption {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: var(--sand-light);
  font-size: 0.85rem;
}

/* --- Featured photos + carousel (large galleries) ----------------------- */

.section-heading {
  color: var(--sea-dark);
  margin: 1.4em 0 0.6em;
  clear: both;
}

.featured-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-bottom: 1em;
}

.featured-grid figure {
  margin: 0;
}

.featured-grid img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.featured-grid figure.featured-portrait img {
  height: auto;
  aspect-ratio: 3 / 4;
}

.featured-grid figcaption {
  font-size: 0.85rem;
  color: var(--sea-dark);
  padding-top: 4px;
  text-align: center;
}

.carousel-intro {
  color: var(--sea-dark);
}

.carousel {
  margin: 0.5em 0 1.5em;
}

.carousel-viewport {
  position: relative;
  background-color: var(--sand-dark);
  background-image: var(--tex-sand);
  background-size: 120px 120px;
  border: 4px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
}

.carousel-viewport img {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  display: block;
  margin: 0 auto;
}

.carousel-viewport video {
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  display: block;
  margin: 0 auto;
  background: #000;
}

.carousel-loading {
  color: var(--sand-light);
  font-size: 0.9rem;
}

.carousel-btn {
  background: var(--sea-dark);
  color: #fff;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  padding: 10px 14px;
  cursor: pointer;
  border-radius: 4px;
}

.carousel-btn:hover,
.carousel-btn:focus {
  background: var(--coral);
}

.carousel-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 0;
}

.carousel-counter {
  font-size: 0.9rem;
  color: var(--sea-dark);
  min-width: 70px;
  text-align: center;
}

@media (min-width: 640px) {
  .featured-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .featured-grid img {
    height: 300px;
  }

  /* Center a lone leftover photo instead of leaving it stuck on the left
     when the count doesn't divide evenly into the grid. */
  .featured-grid > figure:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    max-width: calc((100% - 20px) / 2);
  }
}

/* --- Full-aspect photo list (Top 10) ------------------------------------ */

.photo-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  clear: both;
  margin: 1em 0;
}

.photo-list figure {
  margin: 0;
  border: 4px solid var(--ink);
  background-color: var(--sand-dark);
  background-image: var(--tex-sand);
  background-size: 120px 120px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.photo-list-trigger {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  font: inherit;
}

.photo-list img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.2s ease;
}

.photo-list-trigger:hover img,
.photo-list-trigger:focus img {
  transform: scale(1.04);
}

.photo-list figcaption {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  text-align: center;
  color: var(--sea-dark);
  font-size: 0.85rem;
  font-style: italic;
  background-color: var(--sand-light);
  border-top: 4px solid var(--ink);
}

@media (min-width: 640px) {
  .photo-list {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 1.4em 0;
  }

  /* Center a lone leftover photo on the final row. */
  .photo-list > figure:nth-child(3n+1):last-child {
    grid-column: 2 / 3;
  }
}

@media (min-width: 900px) {
  .photo-list {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }

  .photo-list figcaption {
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  /* Center a lone leftover photo, or a leftover pair, on the final row. */
  .photo-list > figure:nth-child(4n+1):last-child {
    grid-column: 2 / 3;
  }

  .photo-list > figure:nth-child(4n+1):nth-last-child(2) {
    grid-column: 2 / 3;
  }

  .photo-list > figure:nth-child(4n+1):nth-last-child(2) + figure {
    grid-column: 3 / 4;
  }
}

/* --- FAQ accordion ------------------------------------------------------ */

.faq-group {
  margin: 0 0 1.6em;
  clear: both;
}

.faq-group-heading {
  color: var(--sea-dark);
  font-style: italic;
  border-bottom: 2px solid var(--sand-dark);
  padding-bottom: 6px;
  margin-bottom: 4px;
}

.faq-item {
  border-bottom: 1px solid var(--sand-dark);
}

.faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  font-weight: bold;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary .faq-icon {
  flex: 0 0 auto;
  font-size: 1.3rem;
  color: var(--sea-dark);
  transition: transform 0.15s ease;
}

.faq-item[open] summary .faq-icon {
  transform: rotate(45deg);
}

.faq-item summary:hover,
.faq-item summary:focus {
  color: var(--coral);
}

.faq-answer {
  padding: 0 4px 16px;
}

.faq-answer img {
  margin: 8px auto 10px;
}

.faq-answer p {
  margin-bottom: 0.8em;
}

/* --- Lineage diagram (Dad's Castles) ------------------------------------ */

.lineage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0.4em auto 1.6em;
  max-width: 460px;
  clear: both;
}

.lineage-node {
  background-color: var(--sand-light);
  border: 4px solid var(--ink);
  border-radius: 10px;
  padding: 14px 22px;
  text-align: center;
  min-width: 170px;
}

.lineage-node strong {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-size: 1.2rem;
  color: var(--sea-dark);
}

.lineage-node span {
  font-size: 0.8rem;
  color: var(--ink);
}

.lineage-arrow-down,
.lineage-arrow-right {
  font-size: 1.6rem;
  color: var(--sea-dark);
  line-height: 1;
}

.lineage-arrow-right {
  display: none;
}

@media (min-width: 640px) {
  .lineage {
    flex-direction: row;
    justify-content: center;
    gap: 14px;
  }

  .lineage-arrow-down {
    display: none;
  }

  .lineage-arrow-right {
    display: block;
  }
}

/* --- Homepage: two-column layout (content + sidebar) --------------------- */

.home-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-content {
  flex: 1 1 auto;
  min-width: 0;
}

/* --- Homepage: three ways to dig in (sidebar) ---------------------------- */

.home-sidebar {
  flex: 0 0 auto;
  background-color: var(--sand-light);
  border: 4px solid var(--ink);
  border-radius: 10px;
  padding: 16px;
  align-self: flex-start;
}

.home-sidebar .section-heading {
  margin-top: 0;
}

.dig-in {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.dig-in-card {
  display: block;
  background-color: var(--sand);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
}

.dig-in-card:hover,
.dig-in-card:focus {
  border-color: var(--coral);
}

.dig-in-card h3 {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: var(--sea-dark);
  margin: 0 0 6px;
  clear: none;
}

.dig-in-card p {
  font-size: 0.9rem;
  margin: 0;
}

/* --- Homepage: Castle of the Month -------------------------------------- */

.castle-of-month {
  margin: 0 0 1.8em;
  clear: both;
  border: 4px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  background-color: var(--sand-light);
}

.castle-of-month-label {
  background-color: var(--coral);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  text-align: center;
  padding: 8px 10px;
  font-size: 1rem;
}

.castle-of-month img {
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.castle-of-month figcaption {
  padding: 12px 16px;
  text-align: center;
  color: var(--sea-dark);
  font-size: 0.95rem;
}

@media (min-width: 640px) {
  .castle-of-month img {
    height: 380px;
  }
}

@media (min-width: 900px) {
  .home-layout {
    flex-direction: row;
    align-items: flex-start;
  }

  .home-sidebar {
    flex: 0 0 260px;
    position: sticky;
    top: 20px;
  }
}

/* --- Forms -------------------------------------------------------------- */

.site-form label {
  display: block;
  font-weight: bold;
  margin-bottom: 4px;
}

.site-form input[type="text"],
.site-form textarea {
  width: 100%;
  max-width: 400px;
  padding: 8px;
  margin-bottom: 16px;
  border: 2px solid var(--sand-dark);
  border-radius: 4px;
  font-family: inherit;
  font-size: 1rem;
}

.site-form input[type="submit"] {
  background-color: var(--sea);
  color: #fff;
  border: none;
  padding: 10px 22px;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
}

.site-form input[type="submit"]:hover {
  background-color: var(--coral);
}

/* --- Footer -------------------------------------------------------- */

#site-footer {
  background-color: var(--sea-dark);
  background-image: var(--tex-waves);
  background-size: 140px 70px;
  color: var(--sand-light);
  text-align: center;
  padding: 16px 12px;
  font-size: 0.85rem;
}

#site-footer a {
  color: var(--sun);
}

.footer-social {
  margin-top: 4px;
  font-weight: bold;
}

.footer-signature {
  width: 90px;
  margin: 0 auto 10px;
  border: 2px solid var(--sand-light);
  opacity: 0.9;
  transform: rotate(-90deg);
}

/* --- Tablet and up ---------------------------------------------------- */

@media (min-width: 640px) {
  body {
    font-size: 18px;
  }

  .header-bar {
    padding: 10px 24px;
  }

  .site-logo span {
    font-size: 1.2rem;
  }

  #banner img {
    height: 320px;
  }

  main {
    padding: 28px 32px 12px;
  }

  .figure.float-right {
    float: right;
    width: 36%;
    margin-left: 20px;
    clear: left;
  }

  .figure.float-left {
    float: left;
    width: 36%;
    margin-right: 20px;
    clear: right;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-grid img {
    height: 170px;
  }

  /* Center a lone leftover photo on the final row. */
  .gallery-grid > a:nth-child(3n+1):last-child {
    grid-column: 2 / 3;
  }
}

/* --- Desktop: horizontal nav bar replaces the hamburger ---------------- */

@media (min-width: 900px) {
  .nav-toggle {
    display: none;
  }

  #site-nav {
    display: block;
    background-color: transparent;
  }

  #site-nav > ul {
    display: flex;
  }

  #site-nav > ul > li {
    border-top: none;
    position: relative;
  }

  #site-nav > ul > li > a,
  #site-nav > ul > li > .submenu-toggle {
    padding: 18px 16px;
  }

  #site-nav .has-submenu .submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--sea-dark);
    background-image: var(--tex-waves);
    background-size: 140px 70px;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.2);
    z-index: 5;
  }

  #site-nav .has-submenu:hover .submenu,
  #site-nav .has-submenu.is-open .submenu {
    display: block;
  }

  .submenu-toggle .arrow {
    display: inline-block;
  }

  #banner img {
    height: 400px;
  }

  main {
    max-width: 900px;
    margin: 0 auto;
  }

  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Center a lone leftover photo, or a leftover pair, on the final row. */
  .gallery-grid > a:nth-child(4n+1):last-child {
    grid-column: 2 / 3;
  }

  .gallery-grid > a:nth-child(4n+1):nth-last-child(2) {
    grid-column: 2 / 3;
  }

  .gallery-grid > a:nth-child(4n+1):nth-last-child(2) + a {
    grid-column: 3 / 4;
  }
}
