/*
 * Trencadis Theme for Reveloni CMS
 * Version: 1.0.3
 *
 * As if Antoni Gaudi designed a website. The guiding rule: no straight line
 * where the eye looks for one. Catenary-arched cards, pebble gallery frames
 * (each shard a different shape), wavy underlines, bone-shaped buttons,
 * and the signature: a trencadis mosaic strip - broken ceramic shards with
 * white grout - drawn entirely as inline SVG, crowning the hero and the
 * footer bench.
 *
 * Day (default) = Mediterranean sun on Montjuic stone.
 * Night = Casa Batllo after dark: indigo, ceramics glowing like stained glass.
 *
 * Typography: Fraunces (display, with its soft curved details and swash
 * italics) x Karla (humanist body).
 */

/* === TOKENS - DAY === */
:root {
    /* Montjuic stone & grout */
    --tc-bg: #f3e9d7;
    --tc-bg-raised: #faf4e8;
    --tc-grout: #fdf9f0;

    /* Ceramic palette */
    --tc-cobalt: #1f5e8c;
    --tc-teal: #2f9c95;
    --tc-ochre: #d9930d;
    --tc-terra: #c4552e;
    --tc-glaze: #3d6b4f;

    --tc-ink: #2c2418;
    --tc-ink-soft: #6b5d48;
    --tc-edge: rgba(44, 36, 24, 0.18);
    --tc-edge-soft: rgba(44, 36, 24, 0.10);

    --tc-shadow: 0 10px 30px rgba(118, 84, 34, 0.16);
    --tc-shadow-lift: 0 18px 44px rgba(118, 84, 34, 0.22);

    /* Trencadis strip - day: cream grout, sun-fired ceramics */
    --tc-mosaic: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='44' viewBox='0 0 420 44'><rect width='420' height='44' fill='%23fdf9f0'/><polygon points='0,2 58,0 52,20 64,42 4,44 0,30' fill='%231f5e8c'/><polygon points='62,0 118,3 108,26 120,44 68,42 56,22' fill='%232f9c95'/><polygon points='122,0 170,2 178,24 160,44 124,42 112,24' fill='%23d9930d'/><polygon points='174,0 232,1 214,22 182,26' fill='%231f5e8c'/><polygon points='180,28 216,24 226,44 182,43' fill='%23c4552e'/><polygon points='236,0 288,2 280,20 294,43 230,44' fill='%233d6b4f'/><polygon points='292,0 344,1 336,44 298,42 284,18' fill='%232f9c95'/><polygon points='348,0 420,2 420,26 388,44 340,43 340,20' fill='%231f5e8c'/><polygon points='392,30 420,30 420,44 394,44' fill='%23d9930d'/></svg>");

    /* Type */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Karla', 'Segoe UI', sans-serif;

    /* Engine compatibility aliases (markup uses these in inline styles) */
    --text: var(--tc-ink);
    --text-light: var(--tc-ink-soft);
    --border: var(--tc-edge);
    --accent: var(--tc-cobalt);

    --transition: 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.16s ease;
}

/* === TOKENS - NIGHT (Casa Batllo after dark) === */
[data-theme="dark"] {
    --tc-bg: #1a2440;
    --tc-bg-raised: #222e52;
    --tc-grout: #141b33;

    --tc-cobalt: #4d92c9;
    --tc-teal: #46c4ba;
    --tc-ochre: #f0b13a;
    --tc-terra: #e57a50;
    --tc-glaze: #5d9d77;

    --tc-ink: #f0ead9;
    --tc-ink-soft: #b3aa93;
    --tc-edge: rgba(240, 234, 217, 0.20);
    --tc-edge-soft: rgba(240, 234, 217, 0.10);

    --tc-shadow: 0 10px 30px rgba(0, 0, 0, 0.40);
    --tc-shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.50);

    /* Night mosaic: indigo grout, glowing ceramics */
    --tc-mosaic: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='420' height='44' viewBox='0 0 420 44'><rect width='420' height='44' fill='%23141b33'/><polygon points='0,2 58,0 52,20 64,42 4,44 0,30' fill='%234d92c9'/><polygon points='62,0 118,3 108,26 120,44 68,42 56,22' fill='%2346c4ba'/><polygon points='122,0 170,2 178,24 160,44 124,42 112,24' fill='%23f0b13a'/><polygon points='174,0 232,1 214,22 182,26' fill='%234d92c9'/><polygon points='180,28 216,24 226,44 182,43' fill='%23e57a50'/><polygon points='236,0 288,2 280,20 294,43 230,44' fill='%235d9d77'/><polygon points='292,0 344,1 336,44 298,42 284,18' fill='%2346c4ba'/><polygon points='348,0 420,2 420,26 388,44 340,43 340,20' fill='%234d92c9'/><polygon points='392,30 420,30 420,44 394,44' fill='%23f0b13a'/></svg>");
}

/* === BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--tc-ink);
    background-color: var(--tc-bg);
    /* Soft sun vignette on the stone */
    background-image: radial-gradient(120% 90% at 50% 0%,
        rgba(255, 255, 255, 0.35), transparent 60%);
    min-height: 100vh;
    transition: background-color var(--transition), color var(--transition);
}

[data-theme="dark"] body {
    background-image: radial-gradient(120% 90% at 50% 0%,
        rgba(77, 146, 201, 0.10), transparent 60%);
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 2rem;
}

main {
    min-height: 55vh;
    padding-bottom: 3rem;
}

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

/* The curve belongs to God: wavy underlines instead of straight rules */
a {
    color: var(--tc-cobalt);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: color-mix(in srgb, var(--tc-cobalt) 45%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.22em;
    transition: color var(--transition-fast), text-decoration-color var(--transition-fast);
}

a:hover {
    color: var(--tc-terra);
    text-decoration-color: var(--tc-terra);
}

::selection {
    background: var(--tc-ochre);
    color: #2c2418;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 600;
    line-height: 1.16;
    color: var(--tc-ink);
    letter-spacing: -0.01em;
}

h1 {
    font-size: clamp(2.5rem, 5.6vw, 4.1rem);
    font-weight: 640;
}

h2 { font-size: clamp(1.65rem, 3.2vw, 2.3rem); }
h3 { font-size: 1.3rem; }

p { margin-bottom: 1.15rem; }

/* === HEADER === */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--tc-bg-raised) 88%, transparent);
    border-bottom: 1px solid var(--tc-edge-soft);
    box-shadow: 0 4px 18px rgba(118, 84, 34, 0.10);
}

/* Backdrop blur on a pseudo-element, not on <header> (menu fix).
   Prevents the header from becoming a containing block for the mobile
   dropdown's position:fixed - which collapsed it to a strip and pushed
   it off-screen. Frosted look unchanged. */
header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

[data-theme="dark"] header {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    gap: 2rem;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    /* v1.0.1: the title column must shrink instead of colliding with the
       menu button on narrow screens; v1.0.2: it wraps instead of clipping */
    flex: 1 1 auto;
}

.logo-container img {
    height: 62px;
    width: auto;
    flex-shrink: 0;
    border-radius: 38% 62% 55% 45% / 50% 44% 56% 50%;
}

.logo-container a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
}

.site-title {
    font-family: var(--font-display);
    font-weight: 640;
    font-style: italic;
    font-size: 1.6rem;
    line-height: 1.2;
    color: var(--tc-ink);
    /* v1.0.2: long names wrap to the next line (like the older themes)
       instead of being cut off with an ellipsis */
    overflow-wrap: break-word;
    min-width: 0;
}

/* A small ceramic shard before the title */
.site-title::before {
    content: '';
    display: inline-block;
    width: 0.62em;
    height: 0.62em;
    margin-right: 0.45rem;
    background: var(--tc-teal);
    border-radius: 62% 38% 55% 45% / 48% 60% 40% 52%;
    transform: rotate(-12deg);
    vertical-align: baseline;
}

/* === BREADCRUMBS === */
.breadcrumbs {
    padding: 1.4rem 0 0.3rem;
    font-size: 0.88rem;
    font-style: italic;
    font-family: var(--font-display);
    color: var(--tc-ink-soft);
}

.breadcrumbs a {
    color: var(--tc-ink-soft);
    text-decoration-color: var(--tc-edge);
}

.breadcrumbs a:hover {
    color: var(--tc-cobalt);
}

.breadcrumbs span {
    margin: 0 0.3rem;
    color: var(--tc-edge);
}

/* === NAVIGATION === */
nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hamburger-menu {
    position: relative;
}

