/* ==========================================================================
   PW Models – main stylesheet
   Grid/flexbox layout replacing the old absolutely-positioned layers.
   ========================================================================== */

:root {
    --colour-text: #555;
    --colour-heading: #666;
    --colour-panel: rgba(204, 204, 255, 0.35);   /* translucent lilac panel used for the header, menu and footer */
    --colour-page: rgba(255, 255, 255, 0.85);
    --colour-border: #000;
    --colour-button: #ffe2cd;
    --colour-button-text: #e65700;
    --colour-button-hover: #e0c7b4;
    --colour-button-hover-text: #333;
    --colour-button-edge: #cfb6a6;

    --font-serif: "Times New Roman", Times, Georgia, serif;
    --nav-width: clamp(215px, 15vw, 260px);
    --page-width: 1440px;
    --gutter: clamp(1rem, 3vw, 3rem);
    --curl-clearance: clamp(1rem, 10vw, 140px);   /* keeps header/footer text off the page curls */
    --radius: 12px;
    --corner: 50px;   /* inside curves where the content meets the menu column */
}

/* Fluid base size: 16px on phones rising to 20px on large screens.
   Everything sized in rem scales with it. */
html {
    font-size: clamp(1rem, 0.85rem + 0.35vw, 1.25rem);
}

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

body {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--colour-text);
    background: #fff url(../../images/background.png) repeat fixed center;
}

img {
    max-width: 100%;
    height: auto;
    border: 0;
}

a {
    color: var(--colour-button-text);
}

h1,
h2,
h3 {
    font-family: var(--font-serif);
    color: var(--colour-heading);
    line-height: 1.2;
}

h1 { font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 1rem + 0.8vw, 1.75rem); }
h3 { font-size: 1.15rem; }

/* --------------------------------------------------------------------------
   Page frame (with the decorative page-curl corners)
   -------------------------------------------------------------------------- */

.page {
    display: grid;
    grid-template-columns: var(--nav-width) 1fr;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header header"
        "nav    content"
        "footer footer";
    min-height: 100vh;
    width: min(100% - 2 * var(--gutter), var(--page-width));
    margin: 0 auto;
    border-inline: 1px solid var(--colour-border);
    background:
        url(../../images/pagecurl_top_left.gif) no-repeat top left,
        url(../../images/pagecurl_top_right.gif) no-repeat top right,
        url(../../images/pagecurl_bottom_left.gif) no-repeat bottom left,
        url(../../images/pagecurl_bottom_right.gif) no-repeat bottom right,
        var(--colour-page);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(1rem, 4vw, 4rem);
    padding: clamp(1rem, 2vw, 2rem) var(--curl-clearance);
    background: var(--colour-panel);
    text-align: center;
}

.site-header__logo img {
    display: block;
    width: clamp(110px, 12vw, 200px);
    border: 1px solid #ffcc99;
    background: #fff;
}

.site-header__name {
    margin: 0 0 0.25rem;
    font-size: clamp(1.6rem, 1rem + 2vw, 3rem);
    font-weight: bold;
    color: var(--colour-heading);
}

.site-header__tagline {
    margin: 0;
    text-wrap: balance;
    font-size: clamp(1rem, 0.8rem + 0.8vw, 1.5rem);
    font-weight: bold;
    color: var(--colour-heading);
}

/* --------------------------------------------------------------------------
   Navigation – CSS buttons replacing the old image-swap GIFs
   -------------------------------------------------------------------------- */

.site-nav {
    grid-area: nav;
    padding: clamp(1.5rem, 2vw, 2.5rem) clamp(0.75rem, 1vw, 1.25rem);
    background: var(--colour-panel);
}

.site-nav ul {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    list-style: none;
    position: sticky;   /* menu stays in view on long pages */
    top: 1rem;
}

