/* Casa Almargens. Layout mirrors the original Squarespace 7.1 Fluid Engine grid:
   26 desktop columns (gutter + 24 cells + gutter), 10 mobile columns, 11px gaps. */

:root {
  --cream: #f7f6ee;
  --white: #fff;
  --sage: #bfbeac;
  --ink: #000;
  /* Original link #7a7964 and button #bfbeac failed WCAG AA contrast; darkened in the same hue. */
  --link: #6b6a56;
  --btn: #6b6a56;
  --bg: var(--cream);
  --gutter: 6vw;
  --hdr: 130px; /* announcement bar + header */
  --maxw: 1400px;
  --r: 0.9375rem; /* 15px at the default browser text size */
  --font-head: "Bodoni Moda", "Bodoni 72", Didot, "Times New Roman", serif;
  --font-body: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --font-btn: "Libre Caslon Text", "Big Caslon", Georgia, serif;
}
@media (min-width: 768px) {
  :root { --gutter: 3vw; --hdr: 179px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.8;
  --v: 1.2;
  /* Cormorant is set looser than the original Freight Display; tighten to match its line lengths. */
  letter-spacing: -0.015em;
  word-spacing: -0.04em;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}

/* Fluid type scale, same formula as the original theme. --v is the theme's size value. */
body, h1, h2, h3, h4, .text-small, .text-large, .site-title, .site-nav a, .btn, .btn-solid,
.announce-text, .li-title, .li-desc {
  font-size: min(calc((var(--v) - 1) * 1.2vw + var(--r)),
                 max(calc((var(--v) - 1) * 16.8px + var(--r)), calc(var(--v) * var(--r))));
}
@media (max-width: 767px) and (orientation: portrait) {
  body, h1, h2, h3, h4, .text-small, .text-large, .site-title, .site-nav a, .btn, .btn-solid,
  .announce-text, .li-title, .li-desc {
    font-size: calc((var(--v) - 1) * 0.012 * min(100vh, 900px) + var(--r));
  }
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 400;
  text-transform: lowercase;
  letter-spacing: -0.02em;
  word-spacing: normal;
  line-height: calc(1.3 * (1 + (1 - var(--v)) / 25));
  margin: calc(2 * var(--r)) 0;
  overflow-wrap: break-word;
}
h1 { --v: 4; }
h2 { --v: 2.8; }
h3 { --v: 2.2; }
h4 { --v: 1.6; }
p { margin: var(--r) 0; white-space: pre-wrap; overflow-wrap: break-word; }
p.pe:empty::before { content: "\200b"; } /* paragraphs the original kept as blank lines */
.text-small { --v: 1; }
.text-large { --v: 1.5; }
.ta-center { text-align: center; }
.ta-right { text-align: right; }
ul, ol { margin: var(--r) 0; padding-left: 1.5em; }

a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a span[style] { color: inherit !important; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 100; padding: 8px 14px;
  background: var(--ink); color: var(--white); text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ------------------------------------------------------------ announcement bar */
.announce {
  position: relative; z-index: 60; background: var(--sage); text-align: center;
  padding: 12px 48px; --v: 1;
}
.announce-text {
  display: inline-block; margin: 0; color: var(--ink); /* original: white text, 1.9:1 contrast */
  line-height: 1.8; text-decoration: none;
}
a.announce-text:hover { text-decoration: underline; }
.announce-close {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  display: flex; align-items: center; justify-content: center; width: 32px; height: 32px;
  padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer;
}
.announce-closed .announce { display: none; }

/* ------------------------------------------------------------ header */
.site-header {
  position: relative; z-index: 60; display: flex; align-items: center; justify-content: space-between;
  gap: 2vw; padding: var(--gutter);
}
.site-title {
  --v: 2; font-family: var(--font-head); font-weight: 400; line-height: 1.3; color: var(--ink);
  text-decoration: none; text-transform: lowercase; white-space: nowrap; letter-spacing: -0.02em; word-spacing: normal;
}
.site-nav ul { display: flex; flex-wrap: wrap; justify-content: flex-end; list-style: none; margin: 0; padding: 0; }
.site-nav li { margin: 0 0.65vw; }
.site-nav li:last-child { margin-right: 0; }
.site-nav a {
  --v: 1.3; display: block; padding: 0.1em 0; color: var(--ink); line-height: 1.8;
  text-decoration: none; white-space: nowrap;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em;
}
.burger {
  display: none; position: relative; width: 44px; height: 44px; margin-right: -8px;
  padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer;
}
.burger-lines, .burger-lines::before {
  position: absolute; left: 8px; right: 8px; height: 1px; background: currentColor;
  transition: transform 0.2s ease, top 0.2s ease;
}
.burger-lines { top: 18px; }
.burger-lines::before { content: ""; left: 0; right: 0; top: 7px; }
.menu-open .burger-lines { top: 22px; transform: rotate(45deg); }
.menu-open .burger-lines::before { top: 0; transform: rotate(-90deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: var(--cream); overflow-y: auto; padding: 160px 6vw 48px;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu ul { list-style: none; margin: 0; padding: 0; text-align: center; }
.mobile-menu a {
  display: block; padding: 0.15em 0; font-size: 8.5vmin; line-height: 1.6; color: var(--ink); text-decoration: none;
}
.mobile-menu a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
.menu-open, .menu-open body { overflow: hidden; }

@media (max-width: 767px) {
  .site-nav { display: none; }
  .burger { display: block; }
}

/* ------------------------------------------------------------ sections */
.sec { position: relative; background: var(--bg); color: var(--ink); }
.theme-black, .theme-black-bold { --bg: var(--white); }
.theme-bright { --bg: var(--sage); --link: #2e2d24; --btn: #2e2d24; }
.sec-fluid { display: flex; flex-direction: column; justify-content: center; }
.h-custom { padding: calc(var(--custom, 0) * 0.1vw) 0; }
.h-small { min-height: 33vh; padding: 3.3vmax 0; }
.h-medium { min-height: 66vh; padding: 6.6vmax 0; }
.h-large { min-height: 100vh; padding: 10vmax 0; }

.sec-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.w-inset .sec-bg { inset: var(--gutter); }
/* The original header overlays the first section; its height counts toward that section's min-height. */
main > section:first-of-type.w-inset .sec-bg { top: 0; }
main > section:first-of-type.h-large { min-height: calc(100vh - var(--hdr)); }
main > section:first-of-type.h-medium { min-height: calc(66vh - var(--hdr)); }
.sec-bg .fill { position: absolute; inset: 0; }
.sec-bg-overlay { position: absolute; inset: 0; background: var(--bg); }

/* Fluid Engine grid */
.fe {
  --gg: calc(var(--gutter) - 11px);
  --cmw: calc((var(--maxw) - 77px) / 8);
  position: relative; z-index: 1; display: grid; width: 100%;
  grid-template-rows: repeat(var(--rows-m), minmax(24px, auto));
  grid-template-columns: minmax(var(--gg), 1fr) repeat(8, minmax(0, var(--cmw))) minmax(var(--gg), 1fr);
  gap: 11px;
  overflow-x: hidden; overflow-x: clip;
}
@media (min-width: 768px) {
  .fe {
    --cmw: calc((var(--maxw) - 253px) / 24);
    --inset: 0px;
    --cw: min(var(--maxw), calc(100vw - 2 * var(--gutter) - var(--inset)));
    grid-template-rows: repeat(var(--rows-d), minmax(calc(var(--cw) * 0.0215), auto));
    grid-template-columns: minmax(var(--gg), 1fr) repeat(24, minmax(0, var(--cmw))) minmax(var(--gg), 1fr);
  }
  .w-inset .fe { --inset: calc(2 * var(--gutter)); }
}
.fe-block { position: relative; min-width: 0; }
.blk { display: flex; flex-direction: column; width: 100%; height: 100%; }
.blk-html > .txt > :first-child { margin-top: 0; }
.blk-html > .txt > :last-child { margin-bottom: 0; }

.blk-img { position: relative; }
.blk-img > .fill, .blk-img > .img-link { position: absolute; inset: 0; display: block; }
.img-link .fill { position: absolute; inset: 0; display: block; }
.fill img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* Buttons */
.blk-btn.align-left { align-items: flex-start; }
.blk-btn.align-center { align-items: center; }
.blk-btn.align-right { align-items: flex-end; }
.btn {
  --v: 0.75;
  display: inline-flex; align-items: center; justify-content: center; max-width: 100%;
  padding: 2.5em 3.1em; border: 2px solid var(--btn); border-radius: 0; background: transparent;
  color: var(--btn); font-family: var(--font-btn); font-weight: 400; line-height: 1.2;
  letter-spacing: 0.2em; word-spacing: normal; text-transform: uppercase; text-align: center; text-decoration: none;
  transition: background-color 0.1s linear, color 0.1s linear;
}
.btn:hover, .btn:focus-visible { background: var(--btn); color: var(--bg); }
.blk-btn.stretched { align-items: stretch; }
.blk-btn.stretched .btn { flex: 1; height: 100%; padding-top: 0; padding-bottom: 0; }
.btn-solid {
  --v: 1.2; display: inline-block; padding: 1.2em 2em; background: var(--sage); color: var(--ink);
  font-family: var(--font-body); line-height: 1.2; text-decoration: none;
}
.btn-solid:hover, .btn-solid:focus-visible { opacity: 0.85; }

/* Social links */
.social { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.social a { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin-left: -6px; color: var(--ink); }
.social li + li a { margin-left: 0; }
.social svg { width: 22px; height: 22px; }

/* ------------------------------------------------------------ galleries */
/* Gallery sections use the 3vw site gutter at every width (the 6vw mobile gutter is Fluid Engine only). */
.sec-gallery-grid, .sec-gallery-masonry { min-height: 0; padding: 6vw; }
@media (min-width: 768px) { .sec-gallery-grid, .sec-gallery-masonry { padding: 3vw; } }
.gal-inset .gal-grid, .gal-inset .mas, .gal-inset .mas-grid { max-width: var(--maxw); margin: 0 auto; }
.gal-grid {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: calc(var(--gap-v) * 0.05vw); list-style: none; margin: 0; padding: 0;
}
.gal-item { position: relative; aspect-ratio: var(--ar); overflow: hidden; }
.gal-item .fill { position: absolute; inset: 0; }
.mas {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); align-items: start;
  column-gap: calc(var(--gap-v) * 0.05vw);
}
.mas-col { display: flex; flex-direction: column; gap: calc(var(--gap-v) * 0.05vw); list-style: none; margin: 0; padding: 0; }
.mas-col img { display: block; width: 100%; height: auto; }
/* Masonry gaps measured on the original: 3px at 390px wide, 46px at 1440px. */
.mas, .mas-col, .mas-grid { --mas-gap: max(0px, calc(2.4vw - 6px)); }
.mas { column-gap: var(--mas-gap); }
.mas-col { gap: var(--mas-gap); }
.mas-grid {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); align-items: start;
  gap: var(--mas-gap); list-style: none; margin: 0; padding: 0;
}
.mas-grid > li { grid-column: var(--mc); grid-row: var(--mr); }
.mas-grid img { display: block; width: 100%; height: auto; }
@media (min-width: 768px) {
  .mas, .mas-col, .mas-grid { --mas-gap: calc(3.125vw + 1px); }
  .mas-grid > li { grid-column: var(--dc); grid-row: var(--dr); }
}

/* ------------------------------------------------------------ quotes list */
.sec-list { padding: 6.6vmax 3vw; }
.li-grid {
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 60px;
  max-width: var(--maxw); margin: 0 auto; padding: 0; list-style: none;
}
.li-item { width: 75%; margin: 0 auto; }
.li-title { --v: 1.7; margin: 0 0 0.6em; line-height: 1.3; }
.li-desc { --v: 1; }
.li-desc p { margin: 0; }
@media (max-width: 767px) {
  .li-grid { grid-template-columns: 1fr; row-gap: 100px; }
}

/* ------------------------------------------------------------ cart and 404 */
.sec-cart { padding: 3vw var(--gutter) 10vw; }
.cart-inner { max-width: var(--maxw); }
.cart-title { --v: 1.6; margin: 0 0 0.6em; }

/* ------------------------------------------------------------ footer */
.site-footer { background: var(--cream); }

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