:root{
  --bg-paper:#e6dccf url("/hmot/images/paper.png");
  --panel-dark:#3e2d1a;
  --gold-1:#7a5a2f;
  --gold-2:#5e4423;
  --gold-1-hover:#8a6838;
  --gold-2-hover:#6c4e29;
  --gold-border:#caa25a;
  --gold-border-light:#d8b97a;
  --cream:#f3e3c2;
  --text-dark:#2b1d0e;
  --text-mid:#3e2d1a;
  --text-soft:#4f4f4f;
  --text-blue:#0c1c3d;
  --radius-lg:18px;
  --radius-md:12px;
  --radius-sm:8px;
  --shadow-soft:0 8px 20px rgba(0,0,0,.12);
  --shadow-strong:0 10px 25px rgba(0,0,0,.35);
  --gold-grad:linear-gradient(var(--gold-1),var(--gold-2));
  --gold-grad-hover:linear-gradient(var(--gold-1-hover),var(--gold-2-hover));
  --gold-text-shadow:0 1px 0 #3a2a15, 0 2px 2px rgba(0,0,0,.3);
}

body{
  margin:0;
  font-family:Arial,Helvetica,sans-serif;
  background:var(--bg-paper);
}

/* HEADER */

.header{
  display:flex;
  align-items:center;
  gap:6px;
  padding:5px;
  color:var(--cream);
  background:var(--gold-grad);
  border-bottom:1px solid #ccc;
}

.header img{
  width:50px;
  height:50px;
  border-radius:10px;
}

#version {
  color:#5e4423;
  color:var(--text-blue);
}

/* HERO / MAIN PANELS */

.hero,
.counties-hero,
.county-hero,
.search_results{
  display:block;
  visibility:visible;
  opacity:1;
  max-width:1000px;
  margin:10px auto;
  border-radius:var(--radius-lg);
}

.hero,
.counties-hero,
.county-hero{
  min-height:100px;
  color:#fff;
  background:var(--panel-dark);
}

.hero{ padding:40px; }

.counties-hero,
.county-hero{
  padding:30px 40px 40px;
}

.county-hero{ position:relative; }

.search_results{
  flex-direction:column;
  padding:40px;
  font-size:22px;
  line-height:1.4;
  color:#000;
  background:var(--cream);
  border:2px solid var(--gold-border);
  transition:transform .2s ease, box-shadow .2s ease;
}

.search_results a{
  color:#000;
  text-shadow:0 1px 0 #339, 0 1px 1px rgba(0,0,0,.3);
}

.searchpage .marker-card .cmarker-number,
.searchpage .marker-card .cmarker-title,
.searchpage .marker-card .cmarker-location,
.searchpage .marker-card .cmarker-text{
  transform:none !important;
  filter:none !important;
  backdrop-filter:none !important;
  text-shadow:none !important;
}

.searchmany {
  font-style:italic;
  font-weight:normal;
  display:inline;
}


/* TYPOGRAPHY */

.page-title,
.tile h3,
.tile a,
.tile a h3,
.action-tile strong,
.county-grid a,
.az-nav a{
  color:var(--cream);
  text-shadow:var(--gold-text-shadow);
}

.page-title{
  margin:0;
  font-size:34px;
}

.subtitle{
  margin:2px 0 12px;
  font-size:22px;
  line-height:1.4;
  font-weight:normal;
}

.footer{
  margin:20px 0 50px;
  font-size:14px;
  color:var(--text-blue);
  text-align:center;
}

.footer p{
  margin:20px 0 2px;
  font-size:18px;
  color:var(--text-blue);
  text-align:center;
}

/* LINKS / BACK */

.backlink{
  display:inline-flex;
  align-items:center;
  gap:6px;
  margin-bottom:18px;
  font-size:16px;
  font-weight:bold;
  color:var(--cream);
  text-decoration:none;
}

.backlink:hover{ text-decoration:underline; }

.backlink svg{ display:block; }

/* TILE-LIKE BUTTONS / LINKS */

