/* The Map Studio: one style file for the whole site. Colours from the old site and the logo. */

/* Web fonts (free OFL licences; files and licence texts in assets/fonts) */
@font-face { font-family: Lato; src: url(fonts/Lato-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Lato; src: url(fonts/Lato-400-italic.woff2) format('woff2'); font-style: italic; font-display: swap; }
@font-face { font-family: Lato; src: url(fonts/Lato-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: Lato; src: url(fonts/Lato-700-italic.woff2) format('woff2'); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url(fonts/NunitoSans-300-italic.woff2) format('woff2'); font-weight: 300; font-style: italic; font-display: swap; }

:root {
  --yellow: #ffd700;   /* header and title panel: same as the logo */
  --cream: #fffacd;    /* page background */
  --sky: #00a1de;
  --navy: #1565a8;
  --ice: #d6f1f8;
  --ink: #1e1c00;
  --muted: #5a5546;
  --line: #e2dcae;
  --green: #2b690e;    /* footer, as on the old site */
  --font: Lato, Arial, sans-serif;
}

/* Page basics. The header is fixed (not sticky), so shrinking it never changes the page length (no flicker on short pages);
   --hh = full header height: room at the top, always dark yellow. The footer sits at the bottom on short pages. */
* { box-sizing: border-box; }
html { scroll-padding-top: 100px; }   /* links to #sections are not hidden under the header */
body { --hh: calc(135px * 1604 / 1317 + 16px); display: flex; flex-direction: column; min-height: 100vh; margin: 0; padding-top: var(--hh);
       background: linear-gradient(var(--yellow), var(--yellow)) top / 100% var(--hh) no-repeat var(--cream);
       color: var(--ink); font: 17px/1.6 var(--font); text-align: center; }
main { flex: 1; }
h1, h2 { text-transform: uppercase; letter-spacing: .02em; margin: 0 0 .5em; }
h2 { font-size: 1.8rem; }
h2::after { content: ""; display: block; width: 50px; height: 2px; margin: .4em auto 0; background: var(--yellow); }
a { color: var(--navy); }
img { max-width: 100%; height: auto; }

/* Header: logo + menu; slims down after the first scroll */
.top { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 24px; background: var(--yellow); transition: padding .3s; }
.logo { display: block; width: 135px; transition: width .3s; }
.scrolled .top { padding-block: 4px; }
.scrolled .logo { width: 60px; }
nav a { margin-left: 22px; color: var(--ink); text-decoration: none; text-transform: uppercase; font-size: 1.1rem; letter-spacing: .06em; }
nav a:hover { text-decoration: underline; }

/* Footer: green with yellow text, same height as the slim header */
footer { display: flex; flex-direction: column; justify-content: center; min-height: calc(60px * 1604 / 1317 + 8px); padding: 4px 16px; background: var(--green); color: var(--yellow); font-size: .9rem; }
footer nav a { margin: 0 12px; color: var(--yellow); font-size: .9rem; }
footer p { margin: .2em 0 0; }

/* Title panel below the header: title starts under the S of 'Studio' (26.35% across the logo), fades in after a short delay */
.hero { margin-top: -1px; padding: 40px 24px 40px calc(24px + 135px * .2635); background: var(--yellow); text-align: left; }
.hero.small { padding-block: 28px; }
.hero h1 { margin: 0; font-size: clamp(1.5rem, 4.5vw, 2.5rem); line-height: 1.1; }
.hero p { margin: 2px 0 0 .45em; font: italic 300 1.15rem 'Nunito Sans', var(--font); }   /* keeps the two-storey 'a' (user's choice); indent = half a W */
.hero h1, .hero p { opacity: 0; animation: fade 1.2s ease-out .4s forwards; }
.hero p { animation-delay: .9s; }
@keyframes fade { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- Home page ---------- */
.banner { display: block; width: 100%; max-height: 60vh; object-fit: cover; border-block: 1px solid #000; }

/* Map Catalogue: badge + text on the left (scaling with the screen), dictionary menu on the right */
.catalogue { padding: 32px 6vw 40px; text-align: left; }
.catalogue h2 { display: inline-block; margin-left: .42em; font-weight: 400; }   /* indent = half an M */
.catalogue h2::after { display: none; }
.cols { display: grid; grid-template-columns: 34vw minmax(0, 1fr); gap: 32px 7vw; margin-top: 32px; }
.badge { display: block; width: 100%; }
.badge-block { display: flex; flex-direction: column; align-items: center; }   /* text and note stay centred under the badge */
.intro, .note { width: 92%; }   /* never as wide as the badge */
.intro { margin: 32px 0 16px; font-size: 1rem; text-align: justify; }
.note { margin: 0; padding: 10px 16px; font-size: .9rem; text-align: justify; background: var(--ice); }
/* Hamburger icon (4 yellow bars) opens the dictionary panel; no script needed */
.dict-menu { margin-top: 16px; }
.dict-menu summary { float: left; padding: 4px; cursor: pointer; list-style: none; }
.dict-menu summary::-webkit-details-marker { display: none; }
.dict-menu summary span { display: block; width: 58px; height: 31px; background: repeating-linear-gradient(var(--yellow) 0 4px, transparent 4px 9px); transition: transform .2s; }
.dict-menu summary:hover span { transform: scale(1.1); }
.dict { max-width: 440px; margin: 0 0 0 86px; padding: 12px 20px; font-size: .85rem; border-left: 3px solid var(--yellow); background: #fff; }
.dict dt { font-weight: 700; }
.dict dt span { font-weight: 400; font-style: italic; color: var(--muted); }
.dict dd { margin: 0 0 6px 12px; }

/* Separator: one line centred under the badge, one centred above the map, at the same height */
.sep { display: flex; justify-content: space-between; padding: 0 6vw; }
.sep span { height: 2px; background: linear-gradient(var(--yellow), var(--yellow)) center / 200px 2px no-repeat; }
.sep span:first-child { width: 34vw; }
.sep span:last-child { width: min(703px, 50vw); }

/* Areas covered: area buttons left of the map, aligned right */
.areas-band { display: flex; justify-content: flex-end; align-items: center; gap: 48px; padding: 32px 6vw 40px; }
.areas-band h2::after { display: none; }
.map-col { flex: 0 0 min(703px, 50vw); }
.areas { display: flex; flex-direction: column; gap: 12px; }
.areas a { padding: 10px 18px; background: var(--cream); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); text-decoration: none; }
.areas a:hover { background: var(--yellow); }
.areas b { display: block; text-transform: uppercase; }

/* Maps with invisible links (Scotland map: traced red areas; index maps: one box per sheet, touching), red on hover.
   focus-visible = keyboard only, so a clicked area doesn't stay red after Back */
.hotmap { position: relative; max-width: 703px; margin: 0 auto; }
.hotmap img { display: block; }
.hotmap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.hotmap polygon, .hotmap rect { fill: transparent; pointer-events: all; transition: fill .2s, transform .2s; }
.hotmap polygon { transform-box: fill-box; transform-origin: center; }
.hotmap a:hover polygon, .hotmap a:focus-visible polygon { fill: rgba(230, 0, 0, .6); transform: scale(1.08); }
.hotmap a:hover rect, .hotmap a:focus-visible rect { fill: rgba(230, 0, 0, .45); }

/* Blue EXAMPLES panel, as on the old site */
.examples { padding: 24px 16px; background: var(--sky); color: #fff; }
.examples h2 { margin: 0; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: 1px; }
.examples h2::after { display: none; }

/* Example map: opens its viewer; grows slightly with a shadow on hover */
.gallery { padding: 40px 6vw 36px; }   /* 60 px from the map to the Gallery line */
.gallery a { display: block; width: min(100%, 1100px); margin: 0 auto; }
.gallery img { display: block; width: 100%; transition: transform .3s, box-shadow .3s; }
.gallery a:hover img { transform: scale(1.03); box-shadow: 0 10px 30px rgba(0, 0, 0, .55); }

/* Gallery film strip: centre sheet full size and colour; neighbours 77%, faded; bottom aligned so sheets grow upward */
.gallery-show { padding: 24px 0; }
.gallery-show h2::after { display: none; }
.gallery-show h2::before, .index-area + .index-area h2::before { content: ""; display: block; width: 200px; height: 2px; margin: 0 auto .4em; background: var(--yellow); }   /* line above the title */
.show { --h: min(600px, 55vw); position: relative; overflow: hidden; padding: 70px 0 20px; }   /* room above for the 10% hover growth */
.strip { display: flex; align-items: flex-end; gap: 8px; width: max-content; height: calc(var(--h) + 3em); }   /* fixed height: the page below never jumps */
.slide { flex: none; width: calc(var(--h) * var(--r) * .77); color: var(--ink); text-decoration: none; opacity: .3; transition: width 1.6s ease-in-out, opacity 1.6s ease-in-out; }
.slide.on { position: relative; z-index: 1; width: calc(var(--h) * var(--r)); opacity: 1; transition: width .8s ease-in-out .8s, opacity 1.6s ease-in-out; }   /* grows only in the last half of its move */
.slide img { display: block; width: 100%; height: auto; transform-origin: bottom; transition: transform .6s, box-shadow .6s; }
.slide.on:hover img { transform: scale(1.1); box-shadow: 0 10px 30px rgba(0, 0, 0, .55); }
.slide span { display: block; margin-top: 8px; text-transform: uppercase; }
.show button { position: absolute; z-index: 2; top: 45%; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 30px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .4); }
.show button:hover { transform: translateY(-50%) scale(1.1); }
.show .prev { left: 16px; }
.show .next { right: 16px; }

/* Map viewer panel: 75% of the screen, centred, dark shadow over a dimmed page */
#viewer { width: 75vw; height: 75vh; padding: 0; border: 0; border-radius: 8px; overflow: visible; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .8); }
#viewer::backdrop { background: rgba(0, 0, 0, .6); }
#viewer iframe { display: block; width: 100%; height: 100%; border: 0; border-radius: 8px; }
#viewer .close { position: absolute; top: -16px; right: -16px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--yellow); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
#viewer .close:hover { transform: scale(1.1); }
#viewer .close:focus { outline: none; }   /* no blue focus ring when the panel opens */

/* ---------- Sheet Index: 1/3 small Scotland map (stays in view, top level with the Highlands map) + 2/3 area index maps ---------- */
.index-cols { display: grid; grid-template-columns: 1fr 2fr; }
.index-nav { padding: 0 32px; }   /* background always visible beside the map */
.index-nav .hotmap { position: sticky; top: 170px; max-width: 350px; margin: 122px auto 32px; }
.index-list { padding: 32px 16px; }
.index-area { margin-bottom: 36px; }
.index-area h2 { margin-bottom: 0; }
.index-area h2::after { display: none; }
.index-area p { margin-top: 0; }   /* sheet count close under the area name */
.index-map { margin: 16px auto; }   /* width set per map by the build tool */

/* ---------- Area pages: blue title bar and sheet cards ---------- */
.areabar { padding: 28px 24px 28px calc(24px + 135px * .2635); background: var(--navy); color: #fff; text-align: left; }
.areabar h1 { margin: 0; }
.areabar p { margin: 4px 0 0; font-style: italic; }
.sheets { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; max-width: 1200px; margin: 0 auto; padding: 32px 16px; }
.sheet { padding: 16px; background: #fff; border-radius: 8px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.sheet h2 { font-size: 1.3rem; }
.sheet img { display: block; border: 1px solid var(--line); }
.price { font-weight: 700; font-size: 1.3rem; margin: 10px 0; }
.btn { display: inline-block; margin: 4px; padding: 9px 20px; border-radius: 5px; background: var(--navy); color: #fff; text-decoration: none; font-weight: 700; }
.btn.buy { background: var(--yellow); color: var(--ink); }
.btn.off { opacity: .5; cursor: default; }   /* no PayPal link yet */
.small-print { font-size: .85rem; color: var(--muted); }

/* ---------- Contact page: the email address is put together by JavaScript (not readable in the page code for spam robots) ---------- */
.band { padding: 40px 16px; max-width: 900px; margin: 0 auto; }
.mail { display: flex; align-items: center; justify-content: center; max-width: 600px; aspect-ratio: 3 / 1; margin: 0 auto; padding: 0 16px; box-sizing: border-box;
        background: #ffe866; font-size: clamp(1.15rem, 5vw, 1.75rem); line-height: 1.3; }
.mail a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.mail a:hover, .mail a:focus { text-decoration: underline; }

/* ---------- Links page ---------- */
.links ul { list-style: none; max-width: 640px; margin: 0 auto; padding: 0; text-align: left; }
.links li { margin-bottom: 16px; padding: 14px 18px; background: #fff; border-left: 3px solid var(--yellow); }
.links a { font-weight: 700; }
.links span { display: block; color: var(--muted); font-size: .95rem; }

/* ---------- 404 page: own drawing of a broken compass ---------- */
.lost { display: block; width: 200px; margin: 0 auto 16px; }

/* ---------- Thank-you page (PayPal sends buyers here after payment) ---------- */
.thanks ol { display: inline-block; margin: 0 auto 16px; text-align: left; }
.thanks h3 { margin: 24px 0 8px; }

/* ---------- Tablets and phones: columns stack ---------- */
@media (max-width: 900px) {
  .cols { grid-template-columns: minmax(0, 1fr); }
  .badge-block { width: 60vw; }
  .sep { justify-content: center; }
  .sep span:first-child { display: none; }
  .sep span:last-child { width: 100%; }
  .areas-band { flex-direction: column-reverse; align-items: center; }
  .map-col { flex: none; width: 100%; }
  .areas { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .index-cols { grid-template-columns: 1fr; }
  .index-nav .hotmap { position: relative; top: 0; max-width: 300px; margin-bottom: 0; }
}
@media (max-width: 600px) {
  body { --hh: calc(68px * 1604 / 1317 + 12px); }
  .top { align-items: flex-start; padding: 6px 16px; }
  .logo { width: 68px; }   /* the fixed header must not fill a phone screen */
  .scrolled .logo { width: 45px; }
  .top nav { white-space: nowrap; }
  .top nav a { margin-left: 10px; font-size: .75rem; letter-spacing: .03em; }
  footer { min-height: calc(45px * 1604 / 1317 + 8px); line-height: 1.3; font-size: .7rem; }
  footer nav a { font-size: .7rem; }
  .hero { padding: 24px 16px 24px calc(16px + 68px * .2635); }
  .areabar { padding-left: calc(16px + 68px * .2635); }
  .badge-block { width: 100%; }
  .dict { margin-left: 74px; }
  #viewer { width: 94vw; height: 85vh; }
  #viewer .close { top: -12px; right: -6px; }
}
