/* ============================================================
   JACKSON CRAIG — First Ones Here
   style.css
   ============================================================ */

/* ------------------------------------------------------------
   RESET & BASE
------------------------------------------------------------ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Palette — aged paper, worn ink, rust, forest */
  --color-paper:       #e8dfc8;   /* aged parchment */
  --color-ink:         #1c1a14;   /* deep sepia-black */
  --color-rust:        #9b3a2a;   /* worn red — pin color */
  --color-rust-light:  #c4503d;
  --color-sepia:       #7a6444;   /* mid-tone warm brown */
  --color-muted:       #b5a88a;   /* faded label text */
  --color-postcard:    #f5edd8;   /* postcard face */
  --color-stamp:       #4a3728;   /* stamp dark */
  --color-overlay:     rgba(28, 26, 20, 0.55);

  /* Type */
--font-display: 'Special Elite', 'Courier New', monospace;
--font-body:    'Crimson Text', Georgia, serif;

  /* Timing */
  --transition-fast: 0.18s ease;
  --transition-med:  0.35s ease;
  --flip-duration:   0.6s;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden; /* map fills viewport — no scroll on body */
  background: var(--color-paper);
  font-family: var(--font-body);
  color: var(--color-ink);
}


/* ------------------------------------------------------------
   MAP STAGE
   Full-viewport container. Map image scales to fit.
------------------------------------------------------------ */
.map-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  user-select: none;
}

/* ------------------------------------------------------------
   HEADER — "Jackson Craig" over Great Lakes
   Positioned absolutely over the map image.
   left/top match the open water region in the sketch.
------------------------------------------------------------ */
.map-header {
  position: absolute;
  left: 58%;
  top: 2%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  z-index: 10;
}

.site-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  font-weight: 400;
  color: var(--color-ink);
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow:
    1px 1px 0 var(--color-paper),
   -1px -1px 0 var(--color-paper),
    2px 2px 8px rgba(28,26,20,0.15);
  opacity: 0.82;
}

.site-subtitle {
  font-family: var(--font-display);
  font-size: clamp(0.65rem, 1.1vw, 0.9rem);
  font-style: normal;
  color: var(--color-sepia);
  letter-spacing: 0.28em;
  margin-top: 0.45em;
  text-transform: uppercase;
  text-shadow: 1px 1px 3px var(--color-paper);
  opacity: 0.75;
}


/* ------------------------------------------------------------
   MAP PINS — vintage star markers
------------------------------------------------------------ */
.map-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25em;
  z-index: 20;
  padding: 0.4em;
}

.pin-label--above {
  flex-direction: column-reverse;
}

.pin-dot {
  display: block;
  opacity: 0.65;
  position: relative;
  width: clamp(10px, 1.2vw, 16px);
  height: clamp(10px, 1.2vw, 16px);
  flex-shrink: 0;
  background: var(--color-rust);
  clip-path: polygon(
    50% 0%,
    61% 35%,
    98% 35%,
    68% 57%,
    79% 91%,
    50% 70%,
    21% 91%,
    32% 57%,
    2%  35%,
    39% 35%
  );
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.pin-anchor {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(10px, 1.2vw, 16px);
  height: clamp(10px, 1.2vw, 16px);
  flex-shrink: 0;
  margin-top: calc(clamp(10px, 1.2vw, 16px) * -0.5);
  margin-left: calc(clamp(10px, 1.2vw, 16px) * -0.5);
}

.pin-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%) scale(1);
  border-radius: 50%;
  border: 0.3px solid var(--color-rust);
  animation: pulse 5s ease-out infinite;
  opacity: 0;
  pointer-events: none;
}

@keyframes pulse {
  0%   { transform: translate(-50%, -50%) scale(1);    opacity: 0.2; }
  100% { transform: translate(-50%, -50%) scale(15);  opacity: 0; }
}

.pin-label {
  font-family: var(--font-display);
  font-size: clamp(0.55rem, 0.85vw, 0.75rem);
  color: var(--color-rust);
  white-space: nowrap;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow:
    1px  1px 0 rgba(232,223,200,0.9),
   -1px -1px 0 rgba(232,223,200,0.9),
    1px -1px 0 rgba(232,223,200,0.9),
   -1px  1px 0 rgba(232,223,200,0.9);
  pointer-events: none;
  opacity: 0.88;
}

.map-pin:hover .pin-dot {
  transform: scale(1.35);
  background: var(--color-rust-light);
}

.map-pin:hover .pin-label {
  color: var(--color-rust-light);
  opacity: 1;
}



/* ------------------------------------------------------------
   POSTCARD OVERLAY
------------------------------------------------------------ */
.postcard-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-overlay);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

.postcard-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}