.hamburger-btn {
    background: var(--tc-bg-raised);
    border: 1px solid var(--tc-edge);
    color: var(--tc-ink);
    padding: 0.55rem 1.15rem;
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.86rem;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
    /* Casa Batllo bone */
    border-radius: 1.6rem 1.1rem 1.5rem 1rem / 1.1rem 1.6rem 1rem 1.5rem;
    transition: all var(--transition-fast);
}

/* v1.0.1: the markup already ships its own <span>☰</span> - the old ::before
   icon doubled it. The glyph span is replaced with an ornamental chip of the
   actual trencadis mosaic (follows day/night automatically via --tc-mosaic). */
.hamburger-btn span:first-child {
    font-size: 0;
    width: 1.5em;
    height: 1.1em;
    background-image: var(--tc-mosaic);
    background-size: auto 220%;
    background-position: 18% 40%;
    border: 1px solid var(--tc-edge);
    border-radius: 58% 42% 55% 45% / 45% 52% 48% 55%;
    transform: rotate(-6deg);
    transition: transform var(--transition-fast);
}

.hamburger-btn:hover span:first-child {
    transform: rotate(6deg);
}

.hamburger-btn:hover {
    border-color: var(--tc-cobalt);
    box-shadow: var(--tc-shadow);
    transform: translateY(-1px);
}

/* v1.0.1: the toggle is rendered by the engine AFTER the footer, outside
   the header - it must be position:fixed (like earlier themes), otherwise
   it lands in the bottom-left corner of the document flow. */
.dark-mode-toggle {
    position: fixed;
    bottom: 1.6rem;
    right: 1.6rem;
    z-index: 1200;
    background: var(--tc-bg-raised);
    border: 1px solid var(--tc-edge);
    color: var(--tc-ink);
    width: 48px;
    height: 46px;
    cursor: pointer;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 55% 45% 50% 50% / 48% 55% 45% 52%;
    box-shadow: var(--tc-shadow);
    transition: all var(--transition-fast);
}

.dark-mode-toggle:hover {
    border-color: var(--tc-cobalt);
    box-shadow: var(--tc-shadow-lift);
    transform: rotate(8deg);
}

/* === DROPDOWN MENU === */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 270px;
    max-height: 80vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    margin-top: 0.7rem;
    background: var(--tc-bg-raised);
    border: 1px solid var(--tc-edge);
    border-radius: 1.4rem 1rem 1.3rem 1.1rem / 1.1rem 1.4rem 1rem 1.3rem;
    padding: 0.6rem 0;
    list-style: none;
    z-index: 1000;
    box-shadow: var(--tc-shadow-lift);
}

@keyframes tc-bloom {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.dropdown-menu.active {
    display: block;
    animation: tc-bloom 0.22s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.dropdown-menu ul {
    display: block;
    list-style: none;
}

.dropdown-menu li { margin: 0; }

.dropdown-menu a {
    display: block;
    padding: 0.6rem 1.3rem;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--tc-ink);
    transition: background var(--transition-fast), color var(--transition-fast),
                padding-left var(--transition-fast);
}

/* Tiny rotating shard bullet */
.dropdown-menu a::before {
    content: '';
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin-right: 0.55rem;
    background: var(--tc-edge);
    border-radius: 62% 38% 55% 45% / 48% 60% 40% 52%;
    transform: rotate(-12deg);
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.dropdown-menu a:hover,
.dropdown-menu a.active {
    background: color-mix(in srgb, var(--tc-teal) 12%, transparent);
    color: var(--tc-cobalt);
    padding-left: 1.55rem;
}

.dropdown-menu a:hover::before,
.dropdown-menu a.active::before {
    background: var(--tc-ochre);
    transform: rotate(14deg);
}

.dropdown-submenu {
    padding-left: 1rem;
    font-size: 0.86rem;
    list-style: none;
}

.dropdown-submenu a { padding: 0.5rem 1.3rem; font-weight: 400; }

.dropdown-subsubmenu {
    padding-left: 2rem;
    font-size: 0.82rem;
    list-style: none;
}

.dropdown-subsubmenu a { padding: 0.42rem 1.3rem; font-weight: 400; }

/* === HERO (sunlit terrace) === */
.hero {
    padding: 5rem 0 4.6rem;
    position: relative;
}

/* Trencadis strip crowning the hero (signature, appearance 1) */
.hero::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30px;
    background-image: var(--tc-mosaic);
    background-size: auto 100%;
    background-repeat: repeat-x;
    /* Gentle bench curve */
    border-radius: 100% 100% 0 0 / 18px 18px 0 0;
    pointer-events: none;
}

.hero h1 {
    max-width: 18ch;
    margin-bottom: 0.7rem;
}

/* The last breath of the title set in swash italic */
.hero h1::first-line {
    font-style: normal;
}

.hero p {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.18rem;
    color: var(--tc-ink-soft);
    max-width: 560px;
    margin-bottom: 0;
}

/* === CONTENT === */
.content-section {
    padding: 2rem 0 2.4rem;
}

.content-section h2 {
    margin: 2.3rem 0 1.1rem;
    position: relative;
    padding-bottom: 0.9rem;
}

/* Arc divider instead of a straight rule - a catenary smile */
.content-section h2::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 110px;
    height: 14px;
    border-bottom: 3px solid var(--tc-ochre);
    border-radius: 0 0 55% 55% / 0 0 14px 14px;
}

