/* Beach House – tidied stylesheet (first-pass rewrite of styles.css)

   Keeps the existing look: lilac photo border, pale-yellow amenities card,
   red "Beach House" name, #333 text. What changed is how it is built:
   colours and fonts live in one place, layouts use grid instead of
   table/float, and the page works from phones up to wide screens. */


/* 1. Colours, fonts and sizes – change them here and the whole page follows */

:root {
	--color-text: #333;
	--color-accent: #f50031;      /* the "Beach House" name in the intro */
	--color-lilac: #b691b6;       /* border round the main photo */
	--color-rule: #d8c3d8;        /* dividing lines (now actually visible) */
	--color-card-bg: #ffffdf;     /* amenities card */
	--color-card-border: #e8cfa9;
	--color-link: #2a5c8f;
	--color-visited: #6b4a8f;
	--font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--page-width: 70rem;
}


/* 2. Base styles – apply to the whole page */

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	max-inline-size: var(--page-width);
	margin-block: 0;
	margin-inline: auto;
	/* side padding grows from 0.75rem on phones to 2rem on wide screens */
	padding: 1rem clamp(0.75rem, 4vw, 2rem);
	font-family: var(--font-body);
	font-size: 1.125rem;
	line-height: 1.55;
	color: var(--color-text);
	overflow-wrap: break-word;
}

/* block removes the small gap browsers leave under inline images;
   height:auto keeps the shape when width/height attributes are set in the HTML */
img {
	display: block;
	max-inline-size: 100%;
	block-size: auto;
}

h1,
h2 {
	line-height: 1.2;
	text-wrap: balance;
}

h1 {
	margin: 0;
	font-size: clamp(1.9rem, 1.3rem + 3vw, 3rem);
}

h2 {
	margin: 0 0 0.5rem;
	font-size: 1.4rem;
}

p,
ul {
	margin-block: 0 0.75rem;
}

p {
	text-wrap: pretty;
}

li + li {
	margin-block-start: 0.35rem;
}

a {
	color: var(--color-link);
	text-underline-offset: 0.15em;
}

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

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


/* 3. Header and footer */

.site-header {
	margin-block-end: 1.5rem;
	padding-block-end: 1rem;
	text-align: center;
	border-block-end: 6px double var(--color-rule);
}

.strap {
	margin: 0.25rem 0 0;
	font-size: 1.1rem;
}

.site-footer {
	margin-block-start: 2rem;
	padding-block-start: 1rem;
	text-align: center;
	font-size: 0.9rem;
	border-block-start: 6px double var(--color-rule);
}

.site-footer p {
	margin-block-end: 0.25rem;
}


/* 4. Intro: text and main photo. One column on phones, two side by side on wider screens */

.intro {
	display: grid;
	gap: 1rem 2rem;
	align-items: center;
	margin-block-end: 2rem;
}

.intro-text {
	margin: 0;
	/* grows smoothly with the screen instead of jumping at one breakpoint */
	font-size: clamp(1.2rem, 1.05rem + 0.75vw, 1.5rem);
	font-style: italic;
}

.accent {
	color: var(--color-accent);
}

.hero {
	position: relative;   /* lets the caption sit on top of the photo */
	margin: 0;
}

.hero img {
	inline-size: 100%;
	border: 4px solid var(--color-lilac);
	border-radius: 4px;
}

.hero figcaption {
	position: absolute;
	inset-block-end: 0.5rem;
	inset-inline-end: 1rem;
	padding: 0.2rem 0.4rem;
	font-size: 0.8rem;
	line-height: 1.3;
	background-color: #222;
	color: #e4e4e4;
}

@media (min-width: 50em) {
	.intro {
		grid-template-columns: 1fr 1fr;
	}
}


/* 5. Photo gallery. Phones: first photo wide, then two by two. Wider: all five in a row */

.gallery {
	margin-block-end: 2rem;
}

.gallery-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 0.5rem;
}

.gallery-grid img {
	inline-size: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 4px;
}

.gallery-grid img:first-child {
	grid-column: 1 / -1;
}

@media (min-width: 40em) {
	.gallery-grid {
		grid-template-columns: repeat(5, 1fr);
	}

	.gallery-grid img:first-child {
		grid-column: auto;
	}
}


/* 6. Main information. One column on phones; on wide screens the
      amenities card sits beside the text */

.content > section:not(:first-of-type) {
	margin-block-start: 1rem;
	padding-block-start: 1rem;
	border-block-start: 1px solid var(--color-rule);
}

.amenities {
	margin-block: 1.5rem;
	padding: 1rem 1.25rem;
	background-color: var(--color-card-bg);
	border: 2px solid var(--color-card-border);
	border-radius: 4px;
}

.amenities h2 {
	margin-block-start: 0;
}

.amenities ul {
	margin-block-end: 0;
	padding-inline-start: 1.25rem;
}

.contact-list {
	padding-inline-start: 0;
	list-style: none;
}

@media (min-width: 56em) {
	.content {
		display: grid;
		grid-template-columns: minmax(0, 1fr) 19rem;
		column-gap: 2.5rem;
		align-items: start;
	}

	.content > section {
		grid-column: 1;
	}

	.amenities {
		grid-column: 2;
		grid-row: 1 / span 5;
		margin-block: 0;
	}
}
