/* ==========================================================================
   SAMPLE — estate agency search
   ==========================================================================
   Consumer software, so the opposite of the dispensing console: warm, roomy,
   photographic, and forgiving. Somebody browsing for a flat on a Sunday is
   nothing like a pharmacist at a counter, and the design should not pretend
   otherwise.

   Scoped under .est.
   ========================================================================== */

.est {
  --ink:    #1c1a17;
  --ink-2:  #57534e;
  --ink-3:  #78716c;   /* 4.8:1 on white; #8a8378 was 3.8 and failed */
  --paper:  #faf7f2;
  --card:   #ffffff;
  --line:   #e7e1d7;
  --line-2: #d3cabb;
  --brand:  #14614a;
  --brand-w:#e6f2ee;
  --gold:   #a16207;

  --sans: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;

  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
.est *, .est *::before, .est *::after { box-sizing: border-box; }
.est svg { display: block; }
.est a { color: inherit; text-decoration: none; }
.est ::selection { background: var(--brand); color: #fff; }

.est-wrap { width: 100%; max-width: 82rem; margin-inline: auto; padding-inline: clamp(1rem, 3vw, 2rem); }

.est h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.02em; line-height: 1.05; margin: 0; }
.est h2 { font-size: 1.1rem; margin: 0; letter-spacing: -0.015em; }
.est p { margin: 0; }

/* ------------------------------------------------------------------ bar --- */

.est-top {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 2.2rem;
  z-index: 40;
}
.est-top__in { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.est-logo { font-family: var(--serif); font-size: 1.35rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: .5rem; }
.est-logo i { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); display: block; }
.est-top .sp { margin-left: auto; }
.est-top__links { display: flex; gap: 1.4rem; font-size: .88rem; color: var(--ink-2); }
.est-top__links a:hover { color: var(--ink); }
@media (max-width: 52rem) { .est-top__links { display: none; } }

/* ---------------------------------------------------------------- hero --- */

.est-hero { padding-block: clamp(2rem, 5vw, 3.5rem) 1.5rem; }
.est-hero p { color: var(--ink-2); margin-top: .8rem; max-width: 36rem; line-height: 1.6; }

/* -------------------------------------------------------------- filters --- */

.est-filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 1.5rem;
}
.est-f { display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.est-f--grow { flex: 1 1 12rem; }
.est-f label {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.est-f select, .est-f input {
  font: inherit;
  font-size: .9rem;
  padding: .5rem .65rem;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  width: 100%;
}
.est-f select:focus, .est-f input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.est-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.est-chip {
  font: inherit;
  font-size: .82rem;
  padding: .45rem .85rem;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
}
.est-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.est-chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

.est-count { font-size: .88rem; color: var(--ink-2); margin-bottom: 1rem; display: flex; gap: 1rem; align-items: baseline; flex-wrap: wrap; }
.est-count b { color: var(--ink); font-size: 1.05rem; }
.est-count .sp { margin-left: auto; }

/* --------------------------------------------------------------- results --- */

.est-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }

.est-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  font: inherit;
  color: inherit;
  transition: transform .3s cubic-bezier(.16,1,.3,1), box-shadow .3s, border-color .3s;
}
.est-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: 0 18px 40px -22px rgba(28, 26, 23, .35);
}
.est-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }

