/* Outer Hebrides Property — design system.
   Authority: docs/research/mobile-ui-direction.md "## Binding direction".
   Palette: Harris Tweed natural dyes (gneiss, shell sand, bay, crotal).
   Two accents only. --accent2 means "the price moved" and nothing else. */

:root {
  --bg:      #FAFAF8;
  --card:    #FFFFFF;
  --sand:    #F0EDE6;
  --line:    #E5E3DD;
  --line-2:  #D6D2C8;

  --ink:     #1A2330;
  --muted:   #5C6672;

  --accent:  #0B6E6E;
  --accent2: #A8401B;

  --radius:  6px;
  --radius-sheet: 16px;
  --shadow:  0 6px 24px rgb(26 35 48 / .16);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
           Georgia, "Times New Roman", serif;

  --t-xs: .6875rem;
  --t-sm: .8125rem;
  --t-md: .9375rem;
  --t-base: 1rem;
  --t-lg: 1.25rem;
  --t-price: 1.5rem;
  --t-h1: 1.75rem;
  --t-hero: 2rem;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px; --s-8: 64px;
}

*, *::before, *::after { box-sizing: border-box }
html { -webkit-text-size-adjust: 100% }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--t-base)/1.6 var(--sans);
}
img { max-width: 100%; height: auto }
a { color: var(--accent) }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
.no-js .js-only, .no-js .js-only-inline { display: none }

.wrap { max-width: 1120px; margin-inline: auto; padding-inline: clamp(16px, 4vw, 24px) }
.skip {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: #fff;
  padding: var(--s-3) var(--s-4); z-index: 50;
}
.skip:focus { left: 0 }

/* ---------------------------------------------------------------- header */

.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap }
.brand {
  display: flex; align-items: center; min-height: 44px;
  font-weight: 600; font-size: var(--t-base); letter-spacing: -.01em;
  color: var(--ink); text-decoration: none; white-space: nowrap;
}
.brand span { color: var(--muted); font-weight: 400 }
.nav {
  display: flex; gap: var(--s-4); margin-left: auto;
  overflow-x: auto; scrollbar-width: none;
  background:
    linear-gradient(to right, var(--bg), rgb(250 250 248 / 0)) left center,
    linear-gradient(to left, var(--bg), rgb(250 250 248 / 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgb(26 35 48 / .13), rgb(26 35 48 / 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgb(26 35 48 / .13), rgb(26 35 48 / 0)) right center;
  background-repeat: no-repeat;
  background-size: 24px 100%, 24px 100%, 12px 100%, 12px 100%;
  background-attachment: local, local, scroll, scroll;
}
.nav::-webkit-scrollbar { display: none }
.nav a {
  display: flex; align-items: center; min-height: 44px;
  font-size: var(--t-md); color: var(--muted); text-decoration: none; white-space: nowrap;
}
.nav a:hover, .nav a[aria-current] { color: var(--ink) }
.nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--accent) }

/* Measured 31 Aug 2026: at the shipped 16px gap the six items are 387px
   wide against a 358px track on a 390px phone, so "Map" -- one of the
   site's differentiators -- was sliced mid-glyph, with `scrollbar-width:
   none` removing the only cue that it scrolled. It read as a broken
   header. Tightening the gap and the label size below 480px fits all six
   items on every common phone (re-measured after the fix: 306px of nav
   against a 306px track at 360, 375, 390 and 414 -- nothing clipped).
   A 320px phone still overflows by 18px, so the scroll shadows carry the
   cue there. They hide themselves when there is
   nothing to scroll to: the `local` cover layers travel with the content
   and sit exactly on top of the `scroll` shadows until the nav actually
   overflows. */
@media (max-width: 480px) {
  .nav { gap: var(--s-2) }
  .nav a { font-size: var(--t-sm) }
}

main { padding-bottom: var(--s-8) }

/* ------------------------------------------------------------- typography */

