/* Long Island Dentists Magazine — coastal editorial theme */
:root {
  --navy: #0f2a44;
  --navy-2: #173a5c;
  --ocean: #1f6f78;
  --sea: #3a9ca6;
  --foam: #d8eef0;
  --sand: #f3ebdd;
  --dune: #e6d8bf;
  --coral: #d9714e;
  --gold: #e9c27d;
  --kelly: #389839;       /* Long Island Dentists logo green */
  --kelly-dark: #26792a;
  --ink: #1c2430;
  --muted: #5e6b78;
  --paper: #fbf8f2;
  --line: #e4ddd0;
  --serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --body: "Source Serif 4", Georgia, serif;
  --sans: "Inter", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--navy);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: var(--ocean); }
img { max-width: 100%; display: block; }

/* ---------- Top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--bar-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 16px;
  background: rgba(15, 42, 68, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: #fff; font-family: var(--sans);
}
.brand { display: flex; align-items: center; gap: 10px; line-height: 1.1; text-decoration: none; color: #fff; min-width: 0; }
.brand-logo { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.18); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand b { font-family: var(--serif); font-size: 18px; font-weight: 700; letter-spacing: .01em; }
.brand-text > span { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; opacity: .75; }

/* Long Island Dentists logo seal (cover) */
.seal { width: 84px; height: 84px; margin: 0 auto 10px; border-radius: 50%; display: block;
  box-shadow: 0 0 0 3px rgba(255,255,255,.22), 0 10px 26px rgba(0,0,0,.25); }