/* ------------------------------------------------------------
   POSTCARD
   Classic landscape postcard ratio ~3:2
   3D flip on the Y axis
------------------------------------------------------------ */
.postcard {
  position: relative;
  width: min(720px, 90vw);
  height: min(480px, 60vw);
  perspective: 1200px;
}

/* The inner wrapper that actually flips */
.postcard-face {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: transform var(--flip-duration) cubic-bezier(0.45, 0.05, 0.55, 0.95);
  overflow: hidden;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 1px 3px rgba(0,0,0,0.2),
    inset 0 0 0 1px rgba(28,26,20,0.08);
}

/* FRONT */
.postcard-front {
  background: var(--color-postcard);
  transform: rotateY(0deg);
  display: grid;
  grid-template-rows: 1fr auto;
  grid-template-columns: 1fr;
}

/* BACK — starts face-down */
.postcard-back {
  background: var(--color-postcard);
  transform: rotateY(180deg);
  display: grid;
  grid-template-columns: 1fr 2px 1fr;
  gap: 0;
}

/* Flipped state */
.postcard.is-flipped .postcard-front {
  transform: rotateY(-180deg);
}

.postcard.is-flipped .postcard-back {
  transform: rotateY(0deg);
}


/* --- FRONT face internals --- */
.postcard-front-image {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.postcard-image-placeholder {
  width: 100%;
  height: 100%;
  background:
    repeating-linear-gradient(
      45deg,
      var(--color-muted) 0px,
      var(--color-muted) 1px,
      transparent 1px,
      transparent 12px
    );
  opacity: 0.3;
}

.postcard-front-footer {
  background: var(--color-postcard);
  padding: 0.5em 1em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--color-muted);
}

.postcard-location {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 700;
  color: var(--color-ink);
  letter-spacing: 0.03em;
}

.postcard-greetings {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.7rem, 1.2vw, 0.9rem);
  color: var(--color-sepia);
}

.postcard-front-content {
  position: absolute;
  bottom: 2.8em;
  left: 0;
  right: 0;
  padding: 1em 1.2em;
  background: rgba(245, 237, 216, 0.9);
  max-height: 55%;
  overflow-y: auto;
  font-size: clamp(0.8rem, 1.3vw, 1rem);
  line-height: 1.6;
}


/* --- BACK face internals --- */
.postcard-back-left {
  padding: 1.5em 1.2em;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.postcard-back-lines {
  flex: 1;
  border-top: 1px solid var(--color-muted);
  margin-top: 2em;
  /* Lined paper effect */
  background-image: repeating-linear-gradient(
    to bottom,
    transparent,
    transparent 27px,
    var(--color-muted) 27px,
    var(--color-muted) 28px
  );
  background-position: 0 28px;
  padding-top: 0.6em;
}

.postcard-back-note {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  line-height: 28px;  /* match ruled lines */
  color: var(--color-sepia);
  white-space: pre-line;
}

.postcard-back-divider {
  width: 2px;
  background: var(--color-muted);
  margin: 1em 0;
}

.postcard-back-right {
  padding: 1.2em 1em;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}

.postcard-stamp {
  width: clamp(40px, 7vw, 64px);
  height: clamp(48px, 8.5vw, 76px);
  border: 3px solid var(--color-stamp);
  display: flex;
  align-items: center;
  justify-content: center;
  /* Perforated edge effect */
  outline: 2px dashed var(--color-muted);
  outline-offset: -6px;
  background: var(--color-paper);
}

.stamp-inner {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.5vw, 1.2rem);
  font-weight: 700;
  color: var(--color-stamp);
  letter-spacing: 0.05em;
}

.postcard-address {
  text-align: right;
  font-family: var(--font-body);
  font-size: clamp(0.65rem, 1vw, 0.8rem);
  line-height: 1.9;
  color: var(--color-sepia);
}

.postcard-address p:first-child {
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 1.2vw, 0.95rem);
  font-weight: 600;
  color: var(--color-ink);
}


/* --- Control buttons --- */
.postcard-flip-btn,
.postcard-close-btn {
  position: absolute;
  z-index: 10;
  background: var(--color-stamp);
  color: var(--color-paper);
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  padding: 0.3em 0.7em;
  transition: background var(--transition-fast);
}

.postcard-flip-btn {
  top: -2em;
  right: 3.5em;
  border-radius: 2px 2px 0 0;
}

.postcard-close-btn {
  top: -2em;
  right: 0;
  border-radius: 2px 2px 0 0;
}

.postcard-flip-btn:hover,
.postcard-close-btn:hover {
  background: var(--color-rust);
}


/* ------------------------------------------------------------
   REDUCED MOTION
------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .pin-dot::after { animation: none; }
  .postcard-face  { transition: none; }
  .postcard-overlay { transition: none; }
}