/* SLV organizer 0.3.1 - the village page and the residents' cabinet of Siam Lake View (SLV#24).
 * Village page: one bold element, the name on the horizon of the lake with its reflection; everything else stays quiet.
 * Cabinet: a house and garden instead of the lake at dusk - you are home; below, plain tiles to tap, one of them filled.
 * Brand colours: keep --ink in step with brand/make_icons.py (icon ground) and manifest.json. */

:root {
	--ink: #10262f;      /* deep water at dusk: text, dark bands */
	--lake: #2c6a6e;     /* lake by day: links, quiet accents */
	--celadon: #bfd3c5;  /* Thai celadon glaze: rules, location band */
	--mist: #eef3ef;     /* morning mist over the water: page ground */
	--sun: #f2a900;      /* the gold of the logo: the one warm accent */
	--paper: #ffffff;
	--muted: #4b5f66;
	--on-dark: rgba(255, 255, 255, 0.86);
	--on-dark-muted: rgba(255, 255, 255, 0.62);
	--rule-dark: rgba(255, 255, 255, 0.16);

	--serif: "Spectral", "Iowan Old Style", Georgia, serif;
	--sans: "Commissioner", -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Thai", sans-serif;

	--gutter: clamp(16px, 4.5vw, 56px);
	--max: 1240px;
	--section: clamp(72px, 11vw, 152px);
	--mark: min(9.5rem, 12.6vw);
	color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

body {
	margin: 0;
	background: var(--mist);
	color: var(--ink);
	font: 400 1.0625rem/1.6 var(--sans);
}

img { display: block; max-width: 100%; height: auto; }

a { color: var(--lake); }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 300; margin: 0; }

h2 { font-size: clamp(2.125rem, 4.4vw, 3.5rem); line-height: 1.08; letter-spacing: -0.01em; }

h3 { font-weight: 400; font-size: clamp(1.375rem, 2.2vw, 1.875rem); line-height: 1.2; }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- buttons and language ---------- */

.btn {
	display: inline-block;
	padding: 13px 22px;
	border: 1px solid transparent;
	border-radius: 2px;
	font: 500 0.9375rem/1.2 var(--sans);
	letter-spacing: 0.01em;
	text-decoration: none;
	cursor: pointer;
	white-space: nowrap;
}

.btn-sun { background: var(--sun); color: var(--ink); }
.btn-sun:hover { background: #ffbd1f; }
.btn-line { border-color: rgba(255, 255, 255, 0.7); color: #fff; background: transparent; }
.btn-line:hover { background: rgba(255, 255, 255, 0.12); }
.btn-ink { background: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--lake); }

.lang { display: flex; gap: 2px; }

.lang button {
	border: 0;
	border-radius: 2px;
	background: transparent;
	color: inherit;
	opacity: 0.7;
	font: 500 0.8125rem/1 var(--sans);
	padding: 7px 8px;
	cursor: pointer;
}

.lang button[aria-pressed="true"] { opacity: 1; box-shadow: inset 0 -2px 0 var(--sun); }

/* ---------- navigation over the hero ---------- */

.nav {
	position: absolute;
	inset: 0 0 auto 0;
	z-index: 4;
	display: flex;
	align-items: center;
	gap: clamp(12px, 2vw, 28px);
	padding: calc(env(safe-area-inset-top) + 16px) var(--gutter) 16px;
	color: #fff;
}

.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 400 1.1875rem/1 var(--serif); }
.brand img { width: 34px; height: 34px; }
.brand .short { display: none; }

.nav .links { display: flex; gap: clamp(14px, 1.8vw, 26px); margin-left: auto; }
.nav .links a { color: var(--on-dark); text-decoration: none; font-size: 0.9375rem; }
.nav .links a:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--sun); text-underline-offset: 7px; }
.nav .tools { display: flex; align-items: center; gap: 10px; }
.nav .btn { padding: 9px 16px; }

/* ---------- hero: the name on the horizon ---------- */

