/* =========================
   Root Variables
========================= */

:root {
  --bg-overlay: rgba(245, 247, 246, 0.85); /* updated sweet spot */
  --bg-overlay-soft: rgba(245, 247, 246, 0.80);

  --ink-main: #1f2f2b;
  --ink-muted: #4b5f5a;

  --accent-soft: #8fb7ad;
  --accent-strong: #5a8f86;

  --divider: rgba(31, 47, 43, 0.12);
}

/* =========================
   Base Styles
========================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink-main);

  background-image: url("https://whangam.neocities.org/petz/wp_weave_095.jpg");
  background-repeat: repeat;
  background-size: auto;
  background-position: top left;
}

/* =========================
   Layout Frame
========================= */

.page-frame {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
}

/* =========================
   Content Shell (Layered)
========================= */

.content-shell {
  position: relative;
  width: min(1100px, 100%);
  max-height: 85vh;

  display: flex;
  flex-direction: column;

  border-radius: 14px;
  overflow: visible; /* allows frame to exist outside */

  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.25);
}

/* -------------------------
   Gold Leaf Frame (OUTSIDE)
------------------------- */

.content-shell::before {
  content: "";
  position: absolute;
  inset: -6px;

  border-radius: 18px;
  z-index: 0;

  background-image: url("https://whangam.neocities.org/petz/Gold.jpeg");
  background-repeat: repeat;
  background-size: 280px 280px;
  background-position: center;

  filter: brightness(1.05) contrast(0.95) saturate(1.1);

  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.25),
    0 12px 30px rgba(0, 0, 0, 0.35);
}

/* -------------------------
   Panel Fill (MASK) - Updated
------------------------- */

.content-shell::after {
  content: "";
  position: absolute;
  inset: 0;

  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,0.25),
      rgba(255,255,255,0)
    ),
    var(--bg-overlay);
  background-blend-mode: overlay;

  backdrop-filter: blur(6px);
  border-radius: 14px;
  z-index: 1;
}

/* Lift real content above the mask */
.content-shell > * {
  position: relative;
  z-index: 2;
}

/* =========================
   Header / Navigation
========================= */

header {
  padding: 1.2rem 2rem;
  border-bottom: 1px solid var(--divider);

  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative; /* needed for ornamental nav caps */
}

.site-title {
  font-family: "Playfair Display", serif;
  font-size: 1.4rem;
  letter-spacing: 0.03em;
}

/* -------------------------
   Nav Links
------------------------- */

nav {
  position: relative;
}

nav a {
  margin-left: 1.5rem;
  text-decoration: none;
  font-weight: 500;
  color: var(--ink-muted);
  position: relative;
  opacity: 0.85;
  transition: color 200ms ease, opacity 200ms ease;
}

nav a:hover,
nav a.active {
  color: var(--accent-strong);
  opacity: 1;
}

/* -------------------------
   Hover Underline
------------------------- */

nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 2px;
  background: var(--accent-soft);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 200ms ease;
}

nav a:hover::after,
nav a.active::after {
  transform: scaleX(1);
}

/* -------------------------
   Editorial Baseline + End Caps
------------------------- */

nav::after {
  content: "";
  position: absolute;
  left: 1.2rem;
  right: 1.2rem;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--divider),
    transparent
  );
}

nav::before {
  content: "✦";
  position: absolute;
  left: 0;
  bottom: -0.45rem;
  font-size: 0.7rem;
  color: var(--accent-soft);
  opacity: 0.7;
}

nav span.nav-cap {
  position: absolute;
  right: 0;
  bottom: -0.45rem;
  font-size: 0.7rem;
  color: var(--accent-soft);
  opacity: 0.7;
}

/* -------------------------
   Mobile Nav Toggle (hidden by default)
------------------------- */

.nav-toggle {
  display: none;
  background: none;
  border: none;
  padding: 0;
  font-size: 1.2rem;
  color: var(--ink-muted);
  cursor: pointer;
  position: relative;
  z-index: 20; /* ensure toggle is above everything */
}