.tile,
.county-grid a,
.action-tile,
.az-nav a,
.searchbox button{
  color:var(--cream);
  border:2px solid var(--gold-border);
  background:var(--gold-grad);
  transition:transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.tile:hover,
.county-grid a:hover,
.action-tile:hover,
.az-nav a:hover,
.searchbox button:hover{
  background:var(--gold-grad-hover);
}

.tile{
  display:flex;
  flex-direction:column;
  justify-content:center;
  min-height:180px;
  padding:25px;
  text-align:center;
  border-radius:var(--radius-lg);
}

.tile:hover{
  transform:translateY(-5px);
  box-shadow:var(--shadow-strong);
}

.tile a{
  display:block;
  width:100%;
  color:#fff;
  text-align:center;
  text-decoration:none;
}

.tileicon{
  display:block;
  width:64px;
  margin:0 auto 12px;
}

.tiles{
  display:grid;
  grid-template-columns:1fr;
  gap:20px;
  margin:30px auto 0;
}

/* SEARCH */

.searchbox{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px;
  background:var(--cream);
  border-radius:10px;
}

#search_input{
  float:left;
  width:100%;
  height:45px;
  margin:0;
  padding:10px;
  box-sizing:border-box;
  font:bold 16px Helvetica;
  color:#000;
  background:var(--cream);
  border:2px solid var(--gold-border);
  border-radius:var(--radius-sm);
  box-shadow:none;
  outline:0;
  -moz-appearance:none;
  -webkit-appearance:none;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

.searchbox button{
  display:flex;
  align-items:center;
  justify-content:center;
  height:45px;
  padding:0 16px;
  white-space:nowrap;
  cursor:pointer;
  border-radius:var(--radius-sm);
  font:bold 16px Helvetica,Arial,sans-serif;
}

.searchbox button:active{
  transform:translateY(1px);
}

/* A-Z NAV */

.az-nav{
  display:flex;
  flex-wrap:nowrap;
  gap:3.1px;
  margin:25px 0 30px;
  overflow-x:auto;
}

.az-nav::-webkit-scrollbar{ display:none; }

.az-nav a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
  width:30px;
  height:34px;
  font-size:16px;
  font-weight:bold;
  text-decoration:none;
  border-radius:var(--radius-sm);
}

.az-nav a:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 16px rgba(0,0,0,.3);
}

.az-nav a.active{
  color:var(--panel-dark);
  background:var(--gold-border);
  text-shadow:none;
}

/* SECTIONS / GROUPS */

.county-sections,
.marker-sections{
  display:flex;
  flex-direction:column;
  gap:28px;
}

.county-group,
.marker-group{
  padding:20px;
  color:#000;
  background:var(--cream);
  border:2px solid var(--gold-border);
  border-radius:var(--radius-lg);
}

.marker-group{
  scroll-margin-top:90px;
}

.county-group h3,
.marker-group h3{
  margin:0 0 16px;
  padding-bottom:8px;
  font-size:28px;
  color:var(--gold-2);
  border-bottom:2px solid var(--gold-border);
}

.marker-group p{
  margin:0 0 16px;
  font-size:20px;
  line-height:1.6;
  color:#000;
}

.empty-group p{
  margin:0;
  font-size:16px;
  color:var(--gold-2);
}

/* COUNTY GRID / ACTIONS */

.county-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
  gap:12px;
}

.county-grid a{
  display:block;
  padding:12px 14px;
  font-weight:bold;
  text-align:center;
  text-decoration:none;
  border-radius:var(--radius-md);
}

.county-grid a:hover{
  transform:translateY(-3px);
  box-shadow:0 8px 18px rgba(0,0,0,.25);
}

.county-actions{
  margin:24px 0;
}

.action-tile{
  display:flex;
  align-items:center;
  gap:14px;
  padding:16px 18px;
  text-decoration:none;
  border-radius:16px;
}

.action-tile:hover{
  transform:translateY(-3px);
  box-shadow:var(--shadow-strong);
}

.action-icon{
  width:44px;
  height:44px;
  object-fit:contain;
  flex:0 0 auto;
}

.action-tile strong{
  display:block;
  font-size:20px;
  line-height:1.2;
}

.action-tile span{
  display:block;
  margin-top:4px;
  font-size:14px;
  line-height:1.3;
  color:var(--cream);
}

/* MARKERS */

.marker-list{
  display:grid;
  grid-template-columns:1fr;
  gap:12px;
}

.marker-card,
.cmarker-card{
  background:#fff;
  border:2px solid var(--gold-border-light);
  text-decoration:none;
  transition:transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.marker-card:hover,
.cmarker-card:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-soft);
  border-color:var(--gold-border);
}

.marker-card{
  display:block;
  padding:16px 18px;
  border-radius:var(--radius-md);
}

