/* =========================================================
   PhotoMap v0.1
========================================================= */

:root {
  --bg: #f6f5f1;
  --surface: #ffffff;

  --text: #1e1e1e;
  --text-soft: #77746e;

  --border: rgba(30, 30, 30, 0.1);

  --accent: #263a32;
  --accent-soft: #e8ede9;

  --header-height: 72px;
  --sidebar-width: 310px;

  --shadow: 0 18px 60px rgba(25, 25, 25, 0.14);
}

/* =========================================================
   Base
========================================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
}

body {
  font-family: "Helvetica Neue", "Noto Sans JP", Arial, sans-serif;

  background: var(--bg);
  color: var(--text);

  overflow: hidden;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app {
  height: 100dvh;
}

/* =========================================================
   Header
========================================================= */

.header {
  position: relative;
  z-index: 100;

  height: var(--header-height);

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  padding: 0 28px;

  background: rgba(255, 255, 255, 0.94);

  border-bottom: 1px solid var(--border);

  backdrop-filter: blur(16px);
}

/* Brand */

.brand {
  justify-self: start;

  display: flex;
  align-items: center;
  gap: 12px;

  color: inherit;
  text-decoration: none;
}

.brandIcon {
  width: 38px;
  height: 38px;

  display: grid;
  place-items: center;

  border-radius: 50%;

  background: var(--accent);
  color: white;

  font-family: Georgia, serif;
  font-size: 19px;
}

.brandText {
  display: flex;
  flex-direction: column;
}