.content-section h3 {
    margin: 1.7rem 0 0.7rem;
    color: var(--tc-cobalt);
}

.content-section ul,
.content-section ol {
    margin: 0 0 1.15rem 1.5rem;
}

.content-section li::marker {
    color: var(--tc-terra);
}

.content-section blockquote {
    margin: 1.6rem 0;
    padding: 1.1rem 1.5rem;
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.08rem;
    background: var(--tc-bg-raised);
    border-left: 4px solid var(--tc-teal);
    border-radius: 0 1.6rem 1.2rem 1.8rem / 0 1.2rem 1.8rem 1.4rem;
    box-shadow: var(--tc-shadow);
}

.content-section img {
    border-radius: 1.8rem 1.2rem 1.6rem 1.4rem / 1.3rem 1.7rem 1.2rem 1.8rem;
    box-shadow: var(--tc-shadow);
    margin: 0.6rem 0;
}

.content-section table {
    border-collapse: collapse;
    width: 100%;
    margin: 1.2rem 0;
    font-size: 0.95rem;
}

.content-section th,
.content-section td {
    border-bottom: 1px solid var(--tc-edge-soft);
    padding: 0.55rem 0.8rem;
    text-align: left;
}

.content-section th {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    color: var(--tc-cobalt);
}

/* Price = glazed ceramic chip */
.price-tag {
    display: inline-block;
    font-weight: 700;
    font-size: 1rem;
    color: #fdf9f0;
    background: var(--tc-glaze);
    padding: 0.4rem 1.1rem;
    margin: 0.4rem 0 1rem;
    border-radius: 1.4rem 1rem 1.3rem 1.1rem / 1rem 1.4rem 1.1rem 1.3rem;
    box-shadow: var(--tc-shadow);
}

/* === BUTTONS (balcony bones of Casa Batllo) === */
.cta-button {
    display: inline-block;
    font-family: var(--font-body);
    font-weight: 800;
    font-size: 0.98rem;
    letter-spacing: 0.02em;
    color: #2c2418;
    background: var(--tc-ochre);
    border: none;
    text-decoration: none;
    padding: 0.95rem 2.2rem;
    margin: 1.2rem 0;
    border-radius: 2rem 1.4rem 1.8rem 1.2rem / 1.4rem 1.9rem 1.3rem 2rem;
    box-shadow: var(--tc-shadow);
    transition: border-radius var(--transition), transform var(--transition-fast),
                box-shadow var(--transition-fast), background var(--transition-fast);
}

/* The bone gently morphs in the hand */
.cta-button:hover {
    border-radius: 1.3rem 1.9rem 1.4rem 2rem / 1.9rem 1.3rem 2rem 1.4rem;
    transform: translateY(-2px);
    box-shadow: var(--tc-shadow-lift);
    background: color-mix(in srgb, var(--tc-ochre) 88%, #ffffff);
    color: #2c2418;
}

.btn {
    display: inline-block;
    font-family: var(--font-body);
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--tc-cobalt);
    background: transparent;
    border: 2px solid var(--tc-cobalt);
    text-decoration: none;
    padding: 0.7rem 1.7rem;
    cursor: pointer;
    border-radius: 1.6rem 1.1rem 1.5rem 1rem / 1.1rem 1.6rem 1rem 1.5rem;
    transition: all var(--transition-fast);
}

.btn:hover {
    background: var(--tc-cobalt);
    color: var(--tc-grout);
    box-shadow: var(--tc-shadow);
}