h1 {
  font: 400 var(--t-h1)/1.15 var(--serif);
  margin: var(--s-6) 0 var(--s-3);
}
.home h1 { font-size: var(--t-hero) }
@media (min-width: 768px) { .home h1 { font-size: 2.75rem } }
h2 { font: 600 var(--t-lg)/1.3 var(--sans); margin: var(--s-7) 0 var(--s-4) }
h3 { margin: 0 }
.gd { font: italic 400 var(--t-lg)/1.3 var(--serif); color: var(--muted) }
.lead { font-size: var(--t-base); color: var(--muted); max-width: 68ch; margin: 0 0 var(--s-5) }
.prose { max-width: 68ch; margin: 0 0 var(--s-4) }
.note { font-size: var(--t-sm); color: var(--muted); max-width: 68ch; margin: var(--s-3) 0 }
.factline { font-size: var(--t-base); margin: var(--s-4) 0 }
.empty { color: var(--muted); margin: var(--s-6) 0 }

/* ------------------------------------------------------------------ cards */

.grid { display: grid; grid-template-columns: 1fr; gap: var(--s-6) }
@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--s-6) var(--s-5) }
}
.card { display: block; color: inherit; text-decoration: none }
.card:nth-child(n+7) { content-visibility: auto; contain-intrinsic-size: 0 420px }
.shot { position: relative; margin-bottom: var(--s-3) }
.shot img {
  display: block; width: 100%; aspect-ratio: 3/2; object-fit: cover;
  border-radius: var(--radius); background: var(--sand);
}
.qual { font-size: var(--t-md); color: var(--muted); margin: 0 }
.price {
  font: 400 var(--t-price)/1.15 var(--serif); font-variant-numeric: tabular-nums;
  margin: 0 0 var(--s-1);
}
.price.noprice { font: 400 var(--t-lg)/1.3 var(--sans); color: var(--muted) }
.addr {
  font: 600 var(--t-base)/1.3 var(--sans);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  line-clamp: 2; overflow: hidden;
}
.place { font-size: var(--t-sm); line-height: 1.4; color: var(--ink); margin: var(--s-1) 0 0 }
.place i { color: var(--muted) }
.meta { font-size: var(--t-sm); line-height: 1.4; color: var(--muted); margin: 2px 0 0 }

/* ----------------------------------------------------------------- badges */

.badges { position: absolute; left: var(--s-2); bottom: var(--s-2); display: flex; gap: var(--s-1) }
.badges.inline { position: static; margin: 0 0 var(--s-3) }
.badge {
  display: inline-block; padding: 4px 8px; border-radius: var(--radius);
  font: 600 var(--t-xs)/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: #fff; white-space: nowrap;
}
.b-new { background: var(--accent) }
.b-reduced { background: var(--accent2) }
.b-offer { background: rgb(26 35 48 / .9) }
.b-auction { background: var(--sand); color: var(--ink) }
.b-gone { background: var(--muted) }

/* ------------------------------------------------- the place plate (§9) */

