/* ==========================================================================
   leopold.casa, the one stylesheet. Eight pages, English and Spanish.
   Hand-written, no build step. Browsers keep this file for ten minutes: after every change raise
   the number in casa-leopold.css?v=2 on all eight pages, so that new pages never meet old styles.
   Fonts self-hosted, SIL OFL 1.1 (../fonts/OFL-*.txt).
   ========================================================================== */

/* 1. Fonts --------------------------------------------------------------- */
@font-face{font-family:'CL Spectral';font-weight:300;font-display:block;src:url('../fonts/spectral-300.woff2') format('woff2')}
@font-face{font-family:'CL Spectral';font-weight:400;font-style:italic;font-display:block;src:url('../fonts/spectral-400-italic.woff2') format('woff2')}
@font-face{font-family:'CL Spectral SC';font-weight:400;font-display:block;src:url('../fonts/spectral-sc-400.woff2') format('woff2')}
@font-face{font-family:'CL Hanken';font-weight:400;font-display:block;src:url('../fonts/hanken-grotesk-400.woff2') format('woff2')}
@font-face{font-family:'CL Hanken';font-weight:500;font-display:block;src:url('../fonts/hanken-grotesk-500.woff2') format('woff2')}

/* Stand-ins with the same width and height, should a web font not arrive: Georgia and Arial, measured on this site's text */
@font-face{font-family:'CL Spectral F';font-weight:300;src:local('Georgia');size-adjust:99.25%;ascent-override:106.70%;descent-override:46.65%;line-gap-override:0%}
@font-face{font-family:'CL Spectral F';font-weight:400;font-style:italic;src:local('Georgia Italic'),local('Georgia-Italic');size-adjust:90.54%;ascent-override:116.97%;descent-override:51.14%;line-gap-override:0%}
@font-face{font-family:'CL Spectral SC F';src:local('Georgia');size-adjust:133.41%;ascent-override:79.38%;descent-override:34.71%;line-gap-override:0%}
@font-face{font-family:'CL Hanken F';font-weight:400 500;src:local('Arial'),local('ArialMT');size-adjust:100.95%;ascent-override:99.06%;descent-override:30.02%;line-gap-override:0%}

/* 2. Tokens ---------------------------------------------------------------
   Ratios: WCAG contrast, computed (see the study's contrast table).
   Orange on the blue field is only 2.49:1, so there orange is only the ground of the
   sale tag, whose white lettering carries the contrast. */
:root{
  --ground:#FAF8F4;
  --text:#1A1D22;        /* on ground 15.93 */
  --blue:#1B3A5C;        /* on ground 10.96; white on it 11.63 */
  --orange:#C4500F;      /* lines on ground 4.40; white on it 4.67. Not for text on ground */
  --orange-down:#A8430B; /* pressed */
  --white:#FFFFFF;
  --hair:#C3CBD5;        /* decorative hairlines only */
  --night:#0B1422;       /* photo viewer */
  --serif:'CL Spectral','CL Spectral F',Georgia,'Times New Roman',serif;
  --sc:'CL Spectral SC','CL Spectral SC F',Georgia,'Times New Roman',serif;
  --sans:'CL Hanken','CL Hanken F','Helvetica Neue',Arial,sans-serif;
  --gut:18px;--bar:49px;--measure:620px;   /* the one width: header, menu, text, photos, videos, gallery */
 
  color-scheme:light}

/* 3. Base ---------------------------------------------------------------- */
*,*::before,*::after{box-sizing:border-box}
/* stable gutter: a short page without scrollbar sits exactly where the long ones do */
html{background:var(--ground);scrollbar-gutter:stable;font-synthesis:none;-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-padding-top:calc(var(--bar) + 12px)}
body{margin:0;background:var(--ground);color:var(--text);font:400 1rem/1.62 var(--sans);overflow-wrap:break-word}
img,video{display:block;max-width:100%;height:auto}
p{margin:0 0 18px}
i{font-family:var(--serif);font-size:1.04em}
b{font-weight:500}
a,a:visited{color:var(--blue)}   /* four pages: a visited colour would say nothing */
a{text-decoration:underline;text-decoration-color:var(--orange);text-decoration-thickness:1px;text-underline-offset:.22em}
@media (hover:hover){a:hover{text-decoration-thickness:3px}}
a:active{text-decoration-color:var(--blue)}
:focus-visible{outline:3px solid var(--blue);outline-offset:3px}