/* === PAGE CARDS (catenary arches) === */
.page-cards-grid,
.subpages-sections .page-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    justify-content: center;
    gap: 2.2rem;
    padding: 2rem 0 3rem;
}

.page-card {
    background: var(--tc-bg-raised);
    border: 1px solid var(--tc-edge-soft);
    /* Catenary top - the structural signature of the Colonia Guell crypt */
    border-radius: 50% 50% 1.2rem 1.2rem / 4.2rem 4.2rem 1.2rem 1.2rem;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--tc-shadow);
    transition: transform var(--transition), box-shadow var(--transition);
}

.page-card:hover {
    transform: translateY(-6px) rotate(-0.4deg);
    box-shadow: var(--tc-shadow-lift);
}

.page-card-image {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    display: block;
}

.page-card-placeholder {
    width: 100%;
    aspect-ratio: 16 / 10;
    background:
        radial-gradient(60% 80% at 30% 30%, color-mix(in srgb, var(--tc-teal) 30%, transparent), transparent 70%),
        radial-gradient(50% 70% at 75% 65%, color-mix(in srgb, var(--tc-ochre) 26%, transparent), transparent 70%),
        var(--tc-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-style: italic;
    color: var(--tc-ink-soft);
}

.page-card-content {
    padding: 1.4rem 1.6rem 1.6rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.page-card-title {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.page-card-excerpt {
    font-size: 0.95rem;
    color: var(--tc-ink-soft);
    flex: 1;
}

.page-card-link {
    align-self: flex-start;
    margin-top: 1.1rem;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--tc-terra);
    text-decoration-color: color-mix(in srgb, var(--tc-terra) 45%, transparent);
}

.page-card-link:hover {
    color: var(--tc-cobalt);
}

/* === GALLERY (pebble frames - no two shards alike) === */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    justify-content: center;
    gap: 1.8rem;
    padding: 0.6rem 0 1rem;
}

.gallery-item {
    position: relative;
    cursor: zoom-in;
    overflow: hidden;
    box-shadow: var(--tc-shadow);
    transition: transform var(--transition), box-shadow var(--transition);
    /* base pebble */
    border-radius: 58% 42% 55% 45% / 45% 52% 48% 55%;
}

/* Hand-broken tiles: rotate the pebble shape across the grid */
.gallery-item:nth-child(4n+2) {
    border-radius: 44% 56% 48% 52% / 56% 44% 58% 42%;
}

.gallery-item:nth-child(4n+3) {
    border-radius: 52% 48% 60% 40% / 48% 58% 42% 52%;
}

.gallery-item:nth-child(4n+4) {
    border-radius: 46% 54% 42% 58% / 54% 46% 52% 48%;
}

.gallery-item:hover {
    transform: scale(1.02) rotate(0.6deg);
    box-shadow: var(--tc-shadow-lift);
}

.gallery-item img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    transition: transform var(--transition);
}

.gallery-item:hover img {
    transform: scale(1.06);
}

/* === LIGHTBOX === */
.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(20, 27, 51, 0.93);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.lightbox.active {
    display: flex;
}

.lightbox img {
    max-width: 90%;
    max-height: 86%;
    border-radius: 1.8rem 1.2rem 1.6rem 1.4rem / 1.3rem 1.7rem 1.2rem 1.8rem;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.lightbox-close,
.lightbox-nav,
.lightbox-prev,
.lightbox-next {
    position: absolute;
    width: 48px;
    height: 46px;
    background: rgba(243, 233, 215, 0.12);
    color: #f3e9d7;
    border: 1px solid rgba(243, 233, 215, 0.35);
    border-radius: 55% 45% 50% 50% / 48% 55% 45% 52%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-fast);
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(243, 233, 215, 0.24);
    border-color: #f3e9d7;
    transform: rotate(8deg);
}

.lightbox-close { top: 1.5rem; right: 1.5rem; }
.lightbox-prev { left: 1.5rem; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 1.5rem; top: 50%; transform: translateY(-50%); }

.lightbox-prev:hover { transform: translateY(-50%) rotate(8deg); }
.lightbox-next:hover { transform: translateY(-50%) rotate(-8deg); }

.lightbox-counter {
    position: absolute;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 0.95rem;
    color: rgba(243, 233, 215, 0.85);
}

/* === TESTIMONIALS (voices on the bench) === */
.testimonials-section {
    padding: 2.6rem 0 3rem;
}

