/*
 * account.css — saved homes, sharing, alerts, valuation and the print button.
 *
 * A SECOND STYLESHEET, not an append to main.css. main.css is 1,530 lines of
 * settled layout; keeping this separate means the new features can be reverted
 * by dropping one <link> without a diff through the whole design, and a
 * mistake here cannot break the listing grid.
 *
 * It inherits every token from main.css (--sea, --sand, --line and the rest),
 * so it must always load AFTER it.
 *
 * ONE INHERITED GOTCHA IS HANDLED HERE. main.css styles `.field label` in
 * #cfdde1 — near-white — because the only form on the site lived inside the
 * dark enquiry band. Every panel below sits on white, where that colour is
 * invisible. The override is at the foot of this file; do not remove it
 * without checking every form on a white background.
 */

/* ------------------------------------------------------------ heart button */

.fav {
	position: absolute;
	top: .6rem;
	right: .6rem;
	z-index: 2;

	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	padding: 0;

	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .92);
	color: var(--ink-soft);
	cursor: pointer;

	box-shadow: 0 1px 3px rgba(16, 34, 46, .22);
	transition: transform .12s ease, background .12s ease, color .12s ease;
}

.fav:hover  { background: #fff; transform: scale(1.08); }
.fav:active { transform: scale(.94); }

.fav.is-on {
	background: #fff;
	color: #c0392b;
}
.fav.is-on svg { fill: #c0392b; stroke: #c0392b; }

.fav:focus-visible {
	outline: 3px solid var(--surf);
	outline-offset: 2px;
}

/* The card is the positioning context for the button above it. */
.card { position: relative; }

/* Price movement since the visitor saved it. */
.card__drop,
.card__rise {
	display: block;
	font-family: var(--sans);
	font-size: .74rem;
	font-weight: 600;
	letter-spacing: .02em;
	margin-top: .15rem;
}
.card__drop { color: #1d7a4c; }
.card__rise { color: var(--muted); }

/* ------------------------------------------------- header "saved" link */

.saved-link {
	display: inline-flex;
	align-items: center;
	gap: .38rem;

	font-family: var(--sans);
	font-size: .84rem;
	font-weight: 600;
	letter-spacing: .02em;
	text-decoration: none;
	color: inherit;

	padding: .34rem .6rem;
	border-radius: 999px;
	transition: background .14s ease;
}
.saved-link:hover { background: rgba(255, 255, 255, .12); }
.saved-link svg { flex: 0 0 auto; }

/*
 * ON A PHONE THE SAVED LINK MOVES INTO THE NAV MENU.
 *
 * Measured 2026-08-24: the masthead's action area was already at exactly the
 * viewport width on a 375px screen with just the phone number and the menu
 * button in it — no headroom at all. Adding a third item pushed the bar to
 * 425px and gave every page on the site a horizontal scroll.
 *
 * Two fixes were tried and rejected. Icon-only still overflowed by 6px, and
 * letting the brand shrink fixed the overflow but truncated "North Fork
 * Real Estate" to an ellipsis, which is a worse thing to do to a masthead than
 * moving a link. Hiding it here restores the header to byte-identical
 * behaviour to before this feature existed, and the nav item below keeps it
 * one tap away.
 */
.sitenav__saved { display: none; }

@media (max-width: 620px) {
	.masthead__actions .saved-link { display: none; }

	.sitenav__saved { display: block; }
	.sitenav__saved a {
		display: inline-flex;
		align-items: center;
		gap: .45rem;
	}
}

/*
 * A PRE-EXISTING overflow, fixed here because it was found while measuring the
 * one above. At 320px the masthead was already 34px wider than the viewport
 * with only the phone number and the menu button in it — this predates the
 * saved link, which is display:none at that width.
 *
 * The fix is to let the brand WRAP, not to truncate it. Truncating was tried
 * first and measured worse: `text-overflow: ellipsis` fires wherever the text
 * is wider than its box, so it clipped "North Fork Homes" to an
 * ellipsis on 390px and 414px screens too — the two commonest phone widths,
 * where nothing was wrong in the first place. Allowing a wrap costs the
 * masthead about 12px of height on the narrowest screens and never hides a
 * character of the brand.
 *
 * `min-width: 0` is the part that actually does the work: a flex item refuses
 * to shrink below its min-content width, and for nowrap text that is the whole
 * string. Verified 0 overflow and no truncation at 320/360/390/414/768/1200.
 *
 * 320px is iPhone SE (1st generation) territory and close to extinct, but a
 * page that scrolls sideways looks broken in a way people remember.
 */
@media (max-width: 420px) {
	.masthead__bar { gap: .4rem; }
	.brand { min-width: 0; }
	.brand__text { min-width: 0; }
	.brand__text strong { white-space: normal; }
}

/* ------------------------------------------------ listing action bar */

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem;
	margin: 0 0 1.35rem;
}

.actions__btn {
	display: inline-flex;
	align-items: center;
	gap: .42rem;

	font-family: var(--sans);
	font-size: .86rem;
	font-weight: 600;
	letter-spacing: .01em;
	text-decoration: none;
	color: var(--ink-soft);

	padding: .5rem .9rem;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--paper);
	cursor: pointer;

	transition: border-color .14s ease, color .14s ease, background .14s ease;
}

.actions__btn:hover {
	border-color: var(--sea);
	color: var(--sea);
	background: var(--shell);
}

.actions__btn[aria-pressed="true"] {
	border-color: #c0392b;
	color: #c0392b;
}
.actions__btn[aria-pressed="true"] svg { fill: #c0392b; }

/* ----------------------------------------------------------- share panel */

.sharebox,
.alertbox {
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--shell);
	padding: 1.2rem 1.3rem 1.35rem;
	margin: 0 0 1.6rem;
}

.sharebox h2,
.alertbox h2 {
	font-size: 1.08rem;
	margin: 0 0 .3rem;
}

.sharebox__blurb,
.alertbox__blurb {
	font-size: .9rem;
	color: var(--muted);
	margin: 0 0 1rem;
}

.share__form,
.alert__form {
	display: grid;
	gap: .85rem;
}

.field--pair {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: .85rem;
}
.field--pair > span { display: grid; gap: .3rem; }

@media (max-width: 560px) {
	.field--pair { grid-template-columns: 1fr; }
}

.btn--quiet {
	background: transparent;
	border-color: transparent;
	color: var(--muted);
}
.btn--quiet:hover { background: transparent; color: var(--ink); border-color: transparent; }

/* -------------------------------------------------------- saved page */

.saved { padding: clamp(1.6rem, 4vw, 3rem) 0 4rem; }

.saved__head { margin-bottom: 1.8rem; }
.saved__head h1 { margin: 0 0 .3rem; }
.saved__sub { color: var(--muted); margin: 0; max-width: 58ch; }

.saved__gate,
.saved__empty {
	max-width: 46rem;
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	background: var(--shell);
	padding: clamp(1.4rem, 4vw, 2.4rem);
}

.saved__gate h2,
.saved__empty h2 { margin-top: 0; }

.saved__linkform,
.saved__profile {
	display: grid;
	gap: .85rem;
	max-width: 30rem;
	margin-top: 1rem;
}

.saved__hint {
	font-size: .86rem;
	color: var(--muted);
	margin: 1rem 0 0;
}

.saved__block {
	margin-top: 3rem;
	padding-top: 2rem;
	border-top: 1px solid var(--line);
}
.saved__block h2 { margin: 0 0 .5rem; }
.saved__blurb { color: var(--muted); margin: 0 0 1rem; max-width: 55ch; }
.saved__block--quiet { opacity: .92; }

.saved__alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.saved__alerts li {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: .8rem;
	padding: .7rem .9rem;
	border: 1px solid var(--line);
	border-radius: var(--r);
	background: var(--paper);
}
.saved__alertlabel { font-weight: 600; }
.saved__pending { font-size: .82rem; color: var(--amber); }
.saved__unsub { font-size: .82rem; color: var(--muted); margin-left: auto; }
.saved__none { color: var(--muted); max-width: 55ch; }

/* --------------------------------------------------------- valuation */

.val {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: clamp(1.5rem, 4vw, 3rem);
	align-items: start;
}

/*
 * Before a result exists its box is [hidden], and a two-column grid then leaves
 * half the page empty next to the form. Collapse to one column until there is
 * something to put beside it. Browsers without :has() simply keep the two-column
 * layout, which is the behaviour this replaced — a safe fallback, not a break.
 */
.val:has( [data-val-result][hidden] ) {
	grid-template-columns: minmax(0, 660px);
}

@media (max-width: 900px) {
	.val { grid-template-columns: 1fr; }
}

.val__form {
	display: grid;
	gap: .9rem;
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	background: var(--shell);
	padding: clamp(1.2rem, 3vw, 1.8rem);
}

.val__row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
	gap: .9rem;
}

