/* ========================================
   Overlake.bio - Consolidated Styles
   Combines: overlake-common.css, static-background.css, water-enhancements.css
   ======================================== */

/* ========================================
   0. FONTS & DESIGN TOKENS
   ======================================== */

/* Self-hosted Fraunces (variable serif) for headings only. No font CDN.
   Body text stays on the Water.css system sans stack. */
@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../asset/fonts/Fraunces-latin.woff2") format("woff2");
}

:root {
  /* Spacing scale */
  --space-xs: 0.25rem;   /* 4px  */
  --space-sm: 0.5rem;    /* 8px  */
  --space-md: 1rem;      /* 16px */
  --space-lg: 1.5rem;    /* 24px */
  --space-xl: 2rem;      /* 32px */
  --space-2xl: 3rem;     /* 48px */
  --space-3xl: 4rem;     /* 64px */

  /* Border radius scale */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* Easing curves */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  /* Text tint — override Water.css neutrals with a faint cool (blue-grey)
     lean toward the background hue. Same lightness, just not pure white/grey,
     so the page reads as intentionally colour-coordinated with the water theme. */
  --text-bright: #eef2f8;  /* was #fff    — headings, logo, panel copy */
  --text-main:   #d3dae6;  /* was #dbdbdb — body text                 */
  --text-muted:  #9fadbe;  /* was #a9b1ba — section tags, small labels */
}

/* ========================================
   1. BACKGROUND
   ======================================== */

body {
  background:
    image-set(
      url("../asset/water-6901805_1920.webp") type("image/webp"),
      url("../asset/water-6901805_1920.jpg") type("image/jpeg")
    ) no-repeat center center fixed;
  /* Fallback for browsers without image-set() support */
  background-color: #202b38; /* match your CSS theme color */
  background-size: cover;
  background-attachment: fixed;
  background-blend-mode: multiply;
  line-height: 1.6;
  animation: fadeIn 0.8s ease-out;
}

p, li {
  line-height: 1.6;
}

/* Particles.js container */
#particles-js {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  animation: particlesFadeIn 6.1s ease-out forwards;
}

/* ========================================
   2. LOGO STYLES
   ======================================== */

.overlake-logo {
  text-align: right;
  line-height: 0.85;
  margin: 2rem 0;
  font-family: inherit; /* Uses water.css system fonts */
}