/* 4. Head: name, sale tag, menu ------------------------------------------ */
.mast{background:var(--blue);--name:clamp(1.8rem,9.2vw,2.3rem)}   /* size of the drawn name */
.mast>div{min-height:90px;padding:2px var(--gut) 0;max-width:calc(var(--measure) + 2*var(--gut));margin:0 auto;display:flex;flex-wrap:wrap;gap:10px 18px;align-items:center;justify-content:space-between}
/* the name is drawn: outlines of Poiret One (../fonts/OFL-PoiretOne.txt), so it waits for no font.
   Poiret One is very thin; the contour in its own colour adds .3px on each side */
.name{display:block;font-size:var(--name);line-height:0;color:var(--white)}
.name svg{display:block;width:5.886em;height:1.1em;overflow:visible}
.name path{fill:currentColor;stroke:currentColor;stroke-width:.6px;vector-effect:non-scaling-stroke}
.vh{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;font-size:1rem;line-height:1}
/* the tag stands on the baseline of the name. Both boxes are centred in the field; in the drawing the
   baseline lies .377em below its middle (927 of 1100 units), and the tag is 17px + one line high */
.sale{position:relative;top:calc(var(--name)*.377 - (.8125rem + 17px)/2);font:500 .8125rem/1 var(--sans);letter-spacing:.14em;text-transform:uppercase;background:var(--orange);color:var(--white);padding:9px 12px 8px}

.bar{min-height:49px;position:sticky;top:0;z-index:10;background:var(--ground);border-bottom:1px solid var(--hair)}
.bar ul{list-style:none;margin:0 auto;padding:0 var(--gut);max-width:calc(var(--measure) + 2*var(--gut));min-height:48px;display:flex;flex-wrap:wrap;align-items:center;column-gap:clamp(9px,3.6vw,20px)}
.bar li:nth-child(4){margin-left:auto}
.bar a{font:400 .875rem/1.2 var(--sc);letter-spacing:.06em;text-transform:lowercase;text-decoration:none;display:flex;align-items:center;min-height:48px;border:solid transparent;border-width:3px 0}
/* current item: a contour, not another weight, so the items never change width from page to page */
.bar a[aria-current]{border-bottom-color:var(--orange);-webkit-text-stroke:.35px currentColor}
.bar a:focus-visible{outline-offset:-3px}
@media (hover:hover){.bar a:not([aria-current]):hover{border-bottom-color:var(--blue)}}
.bar a:active{border-bottom-color:var(--orange)}
/* the language switch: the page's own language is plain text with a thin blue underline close to the
   letters (the current page has the thick orange bar at the edge of the menu); the other is a menu link */
.lang{display:flex;column-gap:10px}
.lang span{font:400 .875rem/1.2 var(--sc);letter-spacing:.06em;text-transform:lowercase;color:var(--blue);display:flex;align-items:center;min-height:48px;text-decoration:underline;text-decoration-color:var(--blue);text-decoration-thickness:1px;text-underline-offset:.3em}
.lang a{justify-content:flex-end;min-width:26px;padding:0 4px;margin:0 -4px}
/* phones: only the other language */
@media (max-width:655px){.lang span{display:none}}
/* Spanish has the longest menu: its gaps close below 390px so that EN stays in the row, and up to 339px,
   where it cannot, EN stands at the foot of the page. The type never shrinks for it */
.foot-lang{display:none}
@media (min-width:360px) and (max-width:389px){:lang(es) .bar ul{column-gap:8px}}
@media (max-width:339px){
  :lang(es) .bar .lang{display:none}
  .foot-lang{display:block;padding:0 var(--gut) 28px}
  .foot-lang a{display:inline-flex;align-items:center;min-width:44px;min-height:44px;font:400 .875rem/1.2 var(--sc);letter-spacing:.06em;text-transform:lowercase;text-underline-offset:.3em}
}

