:root {
    --ink: #2c2116;
    --ink-soft: #6e5a44;
    --paper: #efe4c9;
    --surface: #fbf6e8;
    --barn: #7a2b1f;
    --barn-strong: #4c1b13;
    --brass: #a1731f;
    --brass-soft: #ecd7a4;
    --rust: #a8501f;
    --line: #d9c7a0;
    --line-soft: #ece0c0;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(44, 33, 22, 0.08), 0 6px 20px -8px rgba(44, 33, 22, 0.22);
  }

  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --ink: #ece1c4;
      --ink-soft: #b7a583;
      --paper: #1b140d;
      --surface: #241c12;
      --barn: #d97a52;
      --barn-strong: #b6532e;
      --brass: #e0ab52;
      --brass-soft: #3a2e1a;
      --rust: #d9793f;
      --line: #3a2c1a80;
      --line-soft: #2e2313;
      --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px -10px rgba(0, 0, 0, 0.5);
    }
  }
  :root[data-theme="dark"] {
    --ink: #ece1c4;
    --ink-soft: #b7a583;
    --paper: #1b140d;
    --surface: #241c12;
    --barn: #d97a52;
    --barn-strong: #b6532e;
    --brass: #e0ab52;
    --brass-soft: #3a2e1a;
    --rust: #d9793f;
    --line: #3a2c1a80;
    --line-soft: #2e2313;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 26px -10px rgba(0, 0, 0, 0.5);
  }

  * { box-sizing: border-box; }
  body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "Barlow", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3 { font-family: "Bitter", Georgia, serif; text-wrap: balance; margin: 0; }
  a { color: inherit; }

  .eyebrow {
    font-family: "Barlow Condensed", "Barlow", sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }

  /* ---- topbar ---- */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
    background: var(--barn-strong);
    color: #f6ecd8;
  }
  .brand {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-family: "Bitter", Georgia, serif;
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
  }
  .brand small {
    font-family: "Barlow", sans-serif;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brass-soft);
    opacity: 0.85;
  }
  .badge-proto {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: rgba(246, 236, 216, 0.14);
    border: 1px solid rgba(246, 236, 216, 0.28);
  }

  /* ---- hero ---- */
  .hero {
    position: relative;
    overflow: hidden;
    color: #f6ecd8;
    padding: clamp(2.2rem, 5vw, 3.4rem) clamp(1rem, 4vw, 2.5rem) 2.6rem;
    background-color: var(--barn-strong);
    background-image:
      linear-gradient(180deg, rgba(20, 10, 5, 0.5) 0%, rgba(20, 10, 5, 0.62) 55%, var(--barn-strong) 96%),
      url("hero-rogersville.jpg");
    background-size: cover;
    background-position: center 62%;
    background-repeat: no-repeat;
  }
  .hero-credit {
    position: absolute;
    right: clamp(1rem, 4vw, 2.5rem);
    bottom: 0.6rem;
    font-size: 0.66rem;
    color: rgba(246, 236, 216, 0.55);
    text-decoration: none;
  }
  .hero-credit:hover { color: rgba(246, 236, 216, 0.85); }
  .hero-inner { position: relative; max-width: 760px; }
  .hero h1 {
    font-size: clamp(1.9rem, 3.6vw, 2.7rem);
    font-weight: 600;
    line-height: 1.12;
    text-shadow: 0 2px 4px rgba(15, 8, 4, 0.5), 0 8px 24px rgba(15, 8, 4, 0.4);
  }
  .hero h1 em {
    font-style: normal;
    color: #ffd88a;
  }
  .hero p {
    margin: 0.85rem 0 0;
    color: #e6d9bb;
    font-size: 1rem;
    max-width: 46ch;
    text-shadow: 0 1px 4px rgba(15, 8, 4, 0.5);
  }

  .search-row {
    margin-top: 1.6rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .search-box {
    flex: 1 1 320px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--surface);
    color: var(--ink);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    box-shadow: var(--shadow);
  }
  .search-box svg { flex: none; opacity: 0.55; }
  .search-box input {
    border: 0;
    outline: 0;
    font: inherit;
    font-size: 0.95rem;
    width: 100%;
    background: transparent;
    color: var(--ink);
  }
  .search-box input::placeholder { color: var(--ink-soft); }

  .ask-box {
    flex: 1 1 320px;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: rgba(246, 236, 216, 0.08);
    border: 1px dashed rgba(246, 236, 216, 0.35);
    border-radius: var(--radius);
    padding: 0.75rem 0.9rem;
    color: #e6d9bb;
  }
  .ask-box svg { flex: none; opacity: 0.7; }
  .ask-box input {
    border: 0;
    outline: 0;
    font: inherit;
    font-size: 0.95rem;
    width: 100%;
    background: transparent;
    color: #f6ecd8;
  }
  .ask-box input::placeholder { color: #cdbb95; }
  .ask-box .soon {
    flex: none;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.22rem 0.5rem;
    border-radius: 999px;
    background: var(--brass);
    color: #2a1d06;
  }

  /* ---- chips ---- */
  .chip-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1.1rem clamp(1rem, 4vw, 2.5rem) 0.2rem;
    max-width: 1180px;
    margin: 0 auto;
  }
  .chip {
    font-family: "Barlow", sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.42rem 0.85rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
  }
  .chip:hover { border-color: var(--barn); }
  .chip[aria-pressed="true"] {
    background: var(--barn);
    border-color: var(--barn);
    color: #f6ecd8;
  }

  /* ---- main ---- */
  main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1.2rem clamp(1rem, 4vw, 2.5rem) 4rem;
  }
  .results-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 1rem;
    padding: 0.6rem 0.1rem 1rem;
    color: var(--ink-soft);
    font-size: 0.88rem;
  }
  .results-bar strong { color: var(--ink); }

  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
  }

  .card {
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: var(--shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.14s ease, box-shadow 0.14s ease;
  }
  .card:hover { transform: translateY(-2px); }
  .card:focus-visible {
    outline: 2px solid var(--barn);
    outline-offset: 2px;
  }
  .card-img {
    position: relative;
    aspect-ratio: 16 / 9;
    background:
      repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 11px),
      var(--line-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    flex: none;
  }
  .card-img svg { width: 34px; height: 34px; opacity: 0.55; }
  .ph-tag {
    position: absolute;
    left: 0.6rem;
    bottom: 0.6rem;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink-soft);
    border: 1px solid var(--line);
  }
  .card-body {
    padding: 1.1rem 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
  }
  .card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
  }
  .card h3 {
    font-size: 1.06rem;
    font-weight: 600;
    line-height: 1.25;
    min-width: 0;
    flex: 1 1 140px;
  }
  .cat-badge {
    flex: none;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.24rem 0.5rem;
    border-radius: 6px;
    background: var(--brass-soft);
    color: var(--barn-strong);
    white-space: nowrap;
  }
  .card .addr {
    font-size: 0.86rem;
    color: var(--ink-soft);
  }
  .card .meta-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.86rem;
    color: var(--ink-soft);
  }
  .card .meta-row svg { flex: none; opacity: 0.6; }
  .claim-tag {
    margin-top: 0.15rem;
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--rust);
    background: color-mix(in srgb, var(--rust) 12%, transparent);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
  }
  .deal-tag {
    margin-top: 0.15rem;
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    color: #2f5720;
    background: #d9ead0;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
  }

  .empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--ink-soft);
  }

  /* ---- roadmap strip ---- */
  .roadmap {
    margin-top: 2.6rem;
    border-top: 1px solid var(--line);
    padding-top: 1.6rem;
  }
  .roadmap h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.9rem;
  }
  .roadmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.85rem;
  }
  .rmap-item {
    background: var(--surface);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
  }
  .rmap-item .n {
    font-family: "Bitter", Georgia, serif;
    font-size: 0.85rem;
    color: var(--brass);
    font-weight: 600;
  }
  .rmap-item p {
    margin: 0.3rem 0 0;
    font-size: 0.86rem;
    color: var(--ink-soft);
  }

  /* ---- detail panel ---- */
  .overlay {
    position: fixed;
    inset: 0;
    background: rgba(28, 15, 8, 0.45);
    display: none;
    align-items: stretch;
    justify-content: flex-end;
    z-index: 40;
  }
  .overlay.open { display: flex; }
  .panel {
    width: min(420px, 100%);
    height: 100%;
    background: var(--surface);
    color: var(--ink);
    padding: 1.6rem 1.5rem 2rem;
    overflow-y: auto;
    box-shadow: -12px 0 30px -12px rgba(0,0,0,0.35);
  }
  .panel-close {
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    border-radius: 8px;
    padding: 0.4rem 0.7rem;
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
  }
  .panel-img {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    background:
      repeating-linear-gradient(135deg, var(--line) 0 1px, transparent 1px 11px),
      var(--line-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-soft);
    margin-top: 1rem;
  }
  .panel-img svg { width: 46px; height: 46px; opacity: 0.55; }
  .panel-img .ph-tag { left: 0.7rem; bottom: 0.7rem; }
  .panel h2 {
    margin-top: 0.9rem;
    font-size: 1.5rem;
  }
  .panel .cat-badge { margin-top: 0.5rem; }
  .panel dl {
    margin: 1.3rem 0 0;
    display: grid;
    gap: 0.75rem;
  }
  .panel dt {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-soft);
  }
  .panel dd { margin: 0.15rem 0 0; font-size: 0.94rem; }
  .panel .cta-row {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
  }
  .btn {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.6rem 0.9rem;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--paper);
    color: var(--ink);
    cursor: not-allowed;
    opacity: 0.7;
  }
  .btn.primary {
    background: var(--barn);
    border-color: var(--barn);
    color: #f6ecd8;
  }
  .btn.secondary {
    background: var(--paper);
    color: var(--ink);
    border-color: var(--line);
    cursor: pointer;
    opacity: 1;
  }
  .btn.secondary:disabled {
    cursor: default;
    opacity: 0.7;
  }

  footer {
    text-align: center;
    padding: 2rem 1rem 3rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
  }

  @media (prefers-reduced-motion: reduce) {
    .card, .chip { transition: none; }
  }
