@font-face { font-family: "Cormorant"; src: url(fonts/cormorant.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url(fonts/cormorant-italic.woff2) format("woff2"); font-style: italic; font-weight: 400; font-display: swap; }
@font-face { font-family: "Caveat"; src: url(fonts/caveat.woff2) format("woff2"); font-weight: 500; font-display: swap; }

:root {
  --paper: #fbf5ef;
  --card: #fffaf4;
  --ink: #4a3f44;
  --muted: #8c7d82;
  --pink: #e88fa5;
  --pink-deep: #d9677f;
  --pink-soft: #f6dbe1;
  --grey: #c4bcbd;
  --sage: #a9bd9b;
  --shadow: 0 10px 30px rgba(110, 70, 80, .14), 0 2px 6px rgba(110, 70, 80, .08);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  background-image: radial-gradient(circle at 15% 0%, #fbe6e6 0, transparent 45%), radial-gradient(circle at 100% 30%, #eef2e6 0, transparent 40%);
  color: var(--ink);
  font: 400 1.18rem/1.5 "Cormorant", Georgia, "Times New Roman", serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { font-weight: 600; line-height: 1.1; margin: 0; }
.script { font-family: "Caveat", "Segoe Print", cursive; color: var(--pink-deep); }

/* Header */
.hero { text-align: center; padding: 2.2rem 1.25rem 0.6rem; max-width: 40rem; margin: 0 auto; animation: rise .9s ease both; }
.hero .script { font-size: 1.45rem; margin: 0 0 .2rem; }
.hero h1 { font-size: clamp(2.6rem, 9vw, 4.2rem); letter-spacing: .01em; }
.heart-glyph { color: var(--pink); display: inline-block; font-size: .7em; vertical-align: .12em; animation: beat 2.4s ease-in-out infinite; }
.lede { font-style: italic; color: var(--muted); font-size: 1.25rem; margin: .6rem auto 0; max-width: 30rem; }

/* Tally */
.tally { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; max-width: 40rem; margin: 1.2rem auto 0; padding: 0 1.25rem; text-align: center; animation: rise .9s .15s ease both; }
.num { display: block; font-size: 2.3rem; font-weight: 600; line-height: 1; font-variant-numeric: lining-nums; }
.label { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.ribbon { position: relative; height: 6px; border-radius: 3px; background: #e9e1e0; }
.ribbon-fill { height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #f3c0cb, var(--pink)); transition: width 2.2s ease; }
.ribbon-heart { position: absolute; top: 50%; left: 0; transform: translate(-50%, -55%); color: var(--pink-deep); font-size: 1.3rem; transition: left 2.2s ease; }
.whereabouts { text-align: center; font-size: 1.4rem; margin: .7rem 1rem 0; min-height: 1.6em; }

/* Map */
main { max-width: 64rem; margin: 0 auto; padding: 0 1rem 2rem; }
.map-frame { margin-top: 1rem; background: var(--card); padding: 8px; border-radius: 18px; box-shadow: var(--shadow); animation: rise .9s .3s ease both; }
#map { height: min(68vh, 620px); min-height: 360px; border-radius: 12px; background: #f3ece2; }
.leaflet-container { font-family: "Cormorant", Georgia, serif; }
.leaflet-tile-pane { filter: sepia(.3) saturate(.6) hue-rotate(-12deg) brightness(1.06) contrast(.9); }
.leaflet-control-attribution { font-size: 11px; background: rgba(255, 250, 244, .85) !important; }
.map-note { text-align: center; color: var(--muted); font-size: 1rem; margin: .4rem 0 0; }

.heart-marker { font-size: 34px; line-height: 1; color: var(--pink-deep); text-shadow: 0 2px 6px rgba(160, 60, 80, .35), 0 0 0 #fff; animation: beat 1.8s ease-in-out infinite; transform-origin: 50% 60%; }
.heart-marker::after { content: ""; position: absolute; left: 50%; top: 55%; width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%; background: rgba(232, 143, 165, .35); animation: ripple 2.4s ease-out infinite; z-index: -1; }
.place-marker { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 3px 10px rgba(90, 60, 70, .3); background: center/cover no-repeat; transition: transform .2s ease; }
.place-marker:hover { transform: scale(1.12); }
.place-marker.reached { border-color: var(--pink); }
.end-marker { font: 500 1.3rem/1 "Caveat", cursive; color: var(--ink); background: var(--card); border-radius: 999px; padding: 4px 10px 5px; box-shadow: 0 2px 8px rgba(90, 60, 70, .25); white-space: nowrap; cursor: pointer; }
.end-marker::before { content: "● "; color: var(--pink); font-size: .8em; }

/* Current postcard and the grid of earlier ones */
section h2 { font-size: 1.9rem; text-align: center; margin-top: 2.4rem; }
.hint, .small { text-align: center; color: var(--muted); font-size: 1rem; margin: .3rem 0 0; }
.preview-note { text-align: center; color: var(--muted); font-style: italic; margin: .2rem 1rem 0; }
.big-card { margin: 1rem auto 0; max-width: 52rem; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); display: grid; grid-template-columns: 1.15fr 1fr; overflow: hidden; transform: rotate(-.4deg); animation: rise .7s ease both; }
.big-card img { width: 100%; height: 100%; min-height: 260px; object-fit: cover; display: block; cursor: pointer; }
.big-note { font: 500 1.45rem/1.25 "Caveat", cursive; color: var(--ink); margin: .2rem 0 0 !important; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .9rem; padding: 1rem .25rem 0; }
.mini { background: var(--card); border-radius: 8px; padding: 5px 5px 7px; box-shadow: 0 4px 12px rgba(110, 70, 80, .12); border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform .2s ease; }
.mini:nth-child(odd) { transform: rotate(-1deg); }
.mini:nth-child(even) { transform: rotate(.8deg); }
.mini:hover, .mini:focus-visible { transform: rotate(0) translateY(-3px); outline: none; }
.mini img { display: block; width: 100%; aspect-ratio: 8 / 5; object-fit: cover; border-radius: 4px; }
.mini strong { display: block; font-size: .98rem; margin: .3rem .15rem 0; line-height: 1.1; }
.mini span { display: block; font-size: .82rem; color: var(--pink-deep); margin: 0 .15rem; }
.dot-marker { width: 14px; height: 14px; border-radius: 50%; background: var(--pink); border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(90, 60, 70, .35); cursor: pointer; }
.leaflet-tooltip.note-bubble { font: 500 1.25rem/1.2 "Caveat", cursive; color: var(--ink); background: var(--card); border: 0; border-radius: 14px; padding: 6px 12px; box-shadow: 0 4px 14px rgba(110, 70, 80, .25); white-space: normal; width: max-content; max-width: 220px; text-align: center; }
.leaflet-tooltip-top.note-bubble::before { border-top-color: var(--card); }

/* Walk form */
.walk form { max-width: 26rem; margin: 1rem auto 0; background: var(--card); padding: 1.3rem 1.3rem 1.4rem; border-radius: 16px; box-shadow: var(--shadow); display: grid; gap: .35rem; }
label { font-size: .9rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-top: .4rem; }
.optional { text-transform: none; letter-spacing: 0; font-style: italic; }
input { font: inherit; font-size: 1.2rem; color: var(--ink); padding: .55rem .8rem; border: 1px solid #e6d9d6; border-radius: 10px; background: #fff; width: 100%; }
input:focus { outline: 2px solid var(--pink-soft); border-color: var(--pink); }
button[type=submit] { margin-top: .9rem; font: 600 1.25rem "Cormorant", Georgia, serif; color: #fff; background: linear-gradient(135deg, #eea3b5, var(--pink-deep)); border: 0; border-radius: 999px; padding: .7rem 1rem; cursor: pointer; box-shadow: 0 6px 16px rgba(217, 103, 127, .35); transition: transform .15s ease; }
button[type=submit]:active { transform: scale(.97); }
button[type=submit]:disabled { opacity: .6; }

.fix { max-width: 26rem; margin: .9rem auto 0; text-align: center; }
.fix summary { cursor: pointer; color: var(--muted); font-size: 1rem; text-decoration: underline dotted; }
.fix form { display: grid; gap: .35rem; text-align: left; margin-top: .6rem; background: var(--card); padding: 1rem 1.2rem; border-radius: 14px; box-shadow: var(--shadow); }
button.quiet { margin-top: .6rem; font: 600 1.1rem "Cormorant", Georgia, serif; color: var(--pink-deep); background: #fff; border: 1.5px solid var(--pink); border-radius: 999px; padding: .5rem 1rem; cursor: pointer; }
.journal .adj { font-style: italic; color: var(--muted); }

/* Journal */
.journal ol { list-style: none; padding: 0; max-width: 30rem; margin: 1rem auto 0; }
.journal li { display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .8rem; align-items: baseline; padding: .7rem .2rem; border-bottom: 1px dashed #e6d9d6; }
.journal .date { color: var(--muted); font-size: 1rem; }
.journal .m { font-weight: 600; }
.journal .msg { grid-column: 1 / -1; font: 500 1.35rem/1.25 "Caveat", cursive; color: var(--pink-deep); }
.journal .remove { display: none; }
.journal.walker .remove { display: inline; background: none; border: 0; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: 0 .3rem; }

footer { max-width: 40rem; margin: 0 auto; padding: 1rem 1.25rem 3rem; color: var(--muted); font-size: 1rem; text-align: center; }
footer strong { color: var(--ink); }

/* Postcard dialog */
.card-backdrop { position: fixed; inset: 0; z-index: 2000; background: rgba(74, 63, 68, .35); display: flex; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(2px); animation: fade .25s ease both; }
.card-backdrop[hidden] { display: none; }
.postcard { position: relative; width: min(92vw, 720px); max-height: 92vh; overflow: auto; background: var(--card); border-radius: 14px; box-shadow: 0 20px 60px rgba(60, 30, 40, .35); display: grid; grid-template-columns: 1.1fr 1fr; animation: card-in .45s cubic-bezier(.2, .9, .3, 1.2) both; transform: rotate(-.6deg); }
.postcard img { width: 100%; height: 100%; object-fit: cover; border-radius: 14px 0 0 14px; display: block; min-height: 240px; }
.card-body { position: relative; padding: 1.5rem 1.4rem 1.3rem; border-left: 1px dashed #e3d3cf; background-image: repeating-linear-gradient(transparent 0 33px, #f1e5e1 33px 34px); background-position: 0 60px; }
.card-body h3 { font-size: 1.8rem; margin: .2rem 0 .6rem; }
.card-body p { margin: 0 0 .8rem; }
.card-status { font-size: 1.4rem; margin-top: .4rem !important; }
.stamp { float: right; margin: -.3rem -.2rem .4rem .8rem; width: 66px; height: 66px; border: 2px dashed var(--pink); border-radius: 50%; display: flex; align-items: center; justify-content: center; text-align: center; font: 600 .78rem/1.05 "Cormorant", serif; color: var(--pink-deep); transform: rotate(12deg); text-transform: uppercase; letter-spacing: .06em; }
.close { position: absolute; top: .4rem; left: .5rem; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 0; background: rgba(255, 250, 244, .9); color: var(--ink); font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }

.toast { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom)); transform: translate(-50%, 30px); background: var(--card); padding: .6rem 1.3rem; border-radius: 999px; box-shadow: var(--shadow); font-size: 1.45rem; opacity: 0; pointer-events: none; transition: opacity .4s ease, transform .4s ease; z-index: 3000; max-width: calc(100vw - 2rem); width: max-content; white-space: normal; overflow-wrap: anywhere; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  body { font-size: 1.1rem; }
  .num { font-size: 1.9rem; }
  .tally { gap: .7rem; }
  #map { height: 62vh; }
  .card-backdrop { align-items: flex-end; padding: 0; }
  .postcard { grid-template-columns: 1fr; width: 100%; max-height: 88vh; border-radius: 18px 18px 0 0; transform: none; animation-name: sheet-in; }
  .postcard img { border-radius: 18px 18px 0 0; min-height: 0; aspect-ratio: 400 / 260; height: auto; }
  .big-card { grid-template-columns: 1fr; transform: none; }
  .big-card img { min-height: 0; aspect-ratio: 8 / 5; height: auto; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: .6rem; }
  .card-body { border-left: 0; border-top: 1px dashed #e3d3cf; padding-bottom: calc(1.4rem + env(safe-area-inset-bottom)); }
}

@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.14); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } }
@keyframes ripple { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.8); opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(30px) rotate(-3deg) scale(.96); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