.brandName {
  font-family: Georgia, serif;
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brandSub {
  margin-top: 1px;

  color: var(--text-soft);

  font-size: 9px;
  letter-spacing: 0.18em;

  text-transform: uppercase;
}

/* Navigation */

.nav {
  display: flex;
  align-items: center;
  gap: 30px;
}

.navButton {
  position: relative;

  padding: 26px 0 23px;

  background: transparent;

  color: var(--text-soft);

  font-size: 13px;
}

.navButton::after {
  content: "";

  position: absolute;
  left: 0;
  right: 0;
  bottom: 17px;

  height: 1px;

  background: var(--text);

  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.navButton:hover,
.navButton.active {
  color: var(--text);
}

.navButton.active::after {
  transform: scaleX(1);
}

/* New Post */

.addButton {
  justify-self: end;

  height: 40px;

  display: flex;
  align-items: center;
  gap: 7px;

  padding: 0 17px;

  border-radius: 999px;

  background: var(--accent);
  color: white;

  font-size: 12px;

  transition:
    transform 0.18s ease,
    opacity 0.18s ease;
}

.addButton:hover {
  transform: translateY(-1px);
  opacity: 0.9;
}

/* =========================================================
   Main
========================================================= */

.main {
  height: calc(100dvh - var(--header-height));

  display: grid;
  grid-template-columns:
    var(--sidebar-width)
    minmax(0, 1fr);
}

/* =========================================================
   Sidebar
========================================================= */

.sidebar {
  position: relative;
  z-index: 20;

  padding: 34px 28px;

  overflow-y: auto;

  background: var(--surface);

  border-right: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 13px;

  color: var(--text-soft);

  font-size: 9px;
  font-weight: 600;

  letter-spacing: 0.2em;
}

.sidebarHeader h1 {
  margin: 0;

  font-family: Georgia, serif;

  font-size: 35px;
  font-weight: 400;

  line-height: 1.08;
}

.sidebarDescription {
  margin: 17px 0 0;

  color: var(--text-soft);

  font-size: 12px;
}

/* Search */

.searchBox {
  height: 42px;

  display: flex;
  align-items: center;

  margin-top: 32px;

  border-bottom: 1px solid var(--border);
}

.searchIcon {
  margin-right: 8px;

  color: var(--text-soft);

  font-size: 20px;
}

.searchBox input {
  width: 100%;

  border: 0;
  outline: none;

  background: transparent;

  color: var(--text);

  font-size: 12px;
}

.searchBox input::placeholder {
  color: #aaa7a0;
}

/* Filter */

.filterSection {
  margin-top: 32px;
}

.sectionTitle {
  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-bottom: 13px;

  color: var(--text-soft);

  font-size: 10px;
  font-weight: 600;

  letter-spacing: 0.12em;

  text-transform: uppercase;
}

.sectionTitle button {
  padding: 0;

  background: transparent;

  color: var(--text-soft);

  font-size: 9px;
}

/* Tags */

.tagList {
  display: flex;
  flex-wrap: wrap;

  gap: 7px;
}

.tagButton {
  padding: 7px 11px;

  border: 1px solid var(--border);
  border-radius: 999px;

  background: white;

  color: var(--text-soft);

  font-size: 10px;

  transition: 0.18s ease;
}

.tagButton:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tagButton.active {
  border-color: var(--accent);

  background: var(--accent);
  color: white;
}

/* Year */

.yearList {
  display: flex;
  gap: 6px;
}

.yearButton {
  padding: 7px 12px;

  border-radius: 999px;

  background: transparent;

  color: var(--text-soft);

  font-size: 10px;
}

.yearButton.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* Stats */

.sidebarStats {
  display: flex;
  gap: 28px;

  margin-top: 38px;
  padding-top: 22px;

  border-top: 1px solid var(--border);
}

.sidebarStats div {
  display: flex;
  flex-direction: column;
}

.sidebarStats strong {
  font-family: Georgia, serif;
  font-size: 23px;
  font-weight: 400;
}

.sidebarStats span {
  margin-top: 3px;

  color: var(--text-soft);

  font-size: 9px;

  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* =========================================================
   Map
========================================================= */

.mapArea {
  position: relative;

  min-width: 0;

  overflow: hidden;
}

.mapCanvas {
  position: absolute;
  inset: 0;

  overflow: hidden;

  background: linear-gradient(135deg, #e9e8e2, #f3f2ed);
}

/* Fake map */

.mapBackground {
  position: absolute;
  inset: 0;

  background-image:
    linear-gradient(rgba(255, 255, 255, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.25) 1px, transparent 1px);

  background-size: 72px 72px;
}

.mapRoad {
  position: absolute;

  height: 8px;

  border: 2px solid rgba(255, 255, 255, 0.7);

  background: rgba(210, 208, 200, 0.8);

  transform-origin: center;
}

.road1 {
  width: 120%;
  left: -10%;
  top: 35%;

  transform: rotate(-12deg);
}

.road2 {
  width: 110%;
  left: -5%;
  top: 68%;

  transform: rotate(9deg);
}

.road3 {
  width: 80%;
  left: 28%;
  top: 48%;

  transform: rotate(48deg);
}

.road4 {
  width: 65%;
  left: -5%;
  top: 50%;

  transform: rotate(68deg);
}

.mapRiver {
  position: absolute;

  width: 130%;
  height: 80px;

  left: -15%;
  top: 77%;

  border-radius: 50%;

  border-top: 20px solid rgba(179, 199, 202, 0.35);

  transform: rotate(-6deg);
}

.mapLabel {
  position: absolute;

  color: rgba(70, 70, 70, 0.28);

  font-family: Georgia, serif;
  font-size: 13px;

  letter-spacing: 0.25em;
}

.label1 {
  left: 42%;
  top: 24%;
}

.label2 {
  left: 67%;
  top: 53%;
}

.label3 {
  left: 32%;
  top: 76%;
}

/* =========================================================
   Markers
========================================================= */

.markerLayer {
  position: absolute;
  inset: 0;
}

.photoMarker {
  position: absolute;

  width: 58px;
  height: 58px;

  padding: 4px;

  border-radius: 50%;

  background: white;

  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.18);

  transform: translate(-50%, -50%);

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;

  cursor: pointer;
}

.photoMarker::after {
  content: "";

  position: absolute;

  left: 50%;
  bottom: -7px;

  width: 12px;
  height: 12px;

  background: white;

  transform: translateX(-50%) rotate(45deg);

  z-index: -1;
}

.photoMarker:hover {
  transform: translate(-50%, -50%) scale(1.12);

  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.24);

  z-index: 10;
}

.markerPhoto {
  width: 100%;
  height: 100%;

  display: grid;
  place-items: center;

  overflow: hidden;

  border-radius: 50%;

  color: white;

  font-family: Georgia, serif;
  font-size: 17px;
}

/* =========================================================
   Map controls
========================================================= */

.mapControls {
  position: absolute;

  right: 22px;
  bottom: 24px;

  display: flex;
  flex-direction: column;

  border-radius: 12px;

  overflow: hidden;

  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

.mapControlButton {
  width: 40px;
  height: 40px;

  background: white;

  color: var(--text);

  font-size: 20px;
}

.mapControlButton + .mapControlButton {
  border-top: 1px solid var(--border);
}

.resultBadge {
  position: absolute;

  left: 22px;
  bottom: 22px;

  display: flex;
  align-items: baseline;
  gap: 5px;

  padding: 9px 14px;

  border-radius: 999px;

  background: rgba(255, 255, 255, 0.9);

  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);

  backdrop-filter: blur(10px);
}

.resultBadge strong {
  font-family: Georgia, serif;
  font-size: 17px;
}

.resultBadge span {
  color: var(--text-soft);

  font-size: 9px;

  text-transform: uppercase;
}

/* =========================================================
   Post Preview
========================================================= */

.previewOverlay {
  position: fixed;
  inset: 0;

  z-index: 150;

  visibility: hidden;

  background: rgba(15, 15, 15, 0.15);

  opacity: 0;

  transition: opacity 0.25s ease;
}

.previewOverlay.show {
  visibility: visible;
  opacity: 1;
}

.postPreview {
  position: fixed;

  z-index: 200;

  right: 28px;
  top: 100px;

  width: min(390px, calc(100vw - 40px));

  overflow: hidden;

  border-radius: 18px;

  background: white;

  box-shadow: var(--shadow);

  opacity: 0;

  transform: translateY(12px) scale(0.98);

  pointer-events: none;

  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.postPreview.show {
  opacity: 1;

  transform: translateY(0) scale(1);

  pointer-events: auto;
}

.previewClose {
  position: absolute;

  z-index: 5;

  right: 12px;
  top: 12px;

  width: 32px;
  height: 32px;

  border-radius: 50%;

  background: rgba(255, 255, 255, 0.92);

  color: var(--text);

  font-size: 19px;
}

.previewImage {
  height: 210px;

  display: grid;
  place-items: center;

  color: white;

  font-family: Georgia, serif;
  font-size: 34px;

  letter-spacing: 0.06em;
}

.previewBody {
  padding: 22px 24px 24px;
}

.previewMeta {
  display: flex;
  align-items: center;
  gap: 8px;

  color: var(--text-soft);

  font-size: 9px;

  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metaDivider {
  width: 3px;
  height: 3px;

  border-radius: 50%;

  background: #aaa;
}

.previewBody h2 {
  margin: 11px 0 9px;

  font-family: Georgia, serif;

  font-size: 25px;
  font-weight: 400;
}

.previewBody p {
  margin: 0;

  color: var(--text-soft);

  font-size: 12px;

  line-height: 1.8;
}

.previewTags {
  display: flex;
  flex-wrap: wrap;

  gap: 6px;

  margin-top: 16px;
}

.previewTag {
  padding: 5px 9px;

  border-radius: 999px;

  background: var(--accent-soft);

  color: var(--accent);

  font-size: 9px;
}

.viewPostButton {
  width: 100%;

  display: flex;
  align-items: center;
  justify-content: space-between;

  margin-top: 22px;
  padding: 14px 0 4px;

  border-top: 1px solid var(--border);

  background: transparent;

  color: var(--text);

  font-family: Georgia, serif;

  font-size: 13px;
}

/* =========================================================
   Mobile
========================================================= */

.mobileFilterButton {
  display: none;
}

@media (max-width: 800px) {
  :root {
    --header-height: 64px;
  }

  .header {
    grid-template-columns: 1fr auto;

    padding: 0 16px;
  }

  .brandSub,
  .nav,
  .addButtonText {
    display: none;
  }

  .addButton {
    width: 40px;
    padding: 0;

    justify-content: center;
  }

  .main {
    display: block;
  }

  .sidebar {
    position: fixed;

    z-index: 300;

    left: 12px;
    right: 12px;
    bottom: 12px;

    max-height: calc(100dvh - 90px);

    padding: 24px;

    border: 0;
    border-radius: 18px;

    box-shadow: var(--shadow);

    transform: translateY(calc(100% + 30px));

    transition: transform 0.3s ease;
  }

  .sidebar.show {
    transform: translateY(0);
  }

  .sidebarHeader {
    display: none;
  }

  .searchBox {
    margin-top: 0;
  }

  .mapArea {
    height: calc(100dvh - var(--header-height));
  }

  .mobileFilterButton {
    position: fixed;

    z-index: 120;

    left: 50%;
    bottom: 20px;

    display: block;

    padding: 11px 20px;

    border-radius: 999px;

    background: var(--accent);
    color: white;

    box-shadow: 0 5px 18px rgba(0, 0, 0, 0.18);

    transform: translateX(-50%);

    font-size: 11px;
  }

  .resultBadge {
    left: 14px;
    bottom: 72px;
  }

  .mapControls {
    right: 14px;
    bottom: 72px;
  }

  .postPreview {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 12px;

    width: auto;
  }

  .previewImage {
    height: 180px;
  }
}

/* =========================================================
   Google Maps
========================================================= */

.mapCanvas {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  overflow: hidden;

  background: #e9e8e2;
}

/* Result badge must stay above Google Maps */

.resultBadge {
  z-index: 10;
}

/* =========================================================
   PhotoMap Advanced Marker
========================================================= */

.photoMapMarker {
  position: relative;

  width: 54px;
  height: 54px;

  cursor: pointer;

  transition:
    transform 0.18s ease,
    filter 0.18s ease;
}

.photoMapMarker:hover {
  transform: scale(1.1);

  filter: drop-shadow(0 5px 8px rgba(0, 0, 0, 0.08));
}

.photoMapMarkerFrame {
  position: relative;

  width: 54px;
  height: 54px;

  overflow: hidden;

  border: 3px solid #fff;
  border-radius: 12px;

  background: #fff;

  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.2);

  box-sizing: border-box;
}

.photoMapMarkerPlaceholder {
  width: 100%;
  height: 100%;

  display: grid;
  place-items: center;

  border-radius: 8px;

  color: #fff;

  font-family: Georgia, serif;
  font-size: 14px;

  user-select: none;
}

.photoMapMarkerFrame img {
  position: absolute;

  display: block;

  max-width: none;

  border-radius: 8px;

  user-select: none;

  pointer-events: none;
}

/* =========================================================
   Map Error
========================================================= */

.mapError {
  position: absolute;
  inset: 0;

  display: flex;
  flex-direction: column;

  align-items: center;
  justify-content: center;

  padding: 30px;

  background: var(--bg);

  text-align: center;
}

.mapError > span {
  color: var(--text-soft);

  font-size: 8px;

  font-weight: 600;

  letter-spacing: 0.18em;
}

.mapError strong {
  margin-top: 12px;

  font-family: Georgia, serif;

  font-size: 22px;
  font-weight: 400;
}

.mapError p {
  margin: 8px 0 0;

  color: var(--text-soft);

  font-size: 10px;
}