.hero {
	position: relative;
	height: 100vh;
	height: 100svh;
	min-height: 560px;
	overflow: hidden;
	background: var(--ink);
	color: #fff;
	/* --horizon: where water meets land in the photo, as a share of its height; object-position keeps that
	   point at the same share of the hero at any screen ratio. --lift: how high the name stands above it. */
	--horizon: 56%;
	--lift: 16%;
}

.hero .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% var(--horizon); max-width: none; }

.hero::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgba(16, 38, 47, 0.5) 0%, rgba(16, 38, 47, 0) 24%),
		linear-gradient(0deg, rgba(16, 38, 47, 0.72) 0%, rgba(16, 38, 47, 0) 42%);
	pointer-events: none;
}

/* The name stands in the sky above the palms; its reflection lies in the water as far below the horizon. */
.mark { position: absolute; inset: 0; z-index: 2; pointer-events: none; }

.mark h1,
.mark .reflection {
	position: absolute;
	left: var(--gutter);
	margin: 0;
	font: 300 var(--mark)/1 var(--serif);
	letter-spacing: -0.02em;
	white-space: nowrap;
}

.mark h1 { bottom: calc(100% - var(--horizon) + var(--lift)); color: #fff; text-shadow: 0 2px 30px rgba(16, 38, 47, 0.35); }

.mark .reflection {
	bottom: calc(100% - var(--horizon) - var(--lift));
	color: #fff;
	opacity: 0.36;
	transform-origin: 50% 100%;
	transform: scaleY(-0.8);
	filter: url(#ripple);
	-webkit-mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 80%);
	mask-image: linear-gradient(to top, #000 0%, rgba(0, 0, 0, 0.55) 35%, transparent 80%);
	user-select: none;
}

/* app.js hides the reflection where it would run into the text at the bottom (a low screen, Safari bars). */
.mark .reflection.clash { visibility: hidden; }

.hero .lead {
	position: absolute;
	z-index: 2;
	left: var(--gutter);
	right: var(--gutter);
	bottom: calc(env(safe-area-inset-bottom) + clamp(28px, 6vh, 64px));
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px 40px;
}

.hero .lead p { margin: 0; max-width: 30rem; font-size: clamp(1.0625rem, 1.5vw, 1.25rem); line-height: 1.5; color: var(--on-dark); }
.hero .actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- residents: the way in (signed in: the way to the cabinet) ---------- */

.residents { background: var(--ink); color: #fff; padding: var(--section) 0; }
.residents .head { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 24px var(--gutter); align-items: end; }
.residents .head p { margin: 0; color: var(--on-dark-muted); max-width: 34rem; }
.residents .who { color: var(--on-dark); }

/* ---------- the cabinet of a signed-in user ---------- */

.cab-head {
	/* the content column of the cabinet; the bar and the greeting line up with the tiles below */
	--col: max(var(--gutter), calc((100% - 1120px) / 2 + var(--gutter)));
	position: relative;
	height: clamp(260px, 42vh, 400px);
	overflow: hidden;
	background: var(--ink);
	color: #fff;
}

.cab-head .photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; max-width: none; }

.cab-head::after {
	content: "";
	position: absolute;
	inset: 0;
	background:
		linear-gradient(180deg, rgba(16, 38, 47, 0.55) 0%, rgba(16, 38, 47, 0) 34%),
		linear-gradient(0deg, rgba(16, 38, 47, 0.78) 0%, rgba(16, 38, 47, 0) 58%);
	pointer-events: none;
}

.bar {
	position: absolute;
	inset: 0 0 auto 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: calc(env(safe-area-inset-top) + 16px) var(--col) 16px;
}

.bar .tools { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.bar .btn { padding: 9px 16px; }
.bar .village-link { color: var(--on-dark); font-size: 0.9375rem; text-decoration: none; margin-right: 8px; }
.bar .village-link:hover { color: #fff; text-decoration: underline; text-decoration-color: var(--sun); text-underline-offset: 7px; }

.greet { position: absolute; z-index: 2; left: var(--col); right: var(--col); bottom: clamp(20px, 4vh, 40px); }
.greet h1 { font-size: clamp(2rem, 4.6vw, 3.5rem); line-height: 1.08; letter-spacing: -0.01em; }
.greet p { margin: 6px 0 0; color: var(--on-dark-muted); }

.cab { max-width: 1120px; margin: 0 auto; padding: clamp(24px, 4vw, 44px) var(--gutter) clamp(48px, 7vw, 96px); }
.cab .group + .group { margin-top: clamp(28px, 4vw, 40px); }
.cab h2 { font: 600 1rem/1.3 var(--sans); letter-spacing: 0; color: var(--muted); margin: 0 0 12px; }
.cab .empty { margin: 0; max-width: 36rem; color: var(--muted); }

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

.tile {
	display: grid;
	grid-template-columns: 30px minmax(0, 1fr);
	column-gap: 14px;
	align-content: start;
	min-height: 96px;
	padding: 18px 20px 20px;
	background: var(--paper);
	border: 1px solid var(--celadon);
	border-radius: 4px;
	color: var(--ink);
	text-decoration: none;
}

.tile .icon { grid-row: 1 / span 2; width: 28px; height: 28px; margin-top: 1px; fill: none; stroke: var(--lake); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tile b { font: 600 1.0625rem/1.3 var(--sans); }
.tile span { margin-top: 4px; font-size: 0.9375rem; line-height: 1.4; color: var(--muted); }
.tile:hover { border-color: var(--lake); }
.tile:hover b { text-decoration: underline; text-decoration-color: var(--sun); text-underline-offset: 5px; }

/* The one filled tile: what a resident comes for most often. */
.tile.primary { background: var(--lake); border-color: var(--lake); color: #fff; }
.tile.primary .icon { stroke: #fff; }
.tile.primary span { color: var(--on-dark); }
.tile.primary:hover { background: #245b5f; }

.cab-foot { background: none; padding: 0 0 calc(env(safe-area-inset-bottom) + 32px); color: var(--muted); font-size: 0.875rem; }
.cab-foot a { color: var(--lake); }
.cab-foot .wrap { max-width: 1120px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; border-top: 1px solid var(--celadon); padding-top: 20px; }
.cab-foot p { margin: 0; }

/* ---------- intro ---------- */

.intro { padding: var(--section) 0; }
.intro .wrap { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(40px, 7vw, 112px); align-items: end; }
.statement { margin: 0; font: 300 clamp(1.75rem, 3.3vw, 2.75rem)/1.28 var(--serif); letter-spacing: -0.005em; max-width: 21em; }
.facts { margin: 0; }
.facts div { padding: 16px 0 18px; border-top: 1px solid var(--celadon); }
.facts dt { font: 400 1.3125rem/1.3 var(--serif); }
.facts dd { margin: 4px 0 0; color: var(--muted); }

/* ---------- living here: photo and text, alternating ---------- */

.living { padding-bottom: var(--section); }
.living > .wrap > h2 { margin-bottom: clamp(40px, 6vw, 80px); max-width: 14em; }

.story { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gutter); align-items: end; margin-bottom: clamp(56px, 9vw, 128px); }
.story:last-child { margin-bottom: 0; }
.story figure { margin: 0; grid-column: 1 / span 7; }
.story.tall figure { grid-column: 2 / span 5; }
.story .text { grid-column: 9 / span 4; padding-bottom: 8px; }
.story.flip figure { grid-column: 6 / span 7; grid-row: 1; }
.story.flip.tall figure { grid-column: 7 / span 5; }
.story.flip .text { grid-column: 1 / span 4; grid-row: 1; }
.story img { width: 100%; border-radius: 2px; }
.story h3 { margin-bottom: 12px; }
.story p { margin: 0; color: var(--muted); max-width: 32ch; }

/* ---------- around the village ---------- */

.around { background: var(--paper); padding: var(--section) 0; }
.around .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 7vw, 112px); align-items: start; }
.around figure { margin: 0; position: sticky; top: 24px; }
.around figure img { border-radius: 2px; }
.around h2 { margin-bottom: 12px; }
.around .note { margin: 0 0 clamp(28px, 4vw, 44px); color: var(--muted); font-size: 0.9375rem; }
.around ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 clamp(24px, 3vw, 48px); }
.around li { padding: 18px 0 22px; border-top: 1px solid var(--celadon); }
.around li b { display: block; font: 400 1.3125rem/1.3 var(--serif); margin-bottom: 4px; }
.around li span { color: var(--muted); font-size: 0.9875rem; }

/* ---------- homes ---------- */

.homes { position: relative; min-height: min(88vh, 860px); display: flex; align-items: flex-end; color: #fff; background: var(--ink); }
.homes > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; max-width: none; }
.homes .panel {
	position: relative;
	z-index: 1;
	margin: 0 0 var(--gutter) var(--gutter);
	max-width: 31rem;
	padding: clamp(24px, 3.4vw, 44px);
	background: rgba(16, 38, 47, 0.9);
	border-radius: 2px;
}
.homes .panel p { margin: 14px 0 24px; color: var(--on-dark); }

/* ---------- location ---------- */

.location { background: var(--celadon); padding: var(--section) 0; }
.location .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 7vw, 112px); }
.location p { margin: 14px 0 0; max-width: 30rem; }
.location dl { margin: 0; }
.location dl div { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid rgba(16, 38, 47, 0.2); }
.location dt { font: 400 1.1875rem/1.3 var(--serif); }
.location dd { margin: 0; color: var(--muted); white-space: nowrap; }

/* ---------- contact ---------- */

.contact { padding: var(--section) 0; }
.contact .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(40px, 7vw, 112px); align-items: end; }
.contact p { margin: 0; color: var(--muted); max-width: 34rem; }

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

footer { background: var(--ink); color: var(--on-dark-muted); font-size: 0.875rem; padding: 36px 0 calc(env(safe-area-inset-bottom) + 36px); }
footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between; }
footer .brand { font-size: 1.0625rem; }
footer .brand img { width: 28px; height: 28px; }
footer p { margin: 0; max-width: 40rem; }
footer a { color: var(--on-dark); }