.plate {
  aspect-ratio: 3/2; border-radius: var(--radius);
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, var(--line) 7px 8px),
    repeating-linear-gradient(90deg, transparent 0 7px, var(--line) 7px 8px),
    var(--sand);
  display: grid; place-content: center; text-align: center; padding: var(--s-4);
}
.plate-type {
  display: block; font: 600 var(--t-xs)/1.2 var(--sans);
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
/* On an area page this line carries the listing's own street (the region
   name is constant there and printed identically on every plate), and a
   handful of agents write a sentence into the address field -- clamp it
   rather than letting it spill out of the plate. */
.plate-area {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden; font: 400 var(--t-lg)/1.3 var(--serif); color: var(--ink);
  margin-top: var(--s-1);
}
.plate.tall { aspect-ratio: 16/10; max-width: 720px; margin-inline: auto }
.band {
  height: var(--s-7);
  background:
    repeating-linear-gradient(0deg, transparent 0 7px, var(--line) 7px 8px),
    repeating-linear-gradient(90deg, transparent 0 7px, var(--line) 7px 8px),
    var(--sand);
}

/* ------------------------------------------------------------------- home */

.home { padding-bottom: var(--s-5) }
.search { margin: 0 0 var(--s-5); max-width: 34rem }
.search label { display: block; font-size: var(--t-md); color: var(--muted); margin-bottom: var(--s-2) }
.searchrow { display: flex; gap: var(--s-2) }
.searchrow input {
  flex: 1; min-height: 44px; padding: 0 var(--s-3); font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius);
}
.searchrow button, .btn, .apply, .more {
  min-height: 44px; padding: 0 var(--s-4); font: 600 var(--t-md) var(--sans);
  color: #fff; background: var(--accent); border: 0; border-radius: var(--radius);
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
}
.pitch { list-style: none; margin: 0 0 var(--s-6); padding: 0; max-width: 68ch }
.pitch li { font-size: var(--t-md); color: var(--muted); padding: var(--s-1) 0 }
.sechead { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4) }
.sechead h2 { margin-bottom: var(--s-4) }
.sechead a { font-size: var(--t-md) }
.teaser { display: grid; gap: var(--s-5); grid-template-columns: 1fr }
@media (min-width: 700px) { .teaser { grid-template-columns: repeat(3, 1fr) } }
.stat { background: var(--sand); border-radius: var(--radius); padding: var(--s-4) }
.stat .big {
  display: block; font: 400 var(--t-h1)/1.15 var(--serif); font-variant-numeric: tabular-nums;
}
.stat .lab { display: block; font-size: var(--t-sm); line-height: 1.4; color: var(--muted); margin-top: var(--s-2) }
.arealist, .footlinks, .rows { list-style: none; margin: 0; padding: 0 }
.arealist { display: grid; gap: 0; grid-template-columns: 1fr }
@media (min-width: 640px) { .arealist { grid-template-columns: repeat(2, 1fr); column-gap: var(--s-6) } }
.arealist a, .rows a {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  min-height: 44px; padding: var(--s-2) 0; border-bottom: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
}
.arealist a:hover, .rows a:hover { color: var(--accent) }
.a-name i, .r-addr i { color: var(--muted) }
.a-count { color: var(--muted); font-size: var(--t-sm); font-variant-numeric: tabular-nums }
.rows a { flex-wrap: wrap }
.r-addr { font-weight: 600; font-size: var(--t-base) }
.r-meta { font-size: var(--t-sm); color: var(--muted); margin-left: auto }

/* ---------------------------------------------------------------- results */

.layout { display: block }
.bar {
  display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap;
  padding-bottom: var(--s-4); border-bottom: 1px solid var(--line); margin-bottom: var(--s-5);
}
.count { margin: 0; font-size: var(--t-md); color: var(--muted) }
.sortwrap, .searchwrap { font-size: var(--t-sm); color: var(--muted); display: flex; align-items: center; gap: var(--s-2) }
.searchwrap { margin-left: auto }
.bar select, .bar input, .prices select {
  min-height: 44px; padding: 0 var(--s-2); font: inherit; font-size: var(--t-md);
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line-2); border-radius: var(--radius);
}
.maplink { font-size: var(--t-md); display: inline-flex; align-items: center; min-height: 44px }
.showing { font-size: var(--t-sm); color: var(--muted); margin-top: var(--s-6) }
.more { margin-top: var(--s-6) }
.archive { margin-top: var(--s-8); border-top: 1px solid var(--line); padding-top: var(--s-2) }

/* ------------------------------------------------------------ filter sheet */

.pill {
  position: fixed; z-index: 30;
  bottom: calc(16px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%);
  min-height: 44px; padding: 12px 20px; border: 0; border-radius: 999px;
  background: var(--ink); color: #fff; font: 600 var(--t-md) var(--sans);
  box-shadow: var(--shadow); cursor: pointer;
}
dialog.sheet {
  margin: 0 0 0 auto; inset: auto 0 0 0; width: 100%; max-width: 640px;
  margin-inline: auto; max-height: 85dvh; border: 0; padding: 0;
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  background: var(--card); box-shadow: var(--shadow); color: var(--ink);
  flex-direction: column;
}
dialog.sheet[open] { display: flex }
dialog.sheet::backdrop { background: rgb(26 35 48 / .45) }
.grab { width: 36px; height: 4px; border-radius: 2px; background: var(--line-2); margin: var(--s-3) auto }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 var(--s-4) var(--s-4) }
.fg { border: 0; border-top: 1px solid var(--line); margin: 0; padding: var(--s-4) 0 var(--s-2) }
/* The Clear button lives INSIDE the legend. Absolutely positioning it
   against the fieldset put it on the first option row instead -- a
   fieldset's padding box starts below its legend -- where it overprinted
   the Area group's first count. */