.val__checks {
	display: flex;
	flex-wrap: wrap;
	gap: .5rem .95rem;
}
.val__checks label {
	display: inline-flex;
	align-items: center;
	gap: .38rem;
	font-size: .88rem;
	font-weight: 500;
	color: var(--text);

	/*
	 * Each label wraps as a whole item or not at all. Without this, "New
	 * construction" broke across two lines and the checkbox — vertically
	 * centred against a now two-line label — floated away from the words it
	 * belongs to, reading as an unlabelled box next to stray text.
	 */
	white-space: nowrap;
}

.val__result {
	border: 1px solid var(--line);
	border-radius: var(--r-lg);
	background: var(--paper);
	padding: clamp(1.2rem, 3vw, 1.8rem);
	box-shadow: var(--shadow);
}
.val__result h2 { margin-top: 0; }

.val__figure {
	font-family: var(--serif);
	font-size: clamp(2rem, 5vw, 2.9rem);
	line-height: 1.1;
	color: var(--sea);
	margin: .2rem 0 .35rem;
}
.val__range { color: var(--muted); margin: 0 0 1rem; }
.val__conf {
	display: inline-block;
	font-size: .76rem;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: .25rem .6rem;
	border-radius: 999px;
	background: var(--sand);
	color: var(--ink-soft);
}
.val__caveat {
	font-size: .86rem;
	color: var(--muted);
	margin: 1.1rem 0 0;
	padding-top: 1rem;
	border-top: 1px solid var(--line);
}

