/* static/styles.css
   Responsive: portrait -> translucent (left-panel) moves to bottom and takes 2/3 of height.
   Uses a jpg background: /static/background.jpg
   Content images scale to their container. No JavaScript.
*/

:root {
  --left-width-desktop: 40%;
  --left-min-width: 320px;
  --left-max-width: 46%;
  --left-height-portrait: 66.666vh; /* 2/3 height on vertical screens */
  --right-height-portrait: 33.333vh;
}

/* Basic page */
html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui;
  color: #ffffff;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;

  /* full-screen background (replace with your JPG at /static/background.jpg) */
  background-image: url('/static/background.jpg');
  background-size: cover;
  background-position: center right;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

/* Container split */
.app {
  display: flex;
  height: 100vh;
  width: 100vw;
  min-height: 100vh;
  min-width: 320px;
}

/* LEFT PANEL: desktop / tablet default (left side) */
.left-panel {
  width: var(--left-width-desktop);
  min-width: var(--left-min-width);
  max-width: var(--left-max-width);
  box-sizing: border-box;
  padding: 36px;
  display: flex;
  flex-direction: column;
  overflow: hidden;

  background: linear-gradient(
    180deg,
    rgba(58, 20, 140, 0.96) 0%,
    rgba(44, 12, 110, 0.94) 40%,
    rgba(34, 8, 86, 0.92) 100%
  );

  border-right: 1px solid rgba(0,0,0,0.36);
  box-shadow: 18px 0 56px rgba(6,6,10,0.68);
  -webkit-backdrop-filter: blur(8px) saturate(105%);
  backdrop-filter: blur(8px) saturate(105%);
}

/* NAV */
.nav {
  margin-bottom: 16px;
  flex: 0 0 auto;
}
.nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}
.nav a {
  color: #ffffff;
  text-decoration: none;
  opacity: 1;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.18);
  font-size: 0.98rem;
  box-shadow: 0 6px 18px rgba(6,6,10,0.45);
  transition: background 140ms ease, transform 120ms ease, box-shadow 120ms ease;
}
.nav a:hover,
.nav a:focus {
  background: rgba(255,255,255,0.06);
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(6,6,10,0.55);
}

/* Content area scrolls independently */
.content {
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 12px;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
}

/* TYPOGRAPHY */
.content h1, .content h2, .content h3 {
  color: #ffffff;
  margin-top: 0.5em;
  letter-spacing: -0.4px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.55);
}
.content p {
  line-height: 1.65;
  color: #ffffff;
  opacity: 0.98;
  font-size: 1.03rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.content a {
  color: #ffd8ff;
  text-decoration: underline;
}

/* Code / pre */
.content code, .content pre {
  background: rgba(0,0,0,0.30);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, "Roboto Mono", "Courier New", monospace;
  color: #f1f1f1;
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.02), 0 6px 18px rgba(6,6,10,0.48);
}

/* Make inline and block images inside content scale with the container */
.content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.8rem 0;
  border-radius: 8px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
  object-fit: cover;
}

/* RIGHT PANEL: shows background uncovered; fills remaining space */
.right-panel {
  width: calc(100% - var(--left-width-desktop));
  min-width: 200px;
  flex: 1 1 auto;
  background: transparent;
  box-shadow: -6px 0 20px rgba(0,0,0,0.08) inset;
  position: relative;
  overflow: hidden;
}

/* If you place <img> tags directly in the right-panel, scale them nicely */
.right-panel img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Desktop tweaks for background handling: fixed attachment only on larger screens */
@media (max-width: 1024px) {
  html, body {
    background-attachment: scroll;
  }
}

/* PORTRAIT MODE: stack with translucent panel at bottom (2/3 height) */
@media (orientation: portrait), (max-width: 760px) {
  /* Stack vertically with the image first, overlay second (so left-panel appears at bottom) */
  .app {
    flex-direction: column-reverse;
    height: 100vh;
  }

  /* Left-panel becomes the bottom overlay and is full width */
  .left-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: var(--left-height-portrait);
    padding: 20px 20px 28px 20px;
    border-right: none;
    border-top: 1px solid rgba(0,0,0,0.28); /* horizontal separator */
    box-shadow: 0 -18px 48px rgba(6,6,10,0.66);
    -webkit-backdrop-filter: blur(6px) saturate(105%);
    backdrop-filter: blur(6px) saturate(105%);
  }

  /* Right-panel shrinks to top portion with image visible */
  .right-panel {
    width: 100%;
    height: var(--right-height-portrait);
    min-height: var(--right-height-portrait);
    flex: 0 0 var(--right-height-portrait);
    box-shadow: none;
  }

  /* Make sure background is centered top so the image crops nicely on portrait */
  html, body {
    background-position: center top;
  }

  /* reduce nav spacing on small screens */
  .nav {
    margin-bottom: 10px;
  }
  .nav a { padding: 7px 10px; }

  /* reduce text sizes slightly for small screens */
  .content p { font-size: 1.01rem; line-height: 1.5; }
  .content h1 { font-size: 1.8rem; }
}

/* Very small screens: ensure scrolling remains smooth and shadow removed */
@media (max-width: 420px) {
  .left-panel {
    padding: 16px;
    height: 68vh;
  }
  .content h1 { font-size: 1.5rem; }
  .nav a { font-size: 0.92rem; padding: 6px 8px; }
}