.fg legend {
  display: flex; width: 100%; justify-content: space-between; align-items: baseline;
  padding: 0; font: 600 var(--t-md) var(--sans);
}
.clear {
  background: transparent; border: 0; color: var(--muted); font: inherit;
  font-size: var(--t-sm); font-weight: 400; min-height: 44px; padding: 0; cursor: pointer;
}
.checks li { list-style: none }
.checks { margin: 0; padding: 0 }
.checks label, .seg label { display: flex; align-items: center; gap: var(--s-3); min-height: 44px; cursor: pointer }
.checks label span { flex: 1; font-size: var(--t-base) }
.checks label i { color: var(--muted) }
.checks label b { color: var(--muted); font-weight: 400; font-size: var(--t-sm) }
.checks input, .seg input { width: 20px; height: 20px; accent-color: var(--accent) }
.prices { display: flex; gap: var(--s-3) }
.prices label { flex: 1; display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--t-md); color: var(--muted) }
.seg { display: flex; gap: var(--s-2); flex-wrap: wrap }
.seg label {
  border: 1px solid var(--line-2); border-radius: var(--radius); padding: 0 var(--s-4);
  gap: var(--s-2); font-size: var(--t-md);
}
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px }
.seg label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent) }
.sheet-foot {
  display: flex; align-items: center; gap: var(--s-3);
  background: var(--card); border-top: 1px solid var(--line);
  padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom));
}
.clear-all { background: transparent; border: 0; color: var(--muted); font: inherit; min-height: 44px; cursor: pointer }
.apply { flex: 1; justify-content: center }

@media (min-width: 1024px) {
  .layout { display: grid; grid-template-columns: 272px 1fr; gap: var(--s-6); align-items: start }
  .pill { display: none }
  dialog.sheet {
    display: flex; position: static; inset: auto; max-width: none; max-height: none;
    margin: var(--s-6) 0 0; border-radius: 0; box-shadow: none; background: transparent;
    border-right: 1px solid var(--line);
  }
  dialog.sheet::backdrop { background: transparent }
  .grab { display: none }
  .sheet-body { padding-left: 0; overflow: visible }
  .sheet-foot { background: transparent; padding-left: 0; padding-right: var(--s-4) }
  .fg:first-of-type { border-top: 0 }
}

/* ----------------------------------------------------------------- detail */