/* -------------------------------------------------------- sort bar */

.sortbar {
	display: flex;
	align-items: center;
	gap: .5rem;
	margin: 0 0 1.2rem;
	font-family: var(--sans);
	font-size: .86rem;
}

.sortbar label {
	color: var(--muted);
	font-weight: 600;
	letter-spacing: .02em;
}

.sortbar select {
	font: inherit;
	color: var(--text);
	background: var(--paper);
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: .4rem 1.8rem .4rem .8rem;
	cursor: pointer;

	/* Room for the native arrow without it colliding with the pill radius. */
	appearance: none;
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%235f7078' stroke-width='1.6'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right .7rem center;
	background-size: 10px;
}

.sortbar select:focus-visible {
	outline: 2px solid var(--surf);
	outline-offset: 1px;
}

/*
 * The submit button exists so the control works with JavaScript off. main.js
 * adds this class to the form once it has wired up change-to-submit, which is
 * the only condition under which hiding the button is safe.
 */
.sortbar.is-enhanced .sortbar__go { display: none; }

.sortbar__go {
	font: inherit;
	font-weight: 600;
	color: var(--sea);
	background: transparent;
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: .4rem .9rem;
	cursor: pointer;
}

/* ------------------------------------------------- recently viewed */

.listing__recent { margin-top: 1rem; }

/* --------------------------------------------------------- overrides */

/*
 * See the note at the top of this file. main.css paints form labels in a
 * near-white intended for the dark enquiry band. Everything below sits on
 * white or shell, so the label colour has to be restored locally rather than
 * changed globally — the dark band still needs the light one.
 */
.saved .field label,
.sharebox .field label,
.alertbox .field label,
.val .field label,
.saved__gate .field label {
	color: var(--ink-soft);
}

.saved .field input,
.saved .field textarea,
.saved .field select,
.sharebox .field input,
.sharebox .field textarea,
.alertbox .field input,
.val .field input,
.val .field textarea,
.val .field select {
	background: var(--paper);
	border: 1px solid var(--line);
	color: var(--text);
	border-radius: var(--r);
	padding: .6rem .7rem;
	font: inherit;
	width: 100%;
}

.saved .lead__status.is-ok,
.sharebox .lead__status.is-ok,
.alertbox .lead__status.is-ok,
.val .lead__status.is-ok { color: #1d7a4c; }

.saved .lead__status.is-err,
.sharebox .lead__status.is-err,
.alertbox .lead__status.is-err,
.val .lead__status.is-err { color: #a5403d; }

/*
 * Anything that only works with JavaScript is marked hidden in the markup and
 * revealed by script. This makes sure [hidden] actually wins — the UA
 * stylesheet's display:none loses to any later display rule, which is exactly
 * the bug that made the map's touch cover swallow every tap in August 2026.
 */
[hidden] { display: none !important; }
