/* Shared by every page: theme tokens, page frame, theme toggle, slogan + menu header, footer.
   Page-specific styles live in each page (home: inline in index.html, gallery: wonky-bastard/gallery.css). */

/* Fonts, served from this site (no request to Google). Latin letters only, which covers English and
   Estonian (õ ä ö ü), typographic quotes and dashes. Both fonts: SIL Open Font License, see /fonts/OFL-*.txt.
   Every page preloads these two files, so text appears in them right away. */
@font-face {
  font-family: Marcellus;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/marcellus-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/jetbrains-mono-500-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --ink: #151A22;
  --bone: #EFE9DD;
}
[data-theme="light"] {
  color-scheme: light;
  --bg: var(--bone);
  --fg: var(--ink);
  --accent: #9A4F28;
  --line: #D9D3C7;
  --muted: #4A505B;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--ink);
  --fg: var(--bone);
  --accent: #D08A5C;
  --line: #3A4250;
  --muted: #A9AFB9;
}

* { box-sizing: border-box; }

/* always reserve room for the scrollbar, so a page that scrolls and one that doesn't have the same width
   and the header doesn't shift sideways when you move between them */
html { scrollbar-gutter: stable; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr auto;
  place-items: center;
  background: var(--bg);
  color: var(--fg);
  font-family: Marcellus, 'Times New Roman', serif;
}

a:focus-visible,
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* accessibility helpers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 12px 16px;
  background: var(--fg);
  color: var(--bg);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* header (the same on every page): glyph + slogan; the menu and theme buttons are fixed to the corners */
.top { justify-self: stretch; }

/* the slogan row, just below the glyph */
.band {
  display: flex;
  justify-content: center;
  padding: 0 76px 14px;
}
/* slogan: fixed line, muted colour keeps it secondary to the logo while the size keeps it easy to read */
.slogan {
  --track: .2em;
  margin: 0;
  padding-left: var(--track); /* balances the trailing letter-spacing so the text is optically centred */
  font-size: 32px;
  line-height: 1.25;
  letter-spacing: var(--track);
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}
/* if it ever has to wrap, break between the two halves, never inside one */
.slogan span { white-space: nowrap; }

/* every page: the brand glyph is a link to the homepage. It sits in the row the corner buttons are in
   (so the three line up), with the slogan just below it. The top of the page is identical on every page,
   so nothing at the top moves when you navigate. */
.mark {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mark-link {
  display: grid;
  place-items: center;
  width: 56px; /* the glyph is 48px; the clickable area is a little larger */
  height: 56px;
  color: var(--fg);
}
.mark-link:hover { color: var(--accent); }
.mark-glyph {
  width: 48px;
  height: 48px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 20;
}

/* menu: a three-line button in the top-left corner (mirrors the theme toggle) opens a small list of links.
   Add a page by adding one <li> to the <nav> on every page. */
.menu-btn .icon-close,
.menu-btn[aria-expanded="true"] .icon-open { display: none; }
.menu-btn[aria-expanded="true"] .icon-close { display: block; }

.menu {
  position: fixed;
  top: 72px;
  left: 20px;
  z-index: 30;
  min-width: min(260px, calc(100vw - 40px));
  padding: 8px 0;
  background: var(--bg);
  border: 1px solid var(--line);
}
.menu[hidden] { display: none; }
.menu ul { margin: 0; padding: 0; list-style: none; }
.menu a {
  display: flex;
  align-items: center;
  min-height: 48px; /* comfortable touch target */
  padding: 0 20px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
}
.menu a:hover { color: var(--accent); }
.menu a:focus-visible { outline-offset: -3px; }
.menu a[aria-current="page"] {
  color: var(--fg);
  box-shadow: inset 2px 0 0 var(--accent); /* a thin accent bar marks the current page */
}

/* no JavaScript: no button, the links stay visible as a plain row under the slogan */
.no-js .top { display: flex; flex-direction: column; }
.no-js .menu-btn { display: none; }
.no-js .menu {
  order: 2;
  position: static;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
}
.no-js .menu ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 20px; padding: 0 24px; }
.no-js .menu a { min-height: 44px; padding: 0 8px; }
.no-js .menu a[aria-current="page"] {
  box-shadow: none;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* corner buttons: menu on the left, theme toggle on the right */
.theme-toggle,
.menu-btn {
  position: fixed;
  top: 20px;
  z-index: 20;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}
.theme-toggle { right: 20px; }
.menu-btn { left: 20px; }
.theme-toggle:hover,
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle svg,
.menu-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon { display: none; }

/* contact footer */
footer {
  justify-self: stretch;
  margin: 0 48px;
  padding: 28px 0 40px;
  border-top: 1px solid var(--line);
}
footer dl { margin: 0; }
/* contacts first: phone numbers (side by side) and email; registry details underneath, small and quiet */
footer .contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 24px 48px;
}
footer .numbers { display: flex; flex-wrap: wrap; gap: 0 36px; }
footer .legal {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  color: var(--muted);
}
footer .legal div { display: flex; align-items: center; gap: 10px; }
footer .legal dt { margin: 0; font-size: 10px; }
footer .legal dd { font-size: 14px; letter-spacing: .06em; }
footer dt {
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--muted);
}
footer dd {
  margin: 0;
  font-size: 19px;
  letter-spacing: .04em;
  overflow-wrap: break-word;
}
footer a {
  display: inline-block;
  padding-block: 10px;
  margin-block: -10px;
  color: inherit;
  text-decoration: none;
}
footer a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 720px) {
  .band { padding: 0 16px 12px; }
  /* scales with the screen; if it has to wrap it breaks between "VIDA" and "AIRCOOLED" */
  .slogan { --track: .18em; font-size: clamp(17px, 5.6vw, 26px); }
}
@media (max-width: 760px) {
  footer { margin: 0 24px; padding-bottom: 32px; }
}
@media (max-width: 600px) {
  footer .contact,
  footer .legal,
  footer .numbers { justify-content: center; text-align: center; }
  /* a little tighter, so both phone numbers still fit on one line on a phone */
  footer .numbers { gap: 0 20px; font-size: 17px; }
}
