/* ==========================================================================
   The Chadwick Family — warm editorial / scrapbook theme
   ========================================================================== */
:root {
  --paper: #f3ede2;
  --paper-2: #ece3d4;
  --ink: #463f35;
  --ink-soft: #6b6253;
  --muted: #978c79;
  --line: #d4c8b2;
  --card: #faf6ee;
  --card-edge: #e6dcc9;
  --leaf: #93a07e;
  --tape: rgba(212, 201, 178, 0.6);
  --frame: #fffdf8;
  --shadow: 0 14px 34px rgba(90, 72, 48, 0.14);
  --shadow-sm: 0 6px 18px rgba(90, 72, 48, 0.12);
  --radius: 4px;
  --maxw: 1120px;
}
:root[data-theme="dark"] {
  --paper: #211e18;
  --paper-2: #1a1712;
  --ink: #ece3d4;
  --ink-soft: #c8bda9;
  --muted: #9b917f;
  --line: rgba(220, 210, 188, 0.18);
  --card: #2a261e;
  --card-edge: #3a342a;
  --leaf: #9aa886;
  --tape: rgba(150, 138, 112, 0.4);
  --frame: #322d24;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Mulish", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
/* subtle paper grain */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  opacity: 0.5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
}

h1, h2, h3, .brand, .hero-copy h1 { font-family: "Fraunces", Georgia, serif; font-weight: 500; }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-soft); }

main { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem 4rem; }

/* ---- Topbar ---- */
.topbar {
  max-width: var(--maxw); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.4rem 1.5rem 1.1rem; border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.5rem; font-weight: 600; letter-spacing: .2px; color: var(--ink); }
.brand span { color: var(--muted); }
.topbar nav { display: flex; align-items: center; gap: 1.5rem; }
.topbar nav a { font-size: .82rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; color: var(--ink-soft); }
.topbar nav a:hover { color: var(--ink); }
.pill { background: var(--leaf); color: #fff !important; padding: .25rem .7rem; border-radius: 999px; letter-spacing: .08em !important; }
.themebtn { background: none; border: 1px solid var(--line); color: var(--ink-soft); width: 38px; height: 38px; border-radius: 999px; display: grid; place-items: center; cursor: pointer; }
.themebtn:hover { color: var(--ink); border-color: var(--ink-soft); }
.themebtn .ico-moon { display: none; }
:root[data-theme="dark"] .themebtn .ico-sun { display: none; }
:root[data-theme="dark"] .themebtn .ico-moon { display: block; }
.hamburger, .navtoggle { display: none; }

/* ---- Hero ---- */
.hero {
  position: relative;
  display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 2rem; align-items: center;
  padding: 3rem 0 1.5rem;
}
.hero-copy { position: relative; z-index: 2; padding-left: 1.5rem; }
.hero-copy h1 { font-size: clamp(2.4rem, 5.2vw, 4rem); line-height: 1.08; margin: 0; }
.hero-copy h1 span { display: block; }
.rule { width: 46px; height: 1px; background: var(--ink-soft); margin: 1.6rem 0 1rem; }
.heart { color: var(--ink-soft); display: block; }
.lede { color: var(--ink-soft); max-width: 24ch; margin: .6rem 0 0; font-size: 1.02rem; }

.botanical { position: absolute; color: var(--leaf); opacity: .8; pointer-events: none; }
.bot-left { left: -6px; top: 8%; height: 200px; }
.bot-right { right: -14px; bottom: -30px; height: 240px; z-index: 0; }

/* collage */
.collage { position: relative; min-height: 440px; }
.snap {
  background: var(--frame); padding: 10px 10px 14px; box-shadow: var(--shadow);
  border-radius: 2px; margin: 0; position: absolute; cursor: zoom-in;
  transition: transform .2s ease;
}
.snap img, .snap .ph { width: 100%; display: block; object-fit: cover; border-radius: 1px; }
.tilt-l { transform: rotate(-3deg); }
.tilt-r { transform: rotate(2.5deg); }
.snap:hover { transform: rotate(0) scale(1.015); z-index: 6 !important; }
.snap-big { width: 56%; left: 2%; top: 18px; z-index: 1; }
.snap-big img, .snap-big .ph { aspect-ratio: 4/3; }
.snap-art { width: 38%; right: 6%; top: 0; z-index: 3; }
.snap-art img, .snap-art .ph { aspect-ratio: 1/1; }
.snap-small { width: 47%; right: 0; bottom: 0; z-index: 2; }
.snap-small img, .snap-small .ph { aspect-ratio: 4/3; }

/* washi tape */
.tape { position: absolute; background: var(--tape); width: 78px; height: 26px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.tape-top { top: -12px; left: 50%; transform: translateX(-50%) rotate(-2deg); }
.tape-corner { top: -10px; right: -8px; transform: rotate(38deg); width: 64px; }

/* placeholders */
.ph { display: grid; place-items: center; background: var(--paper-2); color: var(--muted); }
.ph span { font-family: "Fraunces", serif; font-style: italic; font-size: 1.1rem; }
.ph-art { background: repeating-linear-gradient(45deg, var(--paper-2), var(--paper-2) 12px, var(--card) 12px, var(--card) 24px); }

.intro-blurb { max-width: 60ch; margin: 1rem auto 0; text-align: center; color: var(--ink-soft); font-size: 1.05rem; }

/* ---- Feature cards ---- */
.feature-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; margin: 3rem 0 1rem; }
.fcard {
  display: flex; align-items: center; gap: 1rem; padding: 1.4rem 1.5rem;
  background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); transition: transform .18s ease, box-shadow .18s ease;
}
.fcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.fcard svg { color: var(--ink-soft); flex-shrink: 0; }
.fcard h3 { margin: 0; font-size: 1.25rem; letter-spacing: .02em; }
.fcard p { margin: .15rem 0 0; color: var(--muted); font-size: .92rem; }