.topbar .right { display: flex; align-items: center; gap: 10px; }
.counter { font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; white-space: nowrap; }
.btn {
  font-family: var(--sans); font-weight: 600; font-size: 13px;
  border: 0; border-radius: 999px; padding: 9px 16px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .15s ease, background .15s ease;
}
.btn:active { transform: scale(.97); }
.btn-coral { background: var(--coral); color: #fff; }
.btn-coral:hover { background: #c75f3d; }
.btn-ghost { background: rgba(255,255,255,.12); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.2); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-outline { background: transparent; color: var(--navy); border: 1.5px solid var(--navy); }

/* ---------- Progress ---------- */
.progress {
  position: fixed; left: 0; right: 0; top: var(--bar-h); height: 3px; z-index: 21;
  background: rgba(255,255,255,.12);
}
.progress i { display: block; height: 100%; width: 0; background: var(--kelly); transition: width .25s ease; }

/* ---------- Reader (horizontal swipe) ---------- */
.reader {
  position: fixed; inset: var(--bar-h) 0 0 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.reader::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%; width: 100%; height: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  overflow-y: auto; overflow-x: hidden;
  background: var(--paper);
  position: relative;
}
.sheet { max-width: 760px; margin: 0 auto; padding: 44px 28px 36px; }
.page-num {
  padding: 0 0 70px; text-align: center;
  font: 600 11px var(--sans); letter-spacing: .2em; color: var(--muted); opacity: .7;
}

/* Desktop arrows */
.nav-arrow {
  position: fixed; top: 50%; z-index: 15; transform: translateY(-50%);
  width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(15,42,68,.85); color: #fff; font-size: 22px;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
}
.nav-arrow:hover { background: var(--ocean); }
.nav-arrow[disabled] { opacity: .25; cursor: default; }
.nav-prev { left: 18px; }
.nav-next { right: 18px; }
@media (min-width: 900px) { .nav-arrow { display: flex; } }

/* Swipe hint (phone, first visit) */
.swipe-hint {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 25;
  background: rgba(15,42,68,.92); color: #fff; font: 600 13px var(--sans);
  padding: 10px 16px; border-radius: 999px; pointer-events: none; white-space: nowrap;
  animation: nudge 1.6s ease-in-out infinite; transition: opacity .4s ease;
}
.swipe-hint.hide { opacity: 0; }
@keyframes nudge { 0%,100% { transform: translateX(-50%); } 50% { transform: translateX(calc(-50% - 10px)); } }

/* ---------- Type ---------- */
.kicker {
  font: 700 11px var(--sans); letter-spacing: .22em; text-transform: uppercase;
  color: var(--ocean); margin-bottom: 10px; display: flex; align-items: center; gap: 10px;
}
.kicker::before { content: ""; width: 26px; height: 2px; background: var(--kelly); }
h1, h2, h3 { font-family: var(--serif); color: var(--navy); margin: 0; }
h1 { font-size: clamp(34px, 6.4vw, 54px); line-height: 1.05; margin-bottom: 16px; }
h2 { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; margin-bottom: 14px; }
h3 { font-size: 21px; margin: 28px 0 10px; }
p { font-size: 18px; line-height: 1.65; margin: 0 0 16px; }
.lede { font-size: 21px; font-style: italic; color: #34404d; line-height: 1.5; }
.dropcap::first-letter {
  float: left; font-family: var(--serif); font-size: 64px; line-height: .9;
  padding: 6px 10px 0 0; color: var(--coral);
}
.byline { font: 500 13px var(--sans); color: var(--muted); margin-bottom: 22px; }
.todo {
  background: #fff6e0; border: 1px dashed #d9b35c; color: #7a5a12;
  font: 500 14px/1.5 var(--sans); padding: 10px 14px; border-radius: 8px; margin: 0 0 16px;
}
.todo::before { content: "To add: "; font-weight: 700; }

/* ---------- Photo placeholders ---------- */
.photo {
  position: relative; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, var(--dune), var(--foam));
  min-height: 220px; display: flex; align-items: flex-end;
  margin: 18px 0;
}
.photo img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo .cap {
  position: relative; z-index: 1; width: 100%;
  font: 500 13px var(--sans); color: var(--navy);
  background: rgba(255,255,255,.75); padding: 8px 12px;
}
.photo.tall { min-height: 340px; }
.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gallery .photo { margin: 0; min-height: 170px; }
.gallery .photo.wide { grid-column: span 2; min-height: 220px; }

/* ---------- Cover ---------- */
.page.cover { background: var(--navy); color: #fff; }
.cover .sheet { min-height: 100%; display: flex; flex-direction: column; padding-top: 28px; padding-bottom: 60px; }
.cover-photo {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(58,156,166,.55), transparent 60%),
    linear-gradient(180deg, #0f2a44 0%, #173a5c 55%, #1f6f78 100%);
}
.cover-photo img { width: 100%; height: 100%; object-fit: cover; opacity: .85; }
.cover-photo::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,42,68,.55) 0%, rgba(15,42,68,0) 30%, rgba(15,42,68,.15) 55%, rgba(15,42,68,.92) 100%);
}
.waves { position: absolute; left: 0; right: 0; bottom: 0; height: 120px; opacity: .35; }
.cover .sheet > * { position: relative; z-index: 2; }
.masthead { text-align: center; border-bottom: 1px solid rgba(255,255,255,.35); padding-bottom: 14px; }
.masthead .small { font: 600 11px var(--sans); letter-spacing: .3em; text-transform: uppercase; opacity: .85; }
.masthead .title { font-family: var(--serif); font-weight: 800; font-size: clamp(40px, 10vw, 76px); line-height: 1; margin: 6px 0 4px; letter-spacing: -.01em; }
.masthead .title em { font-style: italic; font-weight: 600; color: var(--gold); }
.cover .spacer { flex: 1; min-height: 160px; display: flex; align-items: center; justify-content: center; }
.cover .photo-note {
  font: 500 13px var(--sans); color: rgba(255,255,255,.7);
  border: 1.5px dashed rgba(255,255,255,.35); border-radius: 12px; padding: 14px 18px; text-align: center; max-width: 340px;
}
.cover .story-kicker { font: 700 12px var(--sans); letter-spacing: .25em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.cover h1 { color: #fff; font-size: clamp(34px, 7vw, 58px); margin-bottom: 10px; }
.cover .dek { font-size: 19px; line-height: 1.5; opacity: .92; max-width: 560px; }
.cover-lines { display: grid; gap: 8px; margin: 22px 0 0; padding: 16px 0 0; border-top: 1px solid rgba(255,255,255,.3); }
.cover-lines div { font: 600 14px var(--sans); }
.cover-lines div span { color: var(--gold); margin-right: 8px; }
.cover .issue-line { display: flex; justify-content: space-between; margin-top: 20px; font: 600 11px var(--sans); letter-spacing: .18em; text-transform: uppercase; opacity: .75; }

/* ---------- Contents ---------- */
.toc { list-style: none; padding: 0; margin: 10px 0 0; }
.toc a {
  display: flex; align-items: baseline; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink);
}
.toc a:hover .t { color: var(--ocean); }
.toc .n { font: 700 14px var(--sans); color: var(--coral); min-width: 26px; }
.toc .t { font-family: var(--serif); font-size: 20px; flex: 1; transition: color .15s; }
.toc .s { font: 500 12px var(--sans); color: var(--muted); }
.signature { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--navy); margin: 6px 0 0; }