.marker-number{
  display:block;
  margin-bottom:6px;
  font-size:12px;
  font-weight:bold;
  line-height:1.2;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--text-mid);
}

.marker-title{
  display:block;
  margin-bottom:6px;
  font-size:14px;
  font-weight:bold;
  line-height:1.2;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--gold-1);
}

.marker-location{
  display:block;
  font-size:15px;
  line-height:1.4;
  color:var(--text-soft);
}

.marker-data{
  display:block;
  font-size:20px;
  line-height:1.35;
  font-weight:bold;
  color:var(--text-dark);
}

.cmarker-card{
  display:grid;
  grid-template-columns:auto 1fr;
  grid-template-areas:
    "number title"
    "location location"
    "text text";
  gap:2px 4px;
  padding:10px;
  border-radius:var(--radius-md);
}

.cmarker-number{
  grid-area:number;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-bottom:6px;
  padding:1px 8px;
  font-size:16px;
  font-weight:bold;
  line-height:1;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--cream);
  background:var(--gold-grad);
  border:1px solid var(--gold-border);
  border-radius:6px;
}

.cmarker-title{
  grid-area:title;
  display:block;
  margin-bottom:0;
  font-size:18px;
  font-weight:bold;
  line-height:1.2;
  letter-spacing:.04em;
  text-transform:uppercase;
  color:var(--gold-1);
}

.cmarker-location,
.cmarker-text{
  display:block;
  font-size:15px;
  color:var(--text-soft);
}

.cmarker-location{
  grid-area:location;
  margin-top:0;
  font-size:14px;
  line-height:1;
  font-weight:bold;
}

.cmarker-text{
  grid-area:text;
  margin-top:1px;
  line-height:1.25;
  font-style:italic;
  color:var(--text-mid);
}

/* FLOATING UI */

#backToTop{
  position:fixed;
  right:14px;
  bottom:calc(env(safe-area-inset-bottom, 0px) + 18px);
  z-index:900;
  display:flex;
  align-items:center;
  justify-content:center;
  width:50px;
  height:50px;
  padding:0;
  font-size:25px;
  font-weight:bold;
  line-height:1;
  color:var(--cream);
  cursor:pointer;
  pointer-events:none;
  opacity:0;
  background:var(--gold-grad);
  border:2px solid var(--gold-border);
  border-radius:999px;
  box-shadow:0 8px 18px rgba(0,0,0,.28);
  transform:translateY(8px);
  transition:opacity .2s ease, transform .2s ease, background .2s ease;
}

#backToTop:hover{
  background:var(--gold-grad-hover);
}

#backToTop.show{
  opacity:1;
  pointer-events:auto;
  transform:translateY(0);
}

#azIndicator{
  position:fixed;
  top:50%;
  left:50%;
  z-index:2000;
  display:none;
  align-items:center;
  justify-content:center;
  width:120px;
  height:120px;
  font-size:80px;
  font-weight:bold;
  color:var(--panel-dark);
  pointer-events:none;
  opacity:0;
  visibility:hidden;
  background:var(--cream);
  border:4px solid var(--gold-border);
  border-radius:var(--radius-lg);
  transform:translate(-50%,-50%) scale(.8);
  transition:opacity .15s ease, transform .15s ease, visibility .15s ease;
}

#azIndicator.show{
  opacity:1;
  visibility:visible;
  transform:translate(-50%,-50%) scale(1);
}

/* MAPS */

body.mappage{
  min-height:100vh;
}

body.mappage .county-hero{
  max-width:1400px;
  min-height:calc(100vh - 120px);
  display:flex;
  flex-direction:column;
  gap:10px;
}

body.mappage .searchtile{
  display:flex;
  flex:1;
  padding:0;
  overflow:hidden;
  min-height:0;
}

body.mappage #map{
  flex:1;
  width:100%;
  min-height:480px;
  border-radius:0 0 var(--radius-md) var(--radius-md);
}

body.mappage .page-title{
  margin-bottom:4px;
}

body.mappage .subtitle{
  margin:0 0 6px;
}

body.mappage .backlink{
  margin-bottom:6px;
  font-size:14px;
}

/* DESKTOP */

@media (min-width:769px){
  .tiles{ grid-template-columns:1fr 1fr; }

  .searchtile{ grid-column:1 / 3; }

  .marker-list{ grid-template-columns:1fr 1fr; }

  #azIndicator{ display:none !important; }

  body.searchpage .tile.searchtile{
    display:block;
    align-items:unset;
    justify-content:unset;
    max-width:1000px;
    min-height:0;
    height:auto;
    margin:10px auto;
    padding:6px;
  }
}