/* 5. Page: one column for text, photos and videos ------------------------ */
main{padding:6px var(--gut) 72px;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,var(--measure)) minmax(0,1fr)}
main>*{grid-column:2}
h1,h2{font:300 1.6875rem/1.2 var(--serif);color:var(--blue);letter-spacing:.005em;margin:44px 0 16px;padding-top:20px;border-top:1px solid var(--hair);position:relative}
h1::before,h2::before{content:'';position:absolute;left:0;top:-2px;width:56px;height:3px;background:var(--orange)}
main>h1:first-child{border-top:0;padding-top:0;margin-top:34px}
main>h1:first-child::before{display:none}
figure{margin:0}
.ph{margin:10px 0 28px}
.ph img{width:100%}
main>ul{margin:0 0 10px;padding:0;list-style:none}
main>ul li{padding:9px 0;border-bottom:1px solid var(--hair)}

/* 6. Details: site plan and area table ----------------------------------- */
#schematic{margin:6px 0 0}
#schematic>a{display:block}
#schematic img{width:100%;border:1px solid var(--hair)}
@media (hover:hover){#schematic>a:hover img{border-color:var(--blue)}}
#schematic figcaption,.areas-note{font-size:.875rem;line-height:1.55;margin:12px 0 0}
table.areas{width:100%;border-collapse:collapse;margin:26px 0 0;font-variant-numeric:tabular-nums lining-nums}
.areas th,.areas td{padding:10px 2px 10px 14px;text-align:right;font-weight:400;border-bottom:1px solid var(--hair)}
.areas th:first-child{text-align:left;padding-left:2px;padding-right:0}
.areas thead th{color:var(--blue);font-weight:500;border-bottom:2px solid var(--blue)}
.areas .total th,.areas .total td{font-weight:500;color:var(--blue);border-bottom:2px solid var(--blue)}

/* 7. Media: videos at text width like the photos, photographs, viewer ------ */
.video{margin:10px 0 30px}
.video video{width:100%;aspect-ratio:848/478;background:var(--night)}
.video video:focus-visible{outline-offset:-4px}
.video figcaption{margin:14px 0 0}
/* on a phone: two rows to swipe, in reading order top, bottom, next column */
.gallery{grid-column:1/-1;margin:6px calc(-1*var(--gut)) 0;display:grid;grid-template-rows:auto auto;grid-auto-flow:column;grid-auto-columns:min(62vw,270px);gap:8px;overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x proximity;scroll-padding-inline:var(--gut);padding:4px var(--gut) 14px;scrollbar-width:thin;scrollbar-color:var(--blue) var(--hair)}
.gallery a{scroll-snap-align:start;overflow:hidden;background:var(--hair);position:relative}
.gallery img{width:100%;aspect-ratio:4/3;object-fit:cover}
/* the light zoom of the earlier site: 1.05 in .3s, kept inside the box by overflow:hidden */
@media (prefers-reduced-motion:no-preference){
  .gallery img{transition:transform .3s ease}
  @media (hover:hover){.gallery a:hover img{transform:scale(1.05)}}
  .gallery a:focus-visible img,.gallery a:active img{transform:scale(1.05)}
}
/* the focus ring is an overlay, so the zoom cannot cut it */
.gallery a:focus-visible{outline:none}
@media (forced-colors:active){.gallery a:focus-visible{outline:4px solid;outline-offset:-4px}}
.lightbox{position:fixed;inset:0;z-index:200;display:flex;align-items:center;justify-content:center;background:var(--night);touch-action:pan-y pinch-zoom}
.lightbox[hidden]{display:none}
.lightbox-image{max-width:100vw;max-height:calc(100vh - 152px);max-height:calc(100dvh - 152px);width:auto}
.lightbox button{position:absolute;width:52px;height:52px;padding:0 0 4px;border:0;border-radius:0;background:var(--ground);color:var(--blue);font:400 30px/1 var(--sans);cursor:pointer}
@media (hover:hover){.lightbox button:hover{background:var(--orange);color:var(--white)}}
.lightbox button:active{background:var(--orange-down);color:var(--white)}
.lightbox button:focus-visible{outline:3px solid var(--white);outline-offset:3px}
.lightbox-close{top:12px;right:18px}
.lightbox .lightbox-prev{left:18px;bottom:14px}
.lightbox .lightbox-next{right:18px;bottom:14px}
.lightbox-counter{position:absolute;bottom:28px;left:50%;transform:translateX(-50%);color:var(--white);font-size:1rem;font-variant-numeric:tabular-nums}

/* 7b. The reel: a preview photo with a link that opens the reel in Instagram, shown like the other
   photos. With a mouse and the wide layout (section 10) the script turns it into Instagram's player;
   there the preview has the player's size from the start: 328px wide, the picture 4:5 of that plus
   208px of Instagram's own lines */
.reel{margin:10px 0 30px}
.reel .embed a{display:block;position:relative;overflow:hidden;background:var(--hair);color:var(--white);font:400 1rem/1.3 var(--sans);text-decoration:none}
.reel .embed img{width:100%}
.reel iframe{display:block;width:328px;max-width:100%;height:618px;margin:0 auto;border:0;background:var(--hair)}
.reel .play{position:absolute;left:0;right:0;bottom:24px;margin:0 auto;width:fit-content;min-width:200px;padding:13px 22px 12px;background:var(--blue);text-align:center}
.reel .play>span{display:flex;align-items:center;justify-content:center;gap:12px;font-weight:500;font-size:1.125rem}
.reel .play>span::before{content:'';border:solid transparent;border-width:8px 0 8px 13px;border-left-color:currentColor}
.reel .play small{display:block;font-size:.8125rem;margin-top:3px}
@media (hover:hover){.reel .embed a:hover .play{background:var(--orange)}}
.reel .embed a:active .play{background:var(--orange-down)}
.reel figcaption{margin-top:18px}
.reel figcaption p{margin:0 0 12px}

/* 8. Contact: one block, replaceable as a whole -------------------------- */
.contact-block .call,.contact-block .call:visited{display:inline-flex;align-items:center;min-height:54px;padding:12px 26px;background:var(--orange);color:var(--white);font:500 1.25rem/1.2 var(--sans);letter-spacing:.02em;text-decoration:none}
@media (hover:hover){.contact-block .call:hover{background:var(--blue)}}
.contact-block .call:active{background:var(--orange-down)}
.contact-block .mail{font:300 1.375rem/1.3 var(--serif);min-height:45px}
.contact-block .mail a{display:inline-block;padding:8px 0}
.contact-block .mail noscript{font-family:var(--sans);font-size:1rem;font-weight:400}
.contact-block address{font-style:normal;line-height:1.75;margin-top:40px;padding-top:24px;border-top:1px solid var(--hair)}

/* 8b. Frames: a hairline and a very soft shadow inside the edge, drawn over photos, videos and
   thumbnails. The overlay never takes a click; on a video it fades out above the player's controls. */
.ph,.video{position:relative}
.ph::after,.video::after,.reel .embed a::after,.gallery a::after{content:'';position:absolute;inset:0;pointer-events:none;box-shadow:inset 0 0 0 1px rgba(11,20,34,.28),inset 0 0 12px rgba(11,20,34,.14)}
.video::after{bottom:auto;aspect-ratio:848/478;-webkit-mask-image:linear-gradient(#000 calc(100% - 110px),transparent calc(100% - 70px));mask-image:linear-gradient(#000 calc(100% - 110px),transparent calc(100% - 70px))}
.gallery a::after{box-shadow:inset 0 0 0 1px rgba(11,20,34,.28),inset 0 0 8px rgba(11,20,34,.14)}
.gallery a:focus-visible::after{border:4px solid var(--blue);box-shadow:inset 0 0 0 2px var(--white)}

/* 9. Phone: photos run to the screen edges ------------------------------- */
@media (max-width:359px){.mast>div{min-height:80px}.mast{--name:1.7rem}.sale{padding-block:4px 3px;top:calc(var(--name)*.377 - (.8125rem + 7px)/2)}.bar ul{column-gap:8px}.bar a{letter-spacing:.015em}}
@media (max-width:655px){.ph{grid-column:1/-1;margin-inline:calc(-1*var(--gut))}
  .video{grid-column:1/-1;margin-inline:calc(-1*var(--gut))}
  .video figcaption{padding-inline:var(--gut)}
  .reel .embed{margin-inline:calc(-1*var(--gut))}
  .reel .embed a:focus-visible{outline-offset:-4px}
  /* at the screen edges: only top and bottom */
  .ph::after,.video::after,.reel .embed a::after{box-shadow:inset 0 1px 0 rgba(11,20,34,.28),inset 0 -1px 0 rgba(11,20,34,.28),inset 0 12px 10px -10px rgba(11,20,34,.16),inset 0 -12px 10px -10px rgba(11,20,34,.16)}}

/* 10. Wider screens ------------------------------------------------------ */
/* 656px = the 620px column plus both gutters: photos leave the screen edges exactly
   where they have the column's width, so nothing jumps */
@media (min-width:656px){
  :root{--bar:57px}
  .mast>div{min-height:108px;padding-block:2px 0}
  .mast{--name:3rem}
  .name path{stroke-width:.75px}
  .bar ul{column-gap:36px}
  .bar a,.lang span{font-size:1rem;letter-spacing:.1em;min-height:56px}
  main{padding-bottom:110px}
  p,main>ul,address{font-size:1.0625rem;line-height:1.68}
  h1,h2{font-size:2.125rem;margin:64px 0 22px;padding-top:26px}
  main>h1:first-child{margin-top:38px}
  .ph{margin:18px 0 38px}
  .video{margin:18px 0 44px}
  .video figcaption{margin-top:18px;font-size:1.0625rem;line-height:1.68}
  .reel{margin:18px 0 44px}
  .gallery{grid-auto-flow:row;grid-template:none;grid-column:2;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px;margin-inline:0;padding:4px 0;overflow:visible}
}
/* a mouse as well: the reel's player beside its text */
@media (min-width:656px) and (hover:hover) and (pointer:fine){
  .reel{display:grid;grid-template-columns:328px minmax(0,1fr);column-gap:32px;align-items:start}
  .reel .embed a{height:618px}
  .reel .embed img{height:100%;object-fit:cover}
  .reel .play{bottom:32px}
  .reel figcaption{margin-top:0}
}
@media (min-width:900px){
  .lightbox-image{max-width:calc(100vw - 180px);max-height:calc(100vh - 110px)}
  .lightbox .lightbox-prev,.lightbox .lightbox-next{bottom:auto;top:calc(50% - 26px)}
  .lightbox-close{top:18px}
  .lightbox-counter{bottom:16px}
}

/* 11. Print -------------------------------------------------------------- */
@media print{
  @page{margin:16mm}
  html,body{background:#fff}
  .bar,.foot-lang,.lightbox,.reel .embed,.video video,.ph::after,.video::after,.gallery a::after{display:none}
  .mast{background:none;border-bottom:2pt solid var(--blue)}
  .mast>div{min-height:0;padding:0 0 8pt}
  .name{color:var(--blue)}
  .sale{top:0;background:none;color:var(--text);border:1pt solid var(--text)}
  main{display:block;padding:0}
  .ph{max-width:120mm;margin:8pt 0 12pt}
  .gallery{display:grid;grid:auto/repeat(4,1fr);grid-auto-flow:row;gap:3mm;margin:0;padding:0;overflow:visible;max-width:none}
  .contact-block .call,.contact-block .call:visited{background:none;color:var(--text);padding:0;min-height:0}
  h1,h2{break-after:avoid;margin-top:16pt}
  .ph,.gallery a,tr,#schematic{break-inside:avoid}
}
@media (forced-colors:active){.sale,.contact-block .call{border:1px solid}.bar a[aria-current]{border-bottom-color:Highlight}}