/* =========================
   Scrollable Content
========================= */

.content-scroll {
  padding: 2rem;
  overflow-y: auto;
  max-height: calc(85vh - 70px);
  scrollbar-gutter: stable;

  /* Center all non-header content */
  text-align: center;
}

.content-scroll > * {
  /* Center block-level children */
  margin-left: auto;
  margin-right: auto;
}

.content-scroll h1,
.content-scroll h2,
.content-scroll h3 {
  font-family: "Playfair Display", serif;
  letter-spacing: 0.02em;
}

.content-scroll p {
  line-height: 1.7;
  margin-bottom: 1.2rem;
}

.content-scroll img {
  max-width: 100%;
  display: block;
  margin: 2rem auto; /* centered */
  border-radius: 6px;
}


.crab-divider {
  display: block;             /* makes it respect margin auto */
  margin: 3rem auto;          /* vertical spacing above/below */
  width: auto;                /* let the image scale naturally */
  height: auto;               /* maintain aspect ratio */
  image-rendering: crisp-edges;
    text-align: center;         /* fallback for some parent scenarios */
}

/* =========================
   Scrollbar Styling
========================= */

.content-scroll::-webkit-scrollbar {
  width: 8px;
}

.content-scroll::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 10px;
}

/* =========================
   Content Area Link Styling
========================= */

.content-scroll a {
  color: #2f4f45; /* deep muted emerald */
  text-decoration: none;
  font-weight: 500;
  border-bottom: 1px solid rgba(47, 79, 69, 0.25); /* subtle underline */
  transition: color 180ms ease, border-color 180ms ease;
}

.content-scroll a:hover {
  color: var(--accent-strong); /* soft gold-green */
  border-color: var(--accent-strong);
}

.content-scroll a:visited {
  color: var(--ink-muted); /* soft muted ink */
  border-color: rgba(75, 95, 90, 0.35);
}

.content-scroll a:active,
.content-scroll a:focus {
  color: var(--accent-strong);
  border-color: var(--accent-strong);
  outline: none;
}

/* =========================
   Responsive
========================= */

@media (max-width: 700px) {

  /* -------------------------
     Shell sizing
  ------------------------- */
  .content-shell {
    max-height: 95vh;
  }

  .content-scroll {
    max-height: calc(95vh - 70px);
  }

  .content-shell::before {
    inset: -4px; /* thinner gold frame */
  }

  /* -------------------------
     Header styling
     Keep inline, allow wrapping
  ------------------------- */
  header {
    flex-direction: row;
    flex-wrap: wrap; /* allow images, title, nav to wrap */
    align-items: center;
    gap: 0.5rem; /* tighter spacing for mobile */
  }

  /* -------------------------
     Decorative images
     Left image kept, right image hidden
  ------------------------- */
  header img:first-child {
    height: 28px; /* scale down left image */
    width: auto;
  }

  header img:last-child {
    display: none; /* hide right image */
  }

  /* -------------------------
     Site title scaling
  ------------------------- */
  .site-title {
    font-size: 1.1rem; /* slightly smaller title */
    flex-shrink: 1; /* allow shrinking if needed */
  }

  /* -------------------------
     Navigation links adjustments
  ------------------------- */
  nav a {
    margin-left: 0.8rem;
    margin-right: 0.5rem;
    font-size: 0.95rem; /* slightly smaller font */
    white-space: nowrap; /* prevent mid-word breaks */
    opacity: 0.9; /* subtle appearance */
  }

  /* Keep hover underline subtle */
  nav a::after {
    bottom: -2px;
    height: 1.5px;
  }

  /* -------------------------
     Editorial baseline + caps shrink
  ------------------------- */
  nav::before,
  nav::after,
  .nav-cap {
    font-size: 0.6rem;
    bottom: -0.35rem;
  }
}