.overlake-main {
  font-size: 3em;
  font-weight: 200;
  color: var(--text-bright, #212529);
  letter-spacing: -0.01em;
  margin-bottom: 5px;
}

.overlake-lake {
  color: var(--links, #0076d1);
  font-weight: 300;
  text-shadow: 0 0 12px rgba(65, 173, 255, 0.15);
}

.overlake-bio {
  font-size: 1.4em;
  color: var(--links, #0076d1);
  font-weight: 400;
  letter-spacing: 0.1em;
  text-shadow: 0 0 10px rgba(65, 173, 255, 0.12);
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
  .overlake-main {
    color: var(--text-bright, #ffffff);
  }
  .overlake-lake {
    color: var(--links, #7dc4e4);
  }
  .overlake-bio {
    color: var(--links, #7dc4e4);
  }
}

/* Responsive sizing */
@media (max-width: 768px) {
  .overlake-main {
    font-size: 2.2em;
  }
  .overlake-bio {
    font-size: 1.1em;
  }
}

/* Header integration */
header .overlake-logo {
  margin: 1rem 0;
}

header .overlake-main {
  font-size: 2.5em;
}

header .overlake-bio {
  font-size: 1.2em;
}

/* Inline version for navigation or small spaces */
.overlake-inline {
  display: inline-block;
  font-size: 1.5em;
  font-weight: 300;
  color: var(--text-bright, #212529);
  text-decoration: none;
}

@media (hover: hover) {
  .overlake-inline:hover {
    color: var(--links, #0076d1);
    text-decoration: none;
  }
}

.overlake-inline .lake {
  color: var(--links, #0076d1);
  font-weight: 400;
}

/* Footer version */
footer .overlake-logo {
  text-align: center;
  margin: 2rem auto;
}

footer .overlake-main {
  font-size: 2em;
}

footer .overlake-bio {
  font-size: 1em;
}

/* ========================================
   3. UTILITY CLASSES
   ======================================== */

/* Justified text alignment */
.justified-text {
  text-align: justify;
  hyphens: auto;
  -webkit-hyphens: auto;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Section tag separator and label in headings */
.section-sep {
  color: var(--links);
}

.section-tag {
  font-size: 0.75em;
  font-weight: 300;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* Indented paragraphs */
.indented {
  margin-left: 2em;
}

.citation-widget {
  margin-top: 0.4rem;
}

.citation-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.citation-row .citation-text {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
}

.citation-row .citation-widget {
  flex: 0 0 200px;
  margin-top: 0;
}

.citation-row .citation-widget img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.citation-widget-right {
  text-align: right;
}

/* Full-width responsive figure */
.figure-full-width {
  width: 100%;
  margin: 0;
}

.figure-full-width img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0;
}

/* ========================================
   4. ANIMATIONS
   ======================================== */

/* Subtle fade-in animation for page content */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Opacity-only fade for the particles background */
@keyframes particlesFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Enhanced selection with shimmer */
@keyframes selectionShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}


/* Elegant focus ring pulse */
@keyframes focusPulse {
  from { box-shadow: 0 0 0 2px var(--links), 0 0 20px rgba(65, 173, 255, 0.3); }
  to { box-shadow: 0 0 0 2px var(--links), 0 0 25px rgba(65, 173, 255, 0.4); }
}

/* ========================================
   5. LINKS & NAVIGATION
   ======================================== */

/* Enhanced link hover effects */
a {
  transition: color 0.45s var(--ease-out-quart), text-shadow 0.45s var(--ease-out-quart);
}

@media (hover: hover) {
  a:hover {
    text-shadow: 0 0 8px rgba(65, 173, 255, 0.3);
    color: #60b7ff;
  }
}

/* Navigation buttons */
.button-nav {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin: 25px 0;
  flex-wrap: wrap;
}

.button-nav .nav-button {
  flex: 1;
  text-align: center;
  min-width: 0;
  white-space: nowrap;
}

.nav-button {
  padding: 8px 12px;
  /* Flex-center the label so it stays centered on both axes even for the
     longest label ("documentation"); text-align can't center nowrap text
     that overflows its box, but justify-content can. */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(32, 43, 56, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(65, 173, 255, 0.15);
  border-radius: var(--radius-md);
  text-decoration: none;
  transition:
    background-color 0.5s var(--ease-out-quart),
    border-color 0.5s var(--ease-out-quart),
    box-shadow 0.5s var(--ease-out-quart),
    color 0.5s var(--ease-out-quart),
    transform 0.5s var(--ease-out-quart);
  position: relative;
  overflow: hidden;
  /* Ensure nav-button text is visible */
  color: var(--text-main) !important;
  -webkit-text-fill-color: var(--text-main) !important;
}

@media (hover: hover) {
  .nav-button:hover {
    background: var(--links);
    color: var(--background-body) !important;
    -webkit-text-fill-color: var(--background-body) !important;
    transform: translateY(-2px);
    box-shadow:
      0 8px 22px rgba(0, 0, 0, 0.18),
      0 0 18px rgba(65, 173, 255, 0.18);
  }
}

/* Classy cursor interaction for buttons */
.nav-button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  transition: width 0.6s ease, height 0.6s ease;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

@media (hover: hover) {
  .nav-button:hover::before {
    width: 200px;
    height: 200px;
  }
}

/* Active page indicator.
   The underline is drawn with an inset box-shadow (not a thicker bottom
   border) so the border stays symmetric and the label stays vertically
   centered — a 2px border-bottom would shift the text up ~1px. */
.nav-button[aria-current="page"] {
  color: var(--links) !important;
  -webkit-text-fill-color: var(--links) !important;
  border-color: rgba(65, 173, 255, 0.5);
  background: rgba(65, 173, 255, 0.12);
  box-shadow:
    inset 0 -2px 0 var(--links),
    inset 0 0 18px rgba(65, 173, 255, 0.08);
}

/* ========================================
   5b. CALLOUT (semantic info note)
   ======================================== */

.callout {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  border-left: 3px solid var(--links);
  border-radius: var(--radius-md);
  background: rgba(65, 173, 255, 0.06);
}

.callout > p {
  margin: 0;
}

.callout-icon {
  flex: 0 0 auto;
  color: var(--links);
  line-height: 1.6;
}

/* Placeholder text for not-yet-populated sections */
.placeholder-note {
  text-align: center;
  font-size: 1.2em;
  margin: var(--space-xl) 0;
  color: var(--text-muted);
}

/* ========================================
   6. HEADINGS & TEXT
   ======================================== */

/* Serif headings (Fraunces) — editorial contrast against the sans body/logo */
h1, h2, h3, .panel-title {
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-weight: 600;
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
}

h1, h2 {
  color: var(--links);
}


/* Subtle glow effects for important elements */
h1 {
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

/* Keep the small heading labels/separators on the sans stack for contrast */
.section-tag, .section-sep {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: normal;
}

/* Remove list bullets */
ul, ol {
  list-style: none;
  padding-left: 2em;
}

/* Enhanced navigation feel (for both ul and ol) */
ul li, ol li {
  transition: transform 0.45s var(--ease-out-quart);
}

@media (hover: hover) {
  ul li:hover, ol li:hover {
    transform: translateX(3px);
  }
}

/* ========================================
   7. FORMS & BUTTONS
   ======================================== */

/* Enhanced button interactions */
button, input[type="submit"], input[type="button"], input[type="reset"] {
  transition: all 0.4s var(--ease-out-quart);
  position: relative;
  overflow: hidden;
  /* Ensure button text is visible */
  color: var(--form-text) !important;
  -webkit-text-fill-color: var(--form-text) !important;
}

@media (hover: hover) {
  button:hover {
    box-shadow: 0 4px 15px rgba(65, 173, 255, 0.2);
    transform: translateY(-1px);
  }
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 8px rgba(65, 173, 255, 0.1);
}

/* Ripple effect for buttons */
button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.3s ease, height 0.3s ease;
}

button:active::after {
  width: 200px;
  height: 200px;
}

/* Classy cursor interaction for buttons */
button::before, summary::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  transition: width 0.6s ease, height 0.6s ease;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

@media (hover: hover) {
  button:hover::before, summary:hover::before {
    width: 200px;
    height: 200px;
  }
}

/* Elegant form focus effects */
input:focus, textarea:focus, select:focus {
  transform: scale(1.02);
  box-shadow:
    0 0 0 2px var(--focus),
    0 4px 15px rgba(0, 150, 191, 0.1);
  backdrop-filter: blur(8px) saturate(1.2);
  -webkit-backdrop-filter: blur(8px) saturate(1.2);
}

/* ========================================
   8. CONTENT BLOCKS
   ======================================== */

/* Section rhythm + scroll-reveal easing.
   `transform` drives the reveal (opacity + rise). The hover state only touches
   box-shadow / background (a cyan glow, no lift) so it never fights the
   reveal's transform end-state — that collision is why the old lift died. */
section {
  opacity: 0.95;
  transition:
    opacity 0.7s var(--ease-out-quart),
    box-shadow 0.7s var(--ease-out-quart),
    transform 0.7s var(--ease-out-quart),
    background-color 0.7s var(--ease-out-quart);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: 0 calc(-1 * var(--space-md));
  position: relative;
}

/* Cyan glow on hover, echoing the index.html navigation panels */
@media (hover: hover) {
  section:not(.panel-grid):hover {
    opacity: 1;
    background-color: rgba(32, 43, 56, 0.18);
    box-shadow:
      0 12px 34px rgba(0, 0, 0, 0.18),
      0 0 30px rgba(65, 173, 255, 0.12);
  }
}



/* ========================================
   9. HOME NAVIGATION PANELS
   ======================================== */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.navigation-panel {
  min-height: 220px;
  display: grid;
  align-content: space-between;
  gap: 1.25rem;
  padding: 1.15rem;
  border: 1px solid rgba(125, 196, 228, 0.22);
  border-radius: var(--radius-md);
  background:
    linear-gradient(135deg, rgba(32, 43, 56, 0.84), rgba(16, 25, 34, 0.66)),
    radial-gradient(circle at top right, rgba(125, 196, 228, 0.18), transparent 36%);
  color: var(--links);
  text-decoration: none;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.55s var(--ease-out-quart),
    border-color 0.55s var(--ease-out-quart),
    box-shadow 0.55s var(--ease-out-quart);
}

.navigation-panel::after {
  content: "";
  position: absolute;
  inset: auto 1.15rem 1.15rem auto;
  width: 2.6rem;
  height: 2.6rem;
  border-top: 1px solid rgba(125, 196, 228, 0.5);
  border-right: 1px solid rgba(125, 196, 228, 0.5);
  opacity: 0.55;
  transition: transform 0.55s var(--ease-out-quart), opacity 0.55s var(--ease-out-quart);
}

.panel-index {
  color: var(--text-bright);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.panel-title {
  color: inherit;
  font-size: 2.1rem;
  line-height: 1;
}

.panel-copy {
  max-width: 24rem;
  color: var(--text-bright);
  line-height: 1.45;
  text-decoration: none;
}

@media (hover: hover) {
  .navigation-panel:hover {
    text-decoration: none;
    transform: translateY(-4px);
    border-color: rgba(125, 196, 228, 0.54);
    box-shadow:
      0 22px 60px rgba(0, 0, 0, 0.34),
      0 0 36px rgba(65, 173, 255, 0.12);
  }

  .navigation-panel:hover::after {
    opacity: 1;
    transform: translate(4px, -4px);
  }
}


/* ========================================
   10. TABLES & IMAGES
   ======================================== */

/* Elegant table hover effects */
tbody tr {
  transition: background-color 0.2s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  transform: perspective(1000px) rotateX(0deg);
}

@media (hover: hover) {
  tbody tr:hover {
    background-color: rgba(65, 173, 255, 0.05);
    transform: perspective(1000px) rotateX(2deg) scale(1.001);
    z-index: 1;
    position: relative;
  }
}

/* Smooth image hover effects */
img {
  transition: transform 0.55s var(--ease-out-quart), filter 0.55s var(--ease-out-quart);
  border-radius: var(--radius-sm);
}

@media (hover: hover) {
  img:hover {
    transform: scale(1.02);
    filter: brightness(1.1);
  }
}

/* ========================================
   11. DETAILS & SUMMARY
   ======================================== */

/* Enhanced details/summary */
details {
  transition: box-shadow 0.4s var(--ease-out-quart), transform 0.4s var(--ease-out-quart);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

details[open] {
  transform: scale(1.005);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-lg);
}

summary {
  transition: color 0.4s var(--ease-out-quart);
  position: relative;
  overflow: hidden;
}

@media (hover: hover) {
  summary:hover {
    color: var(--links);
  }
}

/* ========================================
   12. FOOTER
   ======================================== */

/* Subtle footer enhancement */
footer {
  transition: border-color 0.3s ease;
}

@media (hover: hover) {
  footer:hover {
    border-color: var(--links);
  }
}

/* ========================================
   13. GLOBAL ENHANCEMENTS
   ======================================== */

/* Smooth page transitions */
html {
  scroll-behavior: smooth;
}

/* Keep anchored headings clear of the top edge on in-page jumps */
h1, h2, h3, [id] {
  scroll-margin-top: var(--space-xl);
}

/* Skip-to-content link: hidden until keyboard-focused */
.skip-link {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  z-index: 10000;
  padding: var(--space-sm) var(--space-md);
  background: var(--links);
  color: var(--background-body);
  border-radius: var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  transform: translateY(-150%);
  transition: transform 0.25s var(--ease-out-expo);
}

.skip-link:focus {
  transform: translateY(0);
}

/* Scroll-reveal: sections rise + fade once as they enter the viewport.
   Only active when JS adds .reveal-enabled to <html>, so no-JS = fully visible. */
.reveal-enabled section:not(.panel-grid) {
  opacity: 0;
  transform: translateY(16px);
  will-change: opacity, transform;
  /* Transition (all four properties) is inherited from the base `section`
     rule so reveal and hover share one consistent, mellow timing. */
}

.reveal-enabled section.in-view {
  opacity: 0.95;
  transform: none;
}

/* Enhanced selection with shimmer */
::selection {
  background: linear-gradient(45deg, var(--selection), var(--links), var(--selection));
  background-size: 300% 300%;
  animation: selectionShimmer 2s ease-in-out infinite;
  text-shadow: none;
}

/* Enhanced scrollbar */
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--scrollbar-thumb), var(--links));
  transition: background 0.2s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--links), var(--scrollbar-thumb-hover));
}

/* Elegant focus ring */
*:focus-visible {
  outline: 2px solid transparent;
  box-shadow:
    0 0 0 2px var(--links),
    0 0 20px rgba(65, 173, 255, 0.3);
  animation: focusPulse 1s ease-in-out infinite alternate;
}

/* Elegant loading state */
body.loading * {
  opacity: 0.7;
  pointer-events: none;
}

/* ========================================
   14. RESPONSIVE DESIGN
   ======================================== */

/* Mobile-friendly touch enhancements */
@media (max-width: 600px) {
  /* Fixed background attachment triggers costly repaints on scroll on mobile */
  body {
    background-attachment: scroll;
  }

  .nav-button {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .panel-title {
    font-size: 1.65rem;
  }

  .button-nav {
    flex-direction: column;
  }

  .button-nav .nav-button {
    flex: none;
    width: 100%;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .navigation-panel {
    min-height: 170px;
  }

  section {
    margin: 0;
  }

  .justified-text {
    text-align: left;
    hyphens: none;
    -webkit-hyphens: none;
  }

  .overlake-inline {
    font-size: 1.1em;
  }

  .indented {
    margin-left: 0.5em;
  }

  .citation-row {
    flex-direction: column;
    gap: 0.65rem;
  }

  .citation-row .citation-widget {
    flex-basis: auto;
    width: min(240px, 100%);
    align-self: flex-end;
  }

}

/* ========================================
   15. ACCESSIBILITY
   ======================================== */

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  #particles-js {
    display: none;
  }

  /* Never leave reveal content hidden if motion is reduced */
  .reveal-enabled section:not(.panel-grid) {
    opacity: 0.95 !important;
    transform: none !important;
  }

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   16. PRINT
   ======================================== */

@media print {
  body {
    background: #fff !important;
    color: #111 !important;
    font-family: Georgia, "Times New Roman", serif;
    padding: 1.5cm;
    animation: none;
  }

  /* Drop decorative and interactive chrome from the printed page */
  #particles-js,
  .button-nav,
  .skip-link,
  .callout-icon,
  footer {
    display: none !important;
  }

  .overlake-main,
  .overlake-lake,
  .overlake-bio,
  h1, h2, h3 {
    color: #111 !important;
    text-shadow: none !important;
  }

  a {
    color: #0645ad !important;
    text-decoration: underline;
  }

  /* Expose destination URLs for external links */
  main a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }

  .reveal-enabled section:not(.panel-grid) {
    opacity: 1 !important;
    transform: none !important;
  }

  section {
    margin: 0 0 0.6cm;
    padding: 0;
    background: none !important;
    box-shadow: none !important;
    page-break-inside: avoid;
  }

  h2, h3 {
    page-break-after: avoid;
  }
}