.site-nav a {
    display: block;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--colour-button-edge);
    border-radius: 999px;
    background: linear-gradient(#fffff0, var(--colour-button) 40%, var(--colour-button));
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
    color: var(--colour-button-text);
    font-weight: bold;
    font-size: 0.95rem;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
    background: linear-gradient(#fffff0, var(--colour-button-hover) 40%, var(--colour-button-hover));
    color: var(--colour-button-hover-text);
}

/* --------------------------------------------------------------------------
   Main content
   -------------------------------------------------------------------------- */

.content {
    grid-area: content;
    position: relative;
    padding: clamp(1.5rem, 2.5vw, 3rem) clamp(1.5rem, 4vw, 5rem) 4rem;
    text-align: center;
}

/* Curved inside corners joining the menu column to the header and footer
   drawn in CSS so they match the panel colour exactly */
.content::before,
.content::after {
    content: "";
    position: absolute;
    left: 0;
    width: var(--corner);
    height: var(--corner);
    pointer-events: none;
}

.content::before {
    top: 0;
    background: radial-gradient(circle at 100% 100%, transparent calc(var(--corner) - 0.5px), var(--colour-panel) var(--corner));
}

.content::after {
    bottom: 0;
    background: radial-gradient(circle at 100% 0, transparent calc(var(--corner) - 0.5px), var(--colour-panel) var(--corner));
}

.content p {
    max-width: 70ch;
    margin-inline: auto;
    font-weight: bold;
}

/* Gallery of model photographs – equal-sized items, as many per row as fit,
   with any leftover item centred on the last row */
.gallery {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(1.5rem, 3vw, 3rem);
    margin-top: clamp(1.5rem, 3vw, 3rem);
}

.gallery figure {
    flex: 0 1 22rem;
    min-width: min(100%, 300px);
    margin: 0;
}

/* A lone feature image (e.g. the home page) can be larger */
.gallery figure:only-child {
    flex-basis: 40rem;
}

.gallery a {
    display: block;
}

.gallery img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;   /* keeps mixed-shape photos uniform; the lightbox shows them uncropped */
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

/* Very tall photos shown whole rather than cropped, capped in height */
.gallery img.is-uncropped {
    width: auto;
    max-height: 36rem;
    margin-inline: auto;
    aspect-ratio: auto;
}

.gallery a:hover img,
.gallery a:focus-visible img {
    transform: scale(1.02);
}

.gallery figcaption {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.gallery figcaption strong {
    display: block;
    font-size: 1rem;
    color: var(--colour-heading);
}

.gallery figcaption em {
    display: block;
    margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Site map
   -------------------------------------------------------------------------- */

.sitemap {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: fit-content;
    margin: 2rem auto;
    padding: 0;
    list-style: none;
    font-size: 1.1rem;
    font-weight: bold;
}

.sitemap a {
    text-decoration: none;
}

.sitemap a:hover,
.sitemap a:focus-visible {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Contact page
   -------------------------------------------------------------------------- */

.contact-form {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 0.9rem 1rem;
    align-items: start;
    max-width: 40rem;
    margin: 2rem auto;
    text-align: left;
}

.contact-form label {
    padding-top: 0.45rem;
    font-weight: bold;
    color: var(--colour-heading);
    text-align: right;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 1px solid var(--colour-button-edge);
    border-radius: 6px;
    background: #fff;
    font: inherit;
    color: var(--colour-text);
}

.contact-form textarea {
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: 2px solid var(--colour-button-text);
    outline-offset: 1px;
}

.contact-form [aria-invalid="true"] {
    border-color: #c00;
}

.contact-form .required {
    color: var(--colour-button-text);
}

.contact-form .field-error {
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
    color: #c00;
}

.contact-form__actions {
    grid-column: 2;
}

.contact-form button {
    padding: 0.5rem 1.75rem;
    border: 1px solid var(--colour-button-edge);
    border-radius: 999px;
    background: linear-gradient(#fffff0, var(--colour-button) 40%, var(--colour-button));
    box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.25);
    font: inherit;
    font-weight: bold;
    color: var(--colour-button-text);
    cursor: pointer;
}

.contact-form button:hover,
.contact-form button:focus-visible {
    background: linear-gradient(#fffff0, var(--colour-button-hover) 40%, var(--colour-button-hover));
    color: var(--colour-button-hover-text);
}

.contact-form button:disabled {
    opacity: 0.6;
    cursor: wait;
}

.notice {
    max-width: 40rem;
    margin: 1.5rem auto;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
}

.notice h2 {
    margin-top: 0.25rem;
}

.notice--success {
    border: 1px solid #9c9;
    background: #eef8ee;
}

.notice--error {
    border: 1px solid #e3a3a3;
    background: #fdeeee;
}

.notice--error p {
    color: #a00;
}

.contact-address {
    margin: 2rem auto 0;
    font-style: normal;
    font-weight: bold;
    line-height: 1.6;
}

.contact-address a {
    color: inherit;
}

@media (max-width: 720px) {
    .contact-form {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }

    .contact-form label {
        padding-top: 0.6rem;
        text-align: left;
    }

    .contact-form__actions {
        grid-column: 1;
        margin-top: 0.75rem;
        text-align: center;
    }
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
    grid-area: footer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 67px;
    padding: 0.75rem var(--curl-clearance);
    background: var(--colour-panel);
}

.site-footer p {
    margin: 0;
    font-size: 0.85rem;
    color: #333;
    text-align: center;
}

.site-footer a {
    color: #333;
    font-weight: bold;
}

/* --------------------------------------------------------------------------
   Lightbox (replaces the old pop-up window)
   -------------------------------------------------------------------------- */

.lightbox {
    max-width: min(95vw, 1200px);
    max-height: 95vh;
    padding: 1rem;
    border: 1px solid #848484;
    background: #fff;
    text-align: center;
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.7);
}

.lightbox__image {
    display: block;
    max-height: calc(95vh - 6rem);
    margin: 0 auto;
}

.lightbox__caption {
    margin: 0.5rem 0 0;
    font-weight: bold;
}

.lightbox__close {
    position: absolute;
    top: 0.25rem;
    right: 0.5rem;
    border: 0;
    background: none;
    font-size: 2rem;
    line-height: 1;
    color: #333;
    cursor: pointer;
}

/* --------------------------------------------------------------------------
   Small screens: stack everything and run the nav horizontally
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
    .page {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr auto;
        grid-template-areas:
            "header"
            "nav"
            "content"
            "footer";
        width: 100%;
        border-inline: 0;
        background: var(--colour-page);   /* drop the curls – too big for phones */
    }

    .site-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem;
    }

    .site-nav {
        padding: 0.75rem 1rem;
    }

    .site-nav ul {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .content {
        padding: 1rem 1rem 2rem;
    }

    .content::before,
    .content::after {
        display: none;
    }

    .site-footer {
        padding: 0.5rem 1rem;
    }
}