.error { margin: 16px 0 0; padding: 10px 14px; border-radius: 2px; background: #fde8e4; color: #8a1f0c; }

/* ---------- narrow screens ---------- */

@media (max-width: 1000px) {
	.nav .links { display: none; }
	.nav .tools { margin-left: auto; }
}

@media (max-width: 760px) {
	.bar .village-link { display: none; }
	.intro .wrap, .around .wrap, .location .wrap, .contact .wrap, .residents .head { grid-template-columns: minmax(0, 1fr); }
	.story, .story.tall, .story.flip, .story.flip.tall { grid-template-columns: minmax(0, 1fr); gap: 18px; }
	.story figure, .story.tall figure, .story.flip figure, .story.flip.tall figure { grid-column: 1; grid-row: 1; margin: 0 calc(-1 * var(--gutter)); }
	.story .text, .story.flip .text { grid-column: 1; grid-row: 2; }
	.story img { border-radius: 0; }
	.story.tall img { aspect-ratio: 4 / 4.4; object-fit: cover; }
	.around figure { position: static; }
	.around figure img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
	.around ul { grid-template-columns: minmax(0, 1fr); }
	.homes .panel { margin: 0; max-width: none; width: 100%; }
}

@media (max-width: 480px) {
	.brand .full { display: none; }
	.brand .short { display: inline; }
	.nav, .bar { gap: 8px; }
	.nav .btn, .bar .btn { padding: 8px 12px; }
	.cab-head { height: 240px; }
	/* Buttons share one row, so the lead block stays clear of the reflection in the water. */
	.hero .lead { gap: 16px; }
	.hero .actions { width: 100%; flex-wrap: nowrap; gap: 10px; }
	.hero .actions .btn { flex: 1; padding: 12px 8px; font-size: 0.875rem; text-align: center; }
}