/* ---------- Pull quote / fact box ---------- */
.pull {
  margin: 26px 0; padding: 4px 0 4px 22px; border-left: 4px solid var(--coral);
  font-family: var(--serif); font-style: italic; font-size: 25px; line-height: 1.35; color: var(--navy);
}
.pull small { display: block; font: 600 12px var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: 8px; font-style: normal; }
.profile { border-top: 2px solid var(--navy); margin: 22px 0; font-family: var(--sans); }
.profile-row { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.profile-row span { font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ocean); padding-top: 2px; }
.profile-row b { font-weight: 500; font-size: 15px; line-height: 1.45; color: var(--ink); }
@media (max-width: 560px) { .profile-row { grid-template-columns: 1fr; gap: 2px; } }
.facts { background: var(--sand); border-radius: 14px; padding: 20px 22px; margin: 22px 0; font-family: var(--sans); }
.facts h3 { margin: 0 0 12px; font-size: 18px; }
.facts dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0; font-size: 15px; }
.facts dt { font-weight: 700; color: var(--navy); }
.facts dd { margin: 0; }

/* ---------- Video ---------- */
.video {
  position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden;
  background: linear-gradient(135deg, var(--navy), var(--ocean)); margin: 20px 0;
  cursor: pointer; border: 0; width: 100%; padding: 0; display: block; color: #fff; text-align: left;
}
.video.vertical { aspect-ratio: 9 / 16; max-width: 320px; margin-left: auto; margin-right: auto; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video .play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 70px; height: 70px; border-radius: 50%; background: var(--coral);
  display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.video .play::after { content: ""; border-left: 22px solid #fff; border-top: 13px solid transparent; border-bottom: 13px solid transparent; margin-left: 5px; }
.video .vlabel { position: absolute; left: 16px; right: 16px; bottom: 14px; font: 600 14px var(--sans); }
.video .vlabel small { display: block; font-weight: 500; opacity: .75; margin-top: 2px; }
.video.empty { cursor: default; }
.video.empty .play { background: rgba(255,255,255,.2); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0; }
.stat { background: var(--navy); color: #fff; border-radius: 14px; padding: 20px 18px; }
.stat .num { font-family: var(--serif); font-size: 40px; font-weight: 700; color: var(--gold); line-height: 1; }
.stat .lbl { font: 500 14px/1.4 var(--sans); margin-top: 8px; opacity: .92; }
.stat .src { font: 500 11px var(--sans); margin-top: 8px; opacity: .6; }

/* ---------- Poll ---------- */
.poll { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 22px; margin: 20px 0; box-shadow: 0 8px 30px rgba(15,42,68,.06); }
.poll .q { font-family: var(--serif); font-size: 22px; color: var(--navy); margin: 0 0 16px; }
.poll-opts { display: grid; gap: 10px; }
.poll-opt {
  position: relative; overflow: hidden; text-align: left;
  font: 600 16px var(--sans); color: var(--navy);
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 15px 16px; cursor: pointer; transition: border-color .15s, transform .1s;
}
.poll-opt:hover { border-color: var(--sea); }
.poll-opt:active { transform: scale(.99); }
.poll-opt.chosen { border-color: var(--ocean); background: var(--foam); }
.poll-opt.chosen::after { content: "✓ Your vote"; float: right; font-size: 13px; color: var(--ocean); }
.poll.voted .poll-opt:not(.chosen) { opacity: .55; }
.poll-thanks { display: none; font: 500 14px var(--sans); color: var(--ocean); margin-top: 14px; }
.poll.voted .poll-thanks { display: block; }

/* ---------- Directory ---------- */
.dir { display: grid; gap: 12px; margin: 18px 0; }
.dir-card {
  display: flex; gap: 14px; align-items: center; background: #fff;
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px;
}
.dir-card .avatar {
  width: 52px; height: 52px; border-radius: 50%; flex: 0 0 52px;
  background: linear-gradient(135deg, var(--ocean), var(--navy)); color: #fff;
  display: flex; align-items: center; justify-content: center; font: 700 17px var(--sans);
}
.dir-card b { font-family: var(--serif); font-size: 18px; color: var(--navy); display: block; }
.dir-card span { font: 500 13px var(--sans); color: var(--muted); }
.badge { display: inline-block; font: 700 10px var(--sans); letter-spacing: .12em; text-transform: uppercase; background: var(--sand); color: var(--ocean); padding: 3px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.dir-card.open { border-style: dashed; background: transparent; }
.dir-card.open .avatar { background: var(--dune); color: var(--navy); }

.cta-band {
  background: linear-gradient(135deg, var(--ocean), var(--navy)); color: #fff;
  border-radius: 18px; padding: 24px; margin: 24px 0;
}
.cta-band h3 { color: #fff; margin: 0 0 8px; }
.cta-band p { font-size: 16px; opacity: .92; }

/* ---------- Products ---------- */
.products { display: grid; gap: 12px; margin-top: 18px; }
.product {
  display: block; text-decoration: none; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px;
  transition: border-color .15s, transform .15s;
}
.product:hover { border-color: var(--sea); transform: translateY(-1px); }
.product b { font-family: var(--serif); font-size: 19px; color: var(--navy); display: block; margin-bottom: 4px; }
.product span { font: 400 15px/1.5 var(--sans); color: #3b4652; }
.product em { display: block; font: 600 13px var(--sans); color: var(--ocean); font-style: normal; margin-top: 6px; }

/* ---------- Memes ---------- */
.memes { display: grid; gap: 14px; margin-top: 18px; }
.meme { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.meme .photo { margin: 0; border-radius: 0; min-height: 260px; }
.meme p { font: 600 15px var(--sans); padding: 12px 14px; margin: 0; }

/* ---------- Back cover ---------- */
.page.back { background: var(--navy); color: #fff; }
.back .sheet { min-height: 100%; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.back h2 { color: #fff; }
.back p { opacity: .9; }
.back .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0 28px; }
.back .fine { font: 400 12px/1.6 var(--sans); opacity: .6; margin-top: 30px; }
.back a { color: var(--gold); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font: 600 14px var(--sans);
  padding: 12px 18px; border-radius: 999px; z-index: 40; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Page counter button + all-pages grid ---------- */
button.counter {
  font-family: var(--sans); color: #fff; background: transparent; border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px; padding: 7px 12px 7px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; opacity: 1;
}
button.counter::before {
  content: ""; width: 11px; height: 11px; flex: 0 0 11px; opacity: .85;
  background:
    linear-gradient(#fff,#fff) 0 0/4px 4px, linear-gradient(#fff,#fff) 7px 0/4px 4px,
    linear-gradient(#fff,#fff) 0 7px/4px 4px, linear-gradient(#fff,#fff) 7px 7px/4px 4px;
  background-repeat: no-repeat;
}
button.counter:hover { background: rgba(255,255,255,.1); }
.c-short { display: none; }

.pages-grid {
  position: fixed; inset: 0; z-index: 50; background: rgba(10,26,43,.78);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  overflow-y: auto; padding: 22px 18px 40px; opacity: 0; transition: opacity .2s ease;
}
.pages-grid.open { opacity: 1; }
.pg-head { max-width: 900px; margin: 0 auto 16px; display: flex; justify-content: space-between; align-items: center; color: #fff; }
.pg-head b { font: 700 24px var(--serif); }
.pg-close { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 16px; cursor: pointer; }
.pg-list { list-style: none; margin: 0 auto; padding: 0; max-width: 900px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.pg-card {
  width: 100%; aspect-ratio: 3 / 4; text-align: left; cursor: pointer; border: 0; border-radius: 12px;
  background: var(--paper); color: var(--navy); padding: 14px; display: flex; flex-direction: column;
  box-shadow: 0 10px 26px rgba(0,0,0,.25); transform: translateY(8px); transition: transform .25s ease, box-shadow .2s;
  position: relative; overflow: hidden;
}
.pages-grid.open .pg-card { transform: none; }
.pg-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30%;
  background: linear-gradient(180deg, transparent, rgba(58,156,166,.16)); }
.pg-card:hover, .pg-card:focus-visible { box-shadow: 0 0 0 3px var(--gold), 0 10px 26px rgba(0,0,0,.25); outline: none; }
.pg-card.here { box-shadow: 0 0 0 3px var(--coral), 0 10px 26px rgba(0,0,0,.25); }
.pg-card.is-cover { background: linear-gradient(160deg, var(--navy), var(--ocean)); color: #fff; }
.pg-num { font: 800 34px var(--serif); color: var(--coral); line-height: 1; }
.is-cover .pg-num { color: var(--gold); }
.pg-kick { font: 700 10px var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--ocean); margin-top: auto; }
.is-cover .pg-kick { color: var(--foam); }
.pg-title { font: 700 17px/1.2 var(--serif); margin-top: 4px; }

/* ---------- Page-turn feel (values set by reader.js while swiping) ---------- */
.page { --d: 0; --ad: 0; }
.page > .sheet, .page > .page-num {
  transform: perspective(1400px) rotateY(calc(var(--d) * -9deg)) scale(calc(1 - var(--ad) * .05));
  transform-origin: calc(50% - var(--d) * 50%) 50%;
  will-change: transform;
}
.page::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: linear-gradient(calc(90deg + var(--d) * 0deg), rgba(15,42,68,calc(var(--ad) * .35)), rgba(15,42,68,calc(var(--ad) * .08)));
}

/* ---------- Phone tweaks ---------- */
@media (max-width: 560px) {
  :root { --bar-h: 52px; }
  .sheet { padding: 30px 20px 30px; }
  .c-long { display: none; }
  .c-short { display: inline; }
  button.counter { padding: 7px 10px; }
  .topbar { gap: 8px; padding: 0 12px; }
  .brand b { font-size: 16px; white-space: nowrap; }
  .brand-text > span { letter-spacing: .16em; white-space: nowrap; }
  .brand-logo { width: 34px; height: 34px; flex-basis: 34px; }
  .topbar .right { gap: 6px; }
  .topbar .btn-coral { white-space: nowrap; padding: 8px 12px; }
  .pg-list { grid-template-columns: repeat(2, 1fr); }
  .topbar .btn-ghost { display: none; }
  p { font-size: 17px; }
  .stats { grid-template-columns: 1fr; }
  .gallery .photo { min-height: 130px; }
  .cover .issue-line span:last-child { display: none; }
  .cover .issue-line { justify-content: center; letter-spacing: .12em; }
}
@media (max-width: 420px) {
  /* The logo itself reads "Long Island Dentists", so drop the text on small phones. */
  .topbar .brand-text { display: none; }
  .brand-logo { width: 38px; height: 38px; flex-basis: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .reader { scroll-behavior: auto; }
  .swipe-hint { animation: none; }
  .page > .sheet, .page > .page-num { transform: none; }
  .page::after { display: none; }
  .pages-grid, .pg-card { transition: none; }
}