.est-shot { position: relative; aspect-ratio: 4 / 3; background: #ede7dd; }
.est-shot svg { width: 100%; height: 100%; }
.est-badge {
  position: absolute;
  top: .7rem; left: .7rem;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: rgba(255,255,255,.94);
  border-radius: 99px;
  padding: .25rem .6rem;
  color: var(--ink);
}
.est-badge--new { background: var(--gold); color: #fff; }
.est-badge--sstc { background: var(--brand); color: #fff; }

.est-card__body { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.est-price { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.est-addr { font-size: .92rem; color: var(--ink-2); }
.est-facts {
  display: flex; flex-wrap: wrap; gap: .8rem;
  margin-top: auto; padding-top: .8rem;
  border-top: 1px solid var(--line);
  font-size: .8rem; color: var(--ink-2);
}
.est-facts span { display: inline-flex; align-items: center; gap: .3rem; }
.est-facts svg { width: 14px; height: 14px; color: var(--ink-3); }

.est-empty { padding: 4rem 1rem; text-align: center; color: var(--ink-3); grid-column: 1 / -1; }

/* --------------------------------------------------------------- drawer --- */

.est-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(30rem, 100%);
  background: var(--card);
  border-left: 1px solid var(--line);
  z-index: 80;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
  display: flex;
  flex-direction: column;
}
/* The shadow is on the open state only. Left on the closed drawer it spills
   back across the viewport edge and smudges the right-hand column of results,
   which took a pixel-picker to spot and one line to fix. */
.est-drawer.is-on { transform: none; box-shadow: -30px 0 60px -30px rgba(28, 26, 23, .3); }
.est-drawer__head { display: flex; align-items: center; gap: .75rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); }
.est-drawer__head h2 { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; }
.est-drawer__head .sp { margin-left: auto; }
.est-drawer__body { overflow-y: auto; padding: 1.2rem; display: grid; gap: 1.2rem; }
.est-drawer__foot { margin-top: auto; padding: 1rem 1.2rem; border-top: 1px solid var(--line); display: flex; gap: .6rem; }

.est-x {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}
.est-x svg { width: 16px; height: 16px; }

.est-btn {
  font: inherit; font-size: .88rem; font-weight: 600;
  padding: .6rem 1.1rem;
  border-radius: 9px;
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background .18s, border-color .18s, transform .1s;
}
.est-btn:hover { background: #f6f2ec; }
.est-btn:active { transform: scale(.98); }
.est-btn--go { background: var(--brand); border-color: var(--brand); color: #fff; flex: 1; }
.est-btn--go:hover { background: #0f4d3b; }

.est-kv { display: grid; gap: .5rem; font-size: .9rem; }
.est-kv div { display: flex; justify-content: space-between; gap: 1rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.est-kv dt { color: var(--ink-3); }
.est-kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.est-epc { display: flex; gap: 2px; align-items: stretch; }
.est-epc i {
  flex: 1;
  font-style: normal;
  font-size: .62rem;
  font-weight: 700;
  text-align: center;
  padding: .25rem 0;
  color: #fff;
  opacity: .3;
}
.est-epc i.is-on { opacity: 1; outline: 2px solid var(--ink); outline-offset: 1px; }

/* Mortgage mini-calculator inside the drawer. */
.est-mort { background: var(--brand-w); border-radius: 11px; padding: 1rem; }
.est-mort h3 { margin: 0 0 .7rem; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; color: var(--brand); }
.est-mort__row { display: flex; justify-content: space-between; align-items: baseline; font-size: .85rem; margin-bottom: .5rem; }
.est-mort__row b { font-variant-numeric: tabular-nums; }
.est-mort input[type=range] { width: 100%; accent-color: var(--brand); }
.est-mort__big { font-family: var(--serif); font-size: 2rem; letter-spacing: -0.02em; margin-top: .5rem; }
.est-mort__big small { font-family: var(--sans); font-size: .7rem; color: var(--ink-2); }
.est-mort p { font-size: .74rem; color: var(--ink-2); line-height: 1.5; margin-top: .6rem; }

.est-scrim {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(28, 26, 23, .35);
  opacity: 0; visibility: hidden;
  transition: opacity .3s, visibility .3s;
}
.est-scrim.is-on { opacity: 1; visibility: visible; }

@media (prefers-reduced-motion: reduce) {
  .est *, .est *::before, .est *::after { transition-duration: .01ms !important; }
}

/* ---------------------------------------------------------- design note --- */

.est-notes {
  margin-top: 3rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(1.2rem, 3vw, 2rem);
}
.est-notes h2 { font-family: var(--serif); font-weight: 400; font-size: 1.6rem; margin: 0 0 .8rem; letter-spacing: -0.02em; }
.est-notes h3 { margin: 1.6rem 0 .4rem; font-size: 1rem; }
.est-notes p  { color: var(--ink-2); line-height: 1.7; max-width: 46rem; margin: 0 0 1rem; }
.est-notes a  { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.est-notes code {
  font-family: var(--mono); font-size: .86em;
  background: #f0ece5; border-radius: 4px; padding: .1em .35em;
  /* Same reason as the pharmacy note: the inherited accent is a dark-ground teal. */
  color: var(--brand);
}

.est-blurb { color: var(--ink-2); line-height: 1.65; margin-top: .5rem; font-size: .92rem; }
.est-lab {
  font-family: var(--mono); font-size: .62rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: .4rem;
}

/* The shared diagram component, re-keyed for warm paper. */
.est .diagram {
  --dg-fill: #f6f2ec;
  --dg-group: #fbf9f5;
  --dg-line: #d3cabb;
  --dg-line-2: #57534e;
  --dg-text: #1c1a17;
  --dg-muted: #57534e;
  --dg-warn: #a16207;
  --dg-accent-fill: #e6f2ee;
  margin: 1.5rem 0 0;
}
.est .diagram__scroll { background: #fff; border-color: var(--line); }
.est .diagram figcaption { color: var(--ink-2); }

/* The site-wide focus ring is the portfolio's teal. Inside a sample that
   reads as a leak from the host page, so each one states its own. */
.est :focus-visible { outline-color: var(--brand); }