/* ---- Page heads ---- */
.page-head { text-align: center; padding: 2.6rem 0 1.6rem; position: relative; }
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: .75rem; color: var(--muted); margin: 0 0 .4rem; }
.page-head h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); margin: 0; }
.page-sub { color: var(--ink-soft); margin: .6rem auto 0; max-width: 50ch; }
.back { position: absolute; left: 0; top: 2.8rem; color: var(--muted); letter-spacing: .04em; font-size: .9rem; }
.back:hover { color: var(--ink); }

/* ---- Adventure map ---- */
.map-section { margin: 0 auto 2.5rem; max-width: 980px; }
.adventure-map {
  height: 440px; border-radius: var(--radius); border: 1px solid var(--card-edge);
  box-shadow: var(--shadow-sm); background: var(--paper-2); z-index: 0;
}
.map-empty { text-align: center; }
.photo-pin img {
  width: 48px; height: 48px; object-fit: cover; border-radius: 50%;
  border: 3px solid var(--frame); box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.photo-popup .leaflet-popup-content-wrapper { border-radius: var(--radius); background: var(--card); color: var(--ink); }
.photo-popup .leaflet-popup-content { margin: .7rem .8rem; text-align: center; }
.photo-popup .leaflet-popup-tip { background: var(--card); }
.map-pop img { width: 100%; max-width: 200px; border-radius: 3px; display: block; cursor: zoom-in; }
.map-pop-cap { font-family: "Fraunces", serif; font-style: italic; color: var(--ink-soft); margin: .4rem 0 .2rem; }
.map-pop-link { font-size: .82rem; font-weight: 700; letter-spacing: .03em; }
/* dark mode tiles read better slightly dimmed */
:root[data-theme="dark"] .leaflet-tile { filter: brightness(0.85) contrast(1.05); }

/* ---- Hub grid (Art & Projects) ---- */
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2rem 1.6rem; }
.hubcard { display: block; }
.hubcover { position: relative; background: var(--frame); padding: 12px; box-shadow: var(--shadow-sm); border-radius: 2px; transition: transform .2s ease, box-shadow .2s ease; }
.hubcard:hover .hubcover { transform: translateY(-4px) rotate(-1deg); box-shadow: var(--shadow); }
.hubcover img, .hubcover .ph { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.hubmeta { text-align: center; margin-top: .8rem; }
.hubmeta h3 { margin: 0; font-size: 1.4rem; }
.count { color: var(--muted); font-size: .85rem; }
.album-badge { position: absolute; bottom: 18px; right: 18px; background: rgba(70,63,53,.85); color: #fff; font-size: .8rem; font-weight: 700; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 999px; display: grid; place-items: center; }
.album-del { text-align: center; margin-top: .4rem; }

/* admin tip + manage links */
.admin-tip { max-width: 60ch; margin: 1.5rem auto 0; text-align: center; color: var(--ink-soft); font-size: .92rem; background: var(--card); border: 1px dashed var(--card-edge); border-radius: var(--radius); padding: .8rem 1.2rem; }
.manage-links { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1rem; }
.ghostlink { border: 1px solid var(--card-edge); border-radius: 999px; padding: .35rem .9rem; font-size: .85rem; font-weight: 600; color: var(--ink-soft); }
.ghostlink:hover { border-color: var(--ink-soft); color: var(--ink); }
.rename-inline { display: flex; gap: .5rem; justify-content: center; margin-top: .8rem; flex-wrap: wrap; }
.rename-inline input[type=text] { width: auto; min-width: 200px; }
.rename-inline input[type=date] { width: auto; }

/* featured flag + per-photo actions */
.feat-flag { position: absolute; top: 14px; left: 14px; background: var(--leaf); color: #fff; width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; font-size: .9rem; box-shadow: var(--shadow-sm); }
.card-photo { position: relative; }
.is-featured { outline: 2px solid var(--leaf); outline-offset: 2px; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .4rem; }
.card-actions button { font-size: .78rem; padding: .3rem .6rem; }
button.ghost { background: transparent; border-color: var(--card-edge); color: var(--ink-soft); }
button.ghost:hover { border-color: var(--leaf); color: var(--ink); }

/* ---- Masonry gallery ---- */
.masonry { columns: 3 260px; column-gap: 1.2rem; }
.card-photo {
  break-inside: avoid; margin: 0 0 1.2rem; background: var(--frame); padding: 10px 10px 12px;
  box-shadow: var(--shadow-sm); border-radius: 2px; cursor: zoom-in; transition: transform .18s ease, box-shadow .18s ease;
}
.card-photo:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.card-photo img { width: 100%; display: block; border-radius: 1px; }
.card-photo figcaption { padding: .6rem .2rem .1rem; font-family: "Fraunces", serif; font-style: italic; color: var(--ink-soft); font-size: .95rem; }
.card-admin { margin-top: .5rem; padding-top: .5rem; border-top: 1px dashed var(--card-edge); cursor: default; }
.card-admin .cap { display: flex; gap: .3rem; margin-bottom: .35rem; }
.card-admin input[type=text] { flex: 1; min-width: 0; }
.empty { text-align: center; color: var(--muted); font-style: italic; padding: 2rem 0; }

/* ---- About ---- */
.about-wrap { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 2.5rem; align-items: center; max-width: 900px; margin: 0 auto; }
.about-photo .snap { position: static; }
.about-photo img, .about-photo .ph { aspect-ratio: 4/5; }
.about-text h2 { font-size: 2rem; margin: 0 0 1rem; }
.about-text p { color: var(--ink-soft); font-size: 1.08rem; }

/* ---- Journal ---- */
.journal-list { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 2.5rem; }
.entry { display: grid; grid-template-columns: 220px 1fr; gap: 1.6rem; align-items: start; }
.entry:nth-child(even) { grid-template-columns: 1fr 220px; }
.entry:nth-child(even) .entry-photo { order: 2; }
.entry-photo { position: relative; margin: 0; background: var(--frame); padding: 10px; box-shadow: var(--shadow-sm); cursor: zoom-in; }
.entry-photo img { width: 100%; display: block; aspect-ratio: 1/1; object-fit: cover; }
.entry-body time { color: var(--muted); font-size: .85rem; letter-spacing: .04em; }
.entry-body h2 { font-size: 1.6rem; margin: .2rem 0 .6rem; }
.entry-body p { color: var(--ink-soft); margin: 0; }

/* ---- Contact ---- */
.contact-wrap { text-align: center; max-width: 460px; margin: 1rem auto; }
.heart.big { color: var(--leaf); margin: 0 auto 1rem; }
.contact-note { color: var(--ink-soft); font-size: 1.1rem; }
.contact-email { display: inline-block; margin-top: 1rem; font-family: "Fraunces", serif; font-size: 1.5rem; border-bottom: 1px solid var(--line); padding-bottom: .2rem; }

/* ---- Cards / forms ---- */
.card { background: var(--card); border: 1px solid var(--card-edge); border-radius: var(--radius); padding: 1.5rem 1.6rem; box-shadow: var(--shadow-sm); }
.card h3 { margin-top: 0; font-size: 1.35rem; }
.login-wrap { max-width: 420px; margin: 0 auto; }
.compose { max-width: 760px; margin: 0 auto 2.5rem; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack label { display: flex; flex-direction: column; gap: .35rem; font-weight: 600; font-size: .9rem; color: var(--ink-soft); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
input, select, textarea {
  font: inherit; padding: .65rem .75rem; border: 1px solid var(--card-edge); border-radius: var(--radius);
  background: var(--paper); color: var(--ink); width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leaf); }
button { font: inherit; font-weight: 700; cursor: pointer; border: 1px solid var(--card-edge); border-radius: var(--radius); padding: .6rem 1.2rem; background: var(--paper-2); color: var(--ink); }
button:hover { border-color: var(--ink-soft); }
button.primary { background: var(--leaf); border-color: var(--leaf); color: #fff; }
button.primary:hover { filter: brightness(1.05); }
button.danger { background: transparent; color: #b4543f; border-color: transparent; padding-left: 0; }
button.small { font-size: .8rem; padding: .3rem 0; margin-top: .6rem; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.admin-grid .span2 { grid-column: 1 / -1; }
.linkedit { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: .5rem; align-items: center; }
.chk { flex-direction: row !important; align-items: center; gap: .35rem; white-space: nowrap; font-weight: 500; }
.hint { color: var(--muted); font-size: .85rem; }
.error { color: #b4543f; font-weight: 600; }
.ok { text-align: center; color: var(--leaf); font-weight: 700; }

/* ---- Lightbox ---- */
.lightbox { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; padding: 2rem; background: rgba(30, 24, 18, .9); backdrop-filter: blur(4px); }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 80vh; border-radius: 4px; box-shadow: 0 20px 60px rgba(0,0,0,.55); background: #fff; padding: 8px; }
.lb-caption { color: #f3ede2; font-family: "Fraunces", serif; font-style: italic; text-align: center; max-width: 80vw; }
.lb-close { position: absolute; top: 1rem; right: 1.4rem; font-size: 2rem; line-height: 1; background: transparent; border: none; color: #f3ede2; cursor: pointer; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); border: none; color: #fff; font-size: 2.4rem; line-height: 1; width: 56px; height: 72px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; transition: background .15s ease; }
.lb-nav:hover { background: rgba(255,255,255,.25); }
.lb-prev { left: 1.2rem; }
.lb-next { right: 1.2rem; }
@media (max-width: 600px) { .lb-nav { width: 44px; height: 60px; font-size: 1.8rem; } .lb-prev { left: .3rem; } .lb-next { right: .3rem; } }
.photo-date { display: block; font-family: "Mulish", sans-serif; font-style: normal; font-size: .78rem; color: var(--muted); letter-spacing: .03em; margin-top: .15rem; }

/* ---- Footer ---- */
footer { text-align: center; color: var(--muted); padding: 3rem 1rem 3.5rem; border-top: 1px solid var(--line); margin-top: 2rem; }
.ampersand { font-family: "Fraunces", serif; font-size: 2rem; color: var(--leaf); display: block; line-height: 1; }
footer p { margin: .4rem 0 0; font-size: .85rem; letter-spacing: .04em; }
.footlinks { margin-top: .8rem; }
.footlinks a { color: var(--muted); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 600; }
.footlinks a:hover { color: var(--ink); }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .hero-copy { padding-left: 0; text-align: center; }
  .hero-copy h1 span { display: inline; }
  .rule, .heart { margin-left: auto; margin-right: auto; }
  .lede { max-width: none; }
  .collage { position: static; display: flex; flex-wrap: wrap; justify-content: center; gap: 1.2rem; min-height: 0; margin-top: 1.5rem; }
  .snap { position: static; width: 70% !important; max-width: 320px; }
  .bot-left, .bot-right { display: none; }
  .about-wrap { grid-template-columns: 1fr; }
  .entry, .entry:nth-child(even) { grid-template-columns: 1fr; }
  .entry:nth-child(even) .entry-photo { order: 0; }
  .entry-photo { max-width: 320px; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .feature-cards { grid-template-columns: 1fr; }
  .hamburger { display: flex; flex-direction: column; gap: 5px; cursor: pointer; padding: 6px; z-index: 30; }
  .hamburger span { width: 24px; height: 2px; background: var(--ink); display: block; }
  .topbar { flex-wrap: wrap; }
  .topbar nav {
    flex-basis: 100%; flex-direction: column; align-items: flex-start; gap: 1rem;
    max-height: 0; overflow: hidden; transition: max-height .25s ease; padding-top: 0;
  }
  .navtoggle:checked ~ nav { max-height: 420px; padding-top: 1rem; }
  .two { grid-template-columns: 1fr; }
}