.testimonials-section h2 {
    margin-bottom: 1.8rem;
}

.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 2rem;
}

.testimonial-card {
    background: var(--tc-bg-raised);
    border: 1px solid var(--tc-edge-soft);
    padding: 1.6rem 1.7rem 1.4rem;
    position: relative;
    box-shadow: var(--tc-shadow);
    /* speech pebble */
    border-radius: 1.8rem 1.4rem 1.8rem 0.4rem / 1.5rem 1.8rem 1.4rem 0.4rem;
}

/* Ceramic quote shard */
.testimonial-card::before {
    content: '”';
    position: absolute;
    top: 0.3rem;
    right: 1.1rem;
    font-family: var(--font-display);
    font-size: 3.2rem;
    line-height: 1;
    color: color-mix(in srgb, var(--tc-teal) 55%, transparent);
    pointer-events: none;
}

.testimonial-text {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.02rem;
}

.testimonial-author {
    margin-top: 1rem;
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--tc-cobalt);
}

.testimonial-author::before {
    content: '— ';
    color: var(--tc-edge);
}

.testimonial-rating {
    margin-top: 0.3rem;
    color: var(--tc-ochre);
    letter-spacing: 0.18em;
    font-size: 0.9rem;
}

/* === CONTACT FORM === */
.contact-form {
    max-width: 640px;
    margin: 1rem 0 2rem;
}

.form-group {
    margin-bottom: 1.35rem;
}

.form-group label {
    display: block;
    font-weight: 800;
    font-size: 0.88rem;
    color: var(--tc-ink-soft);
    margin-bottom: 0.45rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    background: var(--tc-bg-raised);
    border: 1px solid var(--tc-edge);
    color: var(--tc-ink);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 0.8rem 1.1rem;
    border-radius: 1.3rem 1rem 1.2rem 0.9rem / 1rem 1.3rem 0.9rem 1.2rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-group textarea {
    min-height: 160px;
    resize: vertical;
    border-radius: 1.4rem 1.1rem 1.3rem 1rem / 1rem 1.2rem 1rem 1.3rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--tc-cobalt);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc-cobalt) 18%, transparent);
}

.success,
.error {
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.95rem 1.3rem;
    margin: 1rem 0;
    border-radius: 1.4rem 1rem 1.3rem 1.1rem / 1rem 1.4rem 1.1rem 1.3rem;
}

.success {
    color: #1d4332;
    background: color-mix(in srgb, var(--tc-glaze) 22%, var(--tc-bg-raised));
    border: 1px solid var(--tc-glaze);
}

[data-theme="dark"] .success {
    color: #d7efe2;
}

.error {
    color: #7c2d12;
    background: color-mix(in srgb, var(--tc-terra) 18%, var(--tc-bg-raised));
    border: 1px solid var(--tc-terra);
}

[data-theme="dark"] .error {
    color: #ffd9c9;
}

/* === ONE-PAGE & SUBPAGE SECTIONS === */
.onepage-sections section,
.subpages-sections section {
    padding: 2.6rem 0;
    position: relative;
}

/* Soft arc separators between sections - never a straight line */
.onepage-sections section + section::before,
.subpages-sections section + section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, 70%);
    height: 16px;
    border-top: 2px solid var(--tc-edge-soft);
    border-radius: 55% 55% 0 0 / 16px 16px 0 0;
    pointer-events: none;
}

/* === SCROLL ANIMATIONS === */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.55s ease-out, transform 0.55s cubic-bezier(0.34, 1.3, 0.64, 1);
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* === FOOTER = THE GUELL BENCH (signature, appearance 2) === */
footer {
    margin-top: 4.5rem;
    background: var(--tc-bg-raised);
    color: var(--tc-ink);
    position: relative;
    padding-top: 30px;
}

/* The mosaic backrest of the bench */
footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 30px;
    background-image: var(--tc-mosaic);
    background-size: auto 100%;
    background-repeat: repeat-x;
    border-radius: 0 0 100% 100% / 0 0 16px 16px;
    pointer-events: none;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 2.2rem;
    padding: 2.2rem 0 1.6rem;
}

.footer-section {
    min-width: 0;
}

.footer-section h3 {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 600;
    font-size: 1.12rem;
    color: var(--tc-cobalt);
    margin-bottom: 0.85rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.footer-section h3::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    width: 56px;
    height: 9px;
    border-bottom: 2px solid var(--tc-ochre);
    border-radius: 0 0 55% 55% / 0 0 9px 9px;
}