/* MOBILE */

@media (max-width:768px){
  body.has-az .hero,
  body.has-az .counties-hero,
  body.has-az .county-hero,
  body.has-az .search_results{
    margin:8px 29px 8px 8px;
  }

  .hero,
  .counties-hero,
  .county-hero,
  .search_results{
    margin:8px;
    padding:12px 10px;
    border-radius:14px;
    font-size:16px;
  }

  .header{ padding:8px; }

  .header img{
    width:36px;
    height:36px;
  }

  .header h1{
    margin:0;
    font-size:17px;
    line-height:1.1;
  }

  .subtitle{
    margin:2px 0 8px;
    font-size:13px;
    line-height:1.25;
  }

  .tiles{
    gap:10px;
    margin:12px auto 0;
  }

  .tile{
    min-height:auto;
    padding:12px 10px;
    border-radius:var(--radius-md);
  }

  .tile h3{
    margin:0 0 6px;
    font-size:16px;
  }

  .tile p{
    margin:0;
    font-size:13px;
    line-height:1.25;
  }

  .tileicon{
    width:34px;
    margin:0 auto 6px;
  }

  #search_input{
    height:36px;
    padding:6px 8px;
    font-size:16px;
  }

  .searchmany{
    display:block;
    margin-top:2px;
  }

  .page-title{
    margin:0;
    font-size:22px;
  }

  .az-nav{
    position:fixed;
    top:50%;
    right:2px;
    z-index:1000;
    flex-direction:column;
    align-items:center;
    justify-content:center;
    gap:2px;
    margin:0;
    padding:4px 2px;
    overflow:visible;
    user-select:none;
    touch-action:none;
    background:rgba(62,45,26,.78);
    border-radius:10px;
    transform:translateY(-50%);
    overscroll-behavior:contain;
    backdrop-filter:blur(2px);
    -webkit-user-select:none;
    -webkit-tap-highlight-color:transparent;
    -webkit-backdrop-filter:blur(2px);
  }

  .az-nav a{
    width:22px;
    height:16px;
    font-size:11px;
    border:0;
    border-radius:4px;
  }

  .az-nav a:hover{
    transform:none;
    box-shadow:none;
  }

  .county-group,
  .marker-group{
    padding:12px 10px;
    border-radius:var(--radius-md);
  }

  .county-group h3,
  .marker-group h3{
    margin:0 0 10px;
    font-size:20px;
  }

  .marker-group{
    scroll-margin-top:70px;
  }

  .marker-group p{
    font-size:20px;
    line-height:1.5;
  }

  .county-grid{
    grid-template-columns:1fr 1fr;
    gap:8px;
  }

  .county-grid a{
    padding:10px 8px;
    font-size:13px;
    border-radius:10px;
  }

  .action-tile{
    gap:10px;
    padding:12px 10px;
    border-radius:var(--radius-md);
  }

  .action-icon{
    width:34px;
    height:34px;
  }

  .action-tile strong{ font-size:16px; }

  .action-tile span{ font-size:12px; }

  .marker-sections{ gap:14px; }

  .marker-list{ gap:8px; }

  .marker-card,
  .cmarker-card{
    padding:10px;
    border-radius:10px;
  }

  .cmarker-number{ font-size:14px; }

  .cmarker-title{ font-size:15px; }

  .cmarker-location{
    font-size:14px;
    font-weight:bold;
  }

  .cmarker-text{
    font-size:15px;
    line-height:1.25;
    font-style:italic;
  }

  .marker-number{
    margin-bottom:3px;
    font-size:14px;
  }

  .marker-title{
    margin-bottom:3px;
    font-size:16px;
  }

  .marker-data{
    font-size:20px;
    line-height:1.25;
  }

  .marker-location{
    font-size:15px;
    line-height:1.3;
  }

  body.mappage .county-hero{
    min-height:calc(100vh - 110px);
  }

  body.mappage #map{
    min-height:320px;
  }
  
  #backToTop{
    right:8px;
    bottom:calc(env(safe-area-inset-bottom, 0px) + 64px);
    left:auto;
    width:48px;
    height:48px;
    font-size:24px;
  }

  body.has-az #backToTop{
    right:0;
    bottom:calc(env(safe-area-inset-bottom, 0px) + 16px);
  }

  #azIndicator{ display:flex; }
}