.detail .body { max-width: 720px; margin-inline: auto }
.detail h1 { margin-top: var(--s-5) }
.crumb { font-size: var(--t-sm); color: var(--muted); margin: var(--s-4) 0 0 }
.strip {
  display: flex; gap: var(--s-2); overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; position: relative;
  margin-inline: calc(var(--s-4) * -1); padding-inline: var(--s-4); margin-top: var(--s-4);
}
.strip::-webkit-scrollbar { display: none }
.strip img {
  flex: 0 0 88%; scroll-snap-align: center; aspect-ratio: 3/2;
  object-fit: cover; border-radius: var(--radius); background: var(--sand);
}
.stripcount {
  position: sticky; right: var(--s-2); bottom: var(--s-2); align-self: flex-end;
  margin-left: calc(var(--s-2) * -1); padding: 4px 8px; border-radius: var(--radius);
  background: rgb(26 35 48 / .72); color: #fff; font: 600 var(--t-xs) var(--sans);
  letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.gone .strip img, .gone .plate { filter: saturate(.7) }
.striprail { position: relative }
.stripnav { display: none }
@media (min-width: 900px) {
  .stripnav {
    display: grid; place-content: center; position: absolute; top: 50%; z-index: 2;
    width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: var(--radius);
    background: rgb(255 255 255 / .92); color: var(--ink); font-size: var(--t-lg);
    box-shadow: var(--shadow); cursor: pointer;
  }
  .stripnav.prev { left: var(--s-2) }
  .stripnav.next { right: var(--s-2) }
  /* the agents' originals are ~552px wide; never scale one past its own
     pixels on a big screen or the hero goes soft. */
  .strip img { flex: 0 0 min(68%, 560px) }
}
.credit { font-size: var(--t-xs); color: var(--muted); margin: var(--s-2) 0 0 }
.gonebar {
  background: var(--sand); border-radius: var(--radius); padding: var(--s-3) var(--s-4);
  font-size: var(--t-md); margin: 0 0 var(--s-4);
}
.detail .qual.big { font-size: var(--t-md); margin-top: var(--s-5) }
.detail .price.big { font-size: 2rem }
.detail .meta.big { font-size: var(--t-base); color: var(--muted); margin-top: var(--s-2) }
.timeline { list-style: none; margin: 0; padding: var(--s-4); background: var(--sand); border-radius: var(--radius) }
.timeline li {
  display: flex; gap: var(--s-4); align-items: baseline;
  padding: var(--s-2) 0 var(--s-2) var(--s-4); border-left: 1px solid var(--line-2);
  position: relative; flex-wrap: wrap;
}
.timeline li::before {
  content: ""; position: absolute; left: -4px; top: 14px;
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.t-date { font-size: var(--t-sm); color: var(--muted); min-width: 6.5rem }
.t-text { font-size: var(--t-base) }
.t-text s { color: var(--muted); text-decoration-thickness: 1px }
.t-text .down { color: var(--accent2) }
/* an increase is not a "the price moved down" event, so it does not spend
   the rust; it gets weight instead. */
.t-text .up { color: var(--ink); font-weight: 600 }
.agentblock, .mapblock, .history { margin-top: var(--s-7) }
.map { margin-top: var(--s-4); aspect-ratio: 16/10 }
.map.live { display: block; padding: 0; background: var(--sand) }
.leaflet-container { border-radius: var(--radius); font: inherit }
.src { border-top: 1px solid var(--line); padding-top: var(--s-4); margin-top: var(--s-7) }

/* ------------------------------------------------------------ map + tables */

.maphead { padding-bottom: var(--s-4) }
.bigmap { aspect-ratio: auto; height: 70vh; min-height: 380px; border-radius: 0; margin-bottom: var(--s-4) }
.tablewrap { overflow-x: auto }
table { border-collapse: collapse; width: 100%; font-size: var(--t-md) }
th, td { text-align: left; padding: var(--s-3) var(--s-4) var(--s-3) 0; border-bottom: 1px solid var(--line); white-space: nowrap }
th { font-weight: 600; font-size: var(--t-sm); color: var(--muted) }
td { font-variant-numeric: tabular-nums }
td .n { color: var(--muted); font-size: var(--t-sm) }
.market .teaser { margin-bottom: var(--s-5) }
.prose-page { max-width: 720px }

.popcard { display: block; color: var(--ink); text-decoration: none; width: 160px }
.popcard img { border-radius: var(--radius); display: block; margin-bottom: var(--s-2); width: 160px; height: auto }
.p-price { display: block; font: 400 var(--t-lg)/1.2 var(--serif) }
.p-addr { display: block; font: 600 var(--t-sm)/1.3 var(--sans) }
.p-meta, .p-note { display: block; font-size: var(--t-xs); color: var(--muted); margin-top: 2px }

/* ----------------------------------------------------------------- footer */

.foot { border-top: 1px solid var(--line); padding: var(--s-7) 0 var(--s-8); margin-top: var(--s-8) }
.foot h2 { font-size: var(--t-md); margin: 0 0 var(--s-2) }
.foot nav { margin-bottom: var(--s-5) }
.footlinks { display: flex; flex-wrap: wrap; gap: 0 var(--s-5) }
.footlinks a {
  display: flex; align-items: center; gap: var(--s-2); min-height: 44px;
  font-size: var(--t-sm); color: var(--muted); text-decoration: none;
}
.footlinks a:hover { color: var(--ink) }
.footlinks span { font-variant-numeric: tabular-nums }
.footnote { font-size: var(--t-sm); color: var(--muted); max-width: 68ch }

/* --------------------------------------------------------------- motion */

@media (prefers-reduced-motion: no-preference) {
  a, button, select, input, .card { transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease }
  dialog.sheet[open] { animation: sheet-up 200ms ease }
  @keyframes sheet-up { from { transform: translateY(100%) } to { transform: none } }
}
@media (min-width: 1024px) {
  dialog.sheet[open] { animation: none }
}