.footer-section p {
    font-size: 0.94rem;
    margin-bottom: 0.4rem;
    color: var(--tc-ink-soft);
}

.footer-section a {
    color: var(--tc-ink);
}

.footer-section a:hover {
    color: var(--tc-terra);
}

.footer-menu {
    list-style: none;
}

.footer-menu li {
    margin-bottom: 0.4rem;
    font-size: 0.94rem;
}

.footer-menu a {
    text-decoration: none;
    color: var(--tc-ink-soft);
    transition: color var(--transition-fast), padding-left var(--transition-fast);
}

.footer-menu a:hover {
    color: var(--tc-cobalt);
    padding-left: 0.3rem;
}

.social-links {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.social-links a {
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    color: var(--tc-grout);
    background: var(--tc-cobalt);
    padding: 0.42rem 1rem;
    border-radius: 1.3rem 0.9rem 1.2rem 1rem / 0.9rem 1.3rem 1rem 1.2rem;
    transition: all var(--transition-fast);
}

[data-theme="dark"] .social-links a {
    color: #10172e;
}

.social-links a:nth-child(2) { background: var(--tc-teal); }
.social-links a:nth-child(3) { background: var(--tc-terra); }
.social-links a:nth-child(4) { background: var(--tc-glaze); }
.social-links a:nth-child(5) { background: var(--tc-ochre); color: #2c2418; }

.social-links a:hover {
    transform: translateY(-2px) rotate(-1.5deg);
    box-shadow: var(--tc-shadow);
}

.copyright {
    border-top: 1px solid var(--tc-edge-soft);
    padding: 1rem 0 1.3rem;
    font-size: 0.86rem;
    color: var(--tc-ink-soft);
}

.copyright p {
    margin: 0;
}

.copyright a {
    color: var(--tc-ink-soft);
    text-decoration: none;
}

.copyright a:hover {
    color: var(--tc-cobalt);
}

/* === ACCESSIBILITY === */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--tc-ochre);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .animate-on-scroll { opacity: 1; transform: none; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: 0 1.15rem;
    }

    .header-content {
        gap: 0.7rem;
    }

    nav {
        flex-shrink: 0;
    }

    /* v1.0.1: on narrow screens the button slims down to the mosaic chip -
       no more collisions with the site title */
    .hamburger-btn {
        padding: 0.55rem 0.75rem;
    }

    .hamburger-btn span:last-child {
        display: none;
    }

    .hamburger-btn span:first-child {
        width: 1.7em;
        height: 1.25em;
    }

    .logo-container img {
        height: 46px;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .dark-mode-toggle {
        bottom: 1.1rem;
        right: 1.1rem;
        width: 44px;
        height: 42px;
    }

    .hero {
        padding: 3.2rem 0 3.4rem;
    }

    .hero::after,
    footer::before {
        height: 22px;
    }

    footer {
        padding-top: 22px;
    }

    .dropdown-menu {
        /* Mobile fix (6.2.5): bind top AND bottom so the scroll area
           equals the visible screen - reaches the last item in landscape.
           Paired with the body-scroll lock in script.js. */
        position: fixed;
        top: 70px;
        bottom: 12px;
        left: 1rem;
        right: 1rem;
        margin-top: 0;
        max-height: none;
        padding-bottom: 0.4rem;
        min-width: 0;
    }

    .page-cards-grid,
    .gallery-grid,
    .testimonials-grid {
        grid-template-columns: 1fr;
    }

    /* On narrow screens the catenary flattens gracefully */
    .page-card {
        border-radius: 50% 50% 1.2rem 1.2rem / 2.6rem 2.6rem 1.2rem 1.2rem;
    }
}

/* === PRINT === */
@media print {
    body {
        background: #fff;
        color: #2c2418;
    }
    header,
    .dark-mode-toggle,
    .hamburger-menu,
    .hero::after,
    footer::before {
        display: none;
    }
    .page-card,
    .testimonial-card,
    .gallery-item {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}

/* === PLACEHOLDER COMPOSITIONS (v1.0.4) ===
   Loose ceramic shards waiting for the mason; on hover they turn in the
   hand, each its own way. */
.page-card-placeholder span { display: none; }

.page-card-placeholder {
    position: relative;
    overflow: hidden;
    background: var(--tc-bg-raised);
}

.page-card-placeholder::before,
.page-card-placeholder::after {
    content: '';
    position: absolute;
    animation: none;
    -webkit-mask-image: none;
    mask-image: none;
    border: none;
    border-radius: 0;
    box-shadow: none;
    filter: none;
    opacity: 1;
    width: auto;
    height: auto;
    inset: auto;
    transition: transform 0.6s cubic-bezier(0.34, 1.3, 0.64, 1);
}

/* Composition 1: teal pebble + ochre shard */
.page-card-placeholder::before {
    width: 38%;
    height: 46%;
    top: 22%;
    left: 16%;
    background: var(--tc-teal);
    border-radius: 58% 42% 55% 45% / 45% 52% 48% 55%;
    transform: rotate(-9deg);
    opacity: 0.85;
}

.page-card-placeholder::after {
    width: 24%;
    height: 30%;
    bottom: 18%;
    right: 18%;
    background: var(--tc-ochre);
    border-radius: 44% 56% 48% 52% / 56% 44% 58% 42%;
    transform: rotate(12deg);
    opacity: 0.85;
}

/* Composition 2: cobalt + terracotta swap corners */
.page-card:nth-child(2n) .page-card-placeholder::before {
    background: var(--tc-cobalt);
    top: auto;
    bottom: 18%;
    left: auto;
    right: 14%;
    border-radius: 52% 48% 60% 40% / 48% 58% 42% 52%;
    transform: rotate(7deg);
}

.page-card:nth-child(2n) .page-card-placeholder::after {
    background: var(--tc-terra);
    bottom: auto;
    top: 18%;
    right: auto;
    left: 16%;
    border-radius: 46% 54% 42% 58% / 54% 46% 52% 48%;
    transform: rotate(-14deg);
}

/* Composition 3: glaze-green pebble under a catenary arc */
.page-card:nth-child(3n) .page-card-placeholder::before {
    width: 42%;
    height: 44%;
    top: 30%;
    left: 30%;
    background: var(--tc-glaze);
    border-radius: 62% 38% 55% 45% / 48% 60% 40% 52%;
    transform: rotate(-4deg);
}

.page-card:nth-child(3n) .page-card-placeholder::after {
    width: 64%;
    height: 26px;
    top: 14%;
    left: 18%;
    right: auto;
    bottom: auto;
    background: transparent;
    border-bottom: 3px solid var(--tc-ochre);
    border-radius: 0 0 55% 55% / 0 0 26px 26px;
    transform: none;
    opacity: 0.9;
}

.page-card:hover .page-card-placeholder::before {
    transform: rotate(6deg) translateY(-4px);
}

.page-card:hover .page-card-placeholder::after {
    transform: rotate(-8deg) translateY(4px);
}

.page-card:nth-child(3n):hover .page-card-placeholder::after {
    transform: translateY(-5px);
}

@media (prefers-reduced-motion: reduce) {
    .page-card-placeholder::before,
    .page-card-placeholder::after {
        transition: none !important;
    }
}

/* === HERO BACKGROUND IMAGE (6.3.3) ===
   Trencadis warms the photo with a scheme-tinted mosaic tone. Content centered, four overlay levels. Overrides the engine's
   universal fallback (loaded earlier) by cascade order. No image set ->
   this block stays inert. */
.hero--has-bg {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    min-height: 55vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 5rem 1.5rem 4.6rem;
}

.hero--has-bg .hero-bg-media {
    position: absolute;
    inset: 0;
    z-index: -2;
    display: block;
}

.hero--has-bg .hero-bg-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hero--has-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 32%, transparent) 0%, rgba(30,15,5,0.54) 100%);
}

.hero--has-bg h1 {
    color: #fff;
    -webkit-text-fill-color: #fff;
    background: none;
    text-shadow: 0 2px 16px rgba(0,0,0,0.45);
    max-width: 22ch;
}

.hero--overlay-none::after   { background: color-mix(in srgb, var(--primary) 12%, rgba(30,15,5,0.08)); }
.hero--overlay-light::after  { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 24%, transparent) 0%, rgba(30,15,5,0.36) 100%); }
.hero--overlay-medium::after { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 32%, transparent) 0%, rgba(30,15,5,0.54) 100%); }
.hero--overlay-strong::after { background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 42%, transparent) 0%, rgba(30,15,5,0.7) 100%); }
