/* ============================================================================
   Kaks Õde — kaksode.ee
   ----------------------------------------------------------------------------
   The house has one architectural gesture in every room: a dado rail where
   painted vertical panelling meets patterned wallpaper. That rail is this
   page's structural spine. Sections meet at a rail the way walls do, and the
   surface colours walk you through the house — cream wall, grey panelling,
   the dark attic, then out to the café's red barn boards.

   Palette is sampled from the logo and the photographs, nothing invented.
   ========================================================================= */

/* --- 1. Faces ------------------------------------------------------------ */
/* Fraunces and Jost, both SIL Open Font License 1.1, self-hosted so the site
   makes no third-party requests (keeps it clean under GDPR, and it's faster). */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
  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: 'Fraunces';
  src: url('../fonts/fraunces-latin-ext.woff2') format('woff2');
  font-weight: 300 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Jost';
  src: url('../fonts/jost-latin.woff2') format('woff2');
  font-weight: 300 500;
  font-style: normal;
  font-display: swap;
  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: 'Jost';
  src: url('../fonts/jost-latin-ext.woff2') format('woff2');
  font-weight: 300 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* --- 2. Tokens ----------------------------------------------------------- */

:root {
  /* Sampled: logo disc #837c76, logo wordmark #e0c1a4, logo ground #fdf8f5,
     ceiling beam #2e2e2c, attic panelling, café boards, pine floor. */
  --cream: #faf6f1;
  --linen: #efe8de;
  --paper: #e4ddd2;
  --panel: #c6c3bd;
  --taupe: #837c76;
  --taupe-deep: #5d5751;
  --blush: #e0c1a4;
  --blush-pale: #f0dcc7;
  --ink: #2e2e2c;
  --slate: #3f4750;
  --oxblood: #7a3239;
  --pine: #795136;

  --rail-h: clamp(2.25rem, 4.5vw, 3.5rem);
  --gutter: clamp(1.25rem, 5vw, 5.5rem);
  --measure: 34rem;
  --wrap: 82rem;

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --slow: 0.95s;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Jost', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
}

/* --- 3. Base ------------------------------------------------------------- */

*,
*::before,
*::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  /* the sticky rail-height header shouldn't cover anchored headings */
  scroll-padding-top: 5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.1rem);
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--blush);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--ink);
  color: var(--cream);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- 4. Type primitives -------------------------------------------------- */

.eyebrow {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.68rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--accent, var(--taupe));
  margin: 0 0 1.5rem;
}

.h1, .h2, .h3 {
  font-family: var(--font-display);
  font-variation-settings: 'SOFT' 40, 'WONK' 0;
  font-weight: 300;
  margin: 0;
  text-wrap: balance;
}

.h1 {
  font-size: clamp(3.75rem, 12vw, 9.5rem);
  font-variation-settings: 'opsz' 144, 'SOFT' 45, 'WONK' 0;
  line-height: 0.85;
  letter-spacing: -0.035em;
}

.h2 {
  font-size: clamp(2.4rem, 5.4vw, 4.5rem);
  font-variation-settings: 'opsz' 96, 'SOFT' 45, 'WONK' 0;
  line-height: 1;
  letter-spacing: -0.025em;
}

.h3 {
  font-size: clamp(1.35rem, 2.1vw, 1.7rem);
  font-variation-settings: 'opsz' 32, 'SOFT' 40, 'WONK' 0;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.lead {
  font-size: clamp(1.15rem, 0.98rem + 0.85vw, 1.55rem);
  font-weight: 300;
  line-height: 1.6;
  max-width: 30ch;
}

.prose { max-width: var(--measure); }
.prose p { margin: 0 0 1.35em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 500; }

.muted { color: var(--muted-ink, var(--taupe-deep)); }

/* --- 5. Bands, wrap, rail ------------------------------------------------ */
/* One padding owner: .wrap. Bands never set their own padding, so nothing
   fights over specificity when a band and a component both want spacing. */

.band {
  position: relative;
  background: var(--surface);
  color: var(--on-surface);
}

.band--cream {
  --surface: var(--cream);
  --on-surface: var(--ink);
  --muted-ink: var(--taupe-deep);
  --accent: var(--taupe);
  --rail-panel: var(--paper);
  --rail-line: rgba(46, 46, 44, 0.1);
  --hair: rgba(46, 46, 44, 0.14);
}

.band--linen {
  --surface: var(--linen);
  --on-surface: var(--ink);
  --muted-ink: var(--taupe-deep);
  --accent: var(--taupe);
  --rail-panel: #e2d9cc;
  --rail-line: rgba(46, 46, 44, 0.1);
  --hair: rgba(46, 46, 44, 0.14);
}

.band--panel {
  --surface: var(--panel);
  --on-surface: var(--ink);
  --muted-ink: #4a4742;
  --accent: var(--taupe-deep);
  --rail-panel: #b7b4ae;
  --rail-line: rgba(46, 46, 44, 0.12);
  --hair: rgba(46, 46, 44, 0.18);
}

.band--slate {
  --surface: var(--slate);
  --on-surface: #e9e6e1;
  --muted-ink: #b3b6b8;
  --accent: var(--blush);
  --rail-panel: #353c44;
  --rail-line: rgba(0, 0, 0, 0.34);
  --hair: rgba(233, 230, 225, 0.2);
}

.band--oxblood {
  --surface: var(--oxblood);
  --on-surface: #f6e9e3;
  --muted-ink: #dcb8b1;
  --accent: var(--blush);
  --rail-panel: #6a2b31;
  --rail-line: rgba(0, 0, 0, 0.3);
  --hair: rgba(246, 233, 227, 0.22);
}

.wrap {
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
  padding-block: clamp(5rem, 11vw, 9.5rem);
}

.wrap--tight { padding-block: clamp(3.5rem, 7vw, 6rem); }
.wrap--flush { padding-block: 0; }

/* The rail: painted vertical panelling under a moulding cap. Closes a band. */
.rail {
  height: var(--rail-h);
  background: var(--rail-panel);
  position: relative;
  overflow: hidden;
}

.rail::before {            /* moulding cap, catching light on top */
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 4px;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--rail-panel) 74%, white) 0 2px,
      var(--rail-line) 2px 3px,
      transparent 3px
    );
  z-index: 1;
}

.rail::after {             /* the tongue-and-groove boards */
  content: '';
  position: absolute;
  inset: 4px 0 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 calc(var(--groove, 16px) - 1px),
    var(--rail-line) calc(var(--groove, 16px) - 1px) var(--groove, 16px)
  );
  transform-origin: left center;
  transform: scaleX(var(--rail-draw, 1));
  transition: transform 1.4s var(--ease);
}

/* --- 6. Header ----------------------------------------------------------- */

.head {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem var(--gutter);
  color: var(--ink);
  transition: background var(--slow) var(--ease), box-shadow var(--slow) var(--ease);
}

/* Over the hero the nav sits half on cream, half on a photograph. A cream veil
   that fades out downwards is invisible on the cream side and lifts the links
   off the photo on the other, whatever photo ends up there. */
.head::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(250, 246, 241, 0.92) 0%,
    rgba(250, 246, 241, 0.66) 55%,
    rgba(250, 246, 241, 0) 100%
  );
  transition: opacity 0.6s var(--ease);
}

.head.is-stuck::before { opacity: 0; }

.head.is-stuck {
  background: color-mix(in srgb, var(--cream) 88%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: 0 1px 0 rgba(46, 46, 44, 0.12);
}

.head__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  margin-right: auto;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  pointer-events: none;
}
.head.is-stuck .head__brand { opacity: 1; transform: none; pointer-events: auto; }

.head__mark { width: 2rem; height: 2rem; border-radius: 50%; flex: none; }

.head__name {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 24, 'SOFT' 45;
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

/* Phone widths can't carry the wordmark and four links at once, and the links
   are what people came for. The mark alone still gets you home. */
@media (max-width: 46rem) {
  .head__name { display: none; }
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.85rem, 2.2vw, 2.25rem);
  min-width: 0;
}

.nav a {
  font-size: clamp(0.66rem, 0.6rem + 0.2vw, 0.72rem);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 400;
  text-decoration: none;
  padding-block: 0.35rem;
  position: relative;
  white-space: nowrap;
}

@media (min-width: 46rem) { .nav a { letter-spacing: 0.2em; } }

.nav a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.55s var(--ease);
}
.nav a:hover::after,
.nav a:focus-visible::after { transform: scaleX(1); transform-origin: left center; }

.nav__hide { display: none; }
@media (min-width: 46rem) { .nav__hide { display: inline-block; } }

.lang {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: clamp(0.64rem, 0.6rem + 0.15vw, 0.7rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  border-left: 1px solid rgba(46, 46, 44, 0.22);
  padding-left: clamp(0.6rem, 2vw, 1.5rem);
  margin-left: 0.1rem;
}
.lang a { text-decoration: none; opacity: 0.5; transition: opacity 0.4s var(--ease); }
.lang a:hover { opacity: 1; }
.lang [aria-current='true'] { opacity: 1; font-weight: 500; }

/* At 320px the pair won't fit beside the links. Naming the language you are
   already reading is the half that can go. */
@media (max-width: 22.5rem) {
  .lang [aria-current='true'] { display: none; }
  .lang { border-left: 0; padding-left: 0; }
  .head { padding-inline: 1rem; }
  .nav { gap: 0.7rem; }
}

/* --- 7. Hero ------------------------------------------------------------- */

.hero {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
}

@media (min-width: 60rem) {
  .hero { grid-template-columns: 1.02fr 0.98fr; }
}

.hero__type {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 7rem var(--gutter) 3.5rem;
  order: 2;
}
@media (min-width: 60rem) {
  .hero__type { order: 1; padding-block: 8rem 5rem; }
}

.hero__title {
  margin-block: 0.35em 0;
  /* õ carries a tilde; a touch more room above keeps it off the eyebrow */
  padding-top: 0.06em;
}

.hero__lead { margin: 2.25rem 0 0; }

.hero__cue {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
  font-size: 0.68rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--taupe-deep);
  text-decoration: none;
}

.hero__cue span {
  display: block;
  width: 3.5rem;
  height: 1px;
  background: currentColor;
  transform-origin: left center;
  animation: cue 3.4s var(--ease) infinite;
}

@keyframes cue {
  0%, 100% { transform: scaleX(0.35); opacity: 0.45; }
  50%      { transform: scaleX(1);    opacity: 1; }
}

.hero__photo {
  order: 1;
  min-height: 58svh;
  position: relative;
}
@media (min-width: 60rem) { .hero__photo { order: 2; min-height: 0; } }

/* --- 8. Photo frames ----------------------------------------------------- */

.frame {
  position: relative;
  overflow: hidden;
  background-color: var(--paper);
  background-size: cover;
  background-position: center;
}

.frame__img {
  position: absolute;
  inset: -7% 0;
  width: 100%;
  height: 114%;
  object-fit: cover;
  transform: translate3d(0, var(--py, 0px), 0);
  opacity: 0;
  transition: opacity 1.1s var(--ease);
}
.frame__img.is-loaded { opacity: 1; }

.frame--portrait { aspect-ratio: 3 / 4; }
.frame--tall     { aspect-ratio: 2 / 3; }
.frame--square   { aspect-ratio: 1 / 1; }
.frame--wide     { aspect-ratio: 4 / 3; }
.frame--fill     { position: absolute; inset: 0; }

figure { margin: 0; }

.caption {
  margin-top: 0.85rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted-ink);
}

/* --- 9. Split: sticky text beside a scrolling stack of photos ------------ */

.split { display: grid; gap: clamp(2.5rem, 5vw, 4rem); }

@media (min-width: 62rem) {
  .split {
    grid-template-columns: minmax(0, 27rem) minmax(0, 1fr);
    gap: clamp(3rem, 6vw, 6rem);
    align-items: start;
  }
  .split__aside { position: sticky; top: 6.5rem; }
}

.stack {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(0.75rem, 2vw, 1.5rem);
}

/* A gently uneven rhythm — the photos sit like pictures hung by eye, not by
   ruler. Second column drops so the two columns never line up. */
@media (min-width: 40rem) {
  .stack__off { margin-top: clamp(2rem, 7vw, 5.5rem); }
}

.stack__wide { grid-column: 1 / -1; }

/* --- 10. Detail list ----------------------------------------------------- */

.details {
  margin: 2.5rem 0 0;
  border-top: 1px solid var(--hair);
}

.details div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--hair);
  align-items: baseline;
}

.details dt {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-ink);
}

.details dd { margin: 0; font-size: 0.98rem; }

@media (max-width: 30rem) {
  .details div { grid-template-columns: 1fr; gap: 0.15rem; }
}

/* --- 11. Café ------------------------------------------------------------ */

.board {
  margin: 2.5rem 0 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 2.5rem;
}

@media (max-width: 42rem) { .board { columns: 1; } }

.board li {
  break-inside: avoid;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--hair);
  font-size: 0.98rem;
}

.board li:first-child { padding-top: 0; }

/* --- 12. Island: ring cross + facts -------------------------------------- */
/* Vormsi's ring crosses (rattaristid) — over 330 of them in Hullo cemetery,
   the largest surviving collection anywhere. Used once, as this section's
   mark, because it belongs to this island and nowhere else. */

/* Drawn once, large, in the empty half of the band. This is the only section
   with no photograph, and the island's own emblem is a better answer to that
   space than a stock landscape would be. */
.islemark {
  position: absolute;
  right: clamp(1rem, 5vw, 6rem);
  top: 50%;
  width: min(34vw, 26rem);
  height: auto;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.2;
  pointer-events: none;
  transform: translate3d(0, calc(-50% + var(--py, 0px)), 0);
}

@media (max-width: 64rem) { .islemark { display: none; } }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: clamp(1.5rem, 3.5vw, 2.75rem);
  margin-top: clamp(3rem, 6vw, 4.5rem);
  padding-top: clamp(2rem, 4vw, 3rem);
  border-top: 1px solid var(--hair);
}

.facts dt {
  font-family: var(--font-display);
  font-variation-settings: 'opsz' 48, 'SOFT' 45;
  font-weight: 300;
  font-size: clamp(2rem, 3.6vw, 2.9rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.facts dd {
  margin: 0.7rem 0 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--muted-ink);
  max-width: 22ch;
}

/* --- 13. Buttons --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.05rem 2rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid currentColor;
  border-radius: 999px;
  color: var(--on-surface);
  background: transparent;
  transition: background 0.5s var(--ease), color 0.5s var(--ease),
              border-color 0.5s var(--ease);
}

.btn:hover,
.btn:focus-visible {
  background: var(--on-surface);
  color: var(--surface);
}

.btn--solid {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}
.btn--solid:hover,
.btn--solid:focus-visible {
  background: var(--taupe-deep);
  border-color: var(--taupe-deep);
  color: var(--cream);
}

.btn svg { width: 0.9rem; height: 0.9rem; flex: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.75rem;
}

/* --- 14. Booking note ---------------------------------------------------- */

.note {
  margin-top: 2rem;
  padding-left: 1.15rem;
  border-left: 2px solid var(--accent);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--muted-ink);
  max-width: 32rem;
}

/* --- 15. Unfilled facts -------------------------------------------------- */
/* Everything still waiting on a real value is marked .todo so it is obvious
   on the page, not just in the source. When TODO.md is empty, this rule and
   every .todo class can be deleted. */

.todo {
  font-style: italic;
  opacity: 0.65;
  border-bottom: 1px dotted currentColor;
}

/* --- 16. Footer ---------------------------------------------------------- */

.foot {
  display: grid;
  gap: 2.5rem;
  align-items: start;
}

@media (min-width: 48rem) {
  .foot { grid-template-columns: auto 1fr auto; gap: 4rem; }
}

.foot__mark { width: 5rem; height: 5rem; border-radius: 50%; }

.foot a { text-decoration-color: var(--hair); text-underline-offset: 4px; }
.foot a:hover { text-decoration-color: currentColor; }

.foot__fine {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted-ink);
  line-height: 1.9;
}

/* --- 17. Motion ---------------------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translate3d(0, var(--reveal-y, 18px), 0);
  transition:
    opacity var(--slow) var(--ease) var(--reveal-delay, 0ms),
    transform var(--slow) var(--ease) var(--reveal-delay, 0ms);
}

.reveal.is-in { opacity: 1; transform: none; }

/* Before JS runs, .js on <html> holds elements hidden; without JS they show. */
html:not(.js) .reveal { opacity: 1; transform: none; }
html:not(.js) .frame__img { opacity: 1; }
html:not(.js) .head__brand { opacity: 1; transform: none; pointer-events: auto; }

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

/* --- 18. Print ----------------------------------------------------------- */

@media print {
  .head, .hero__cue, .rail { display: none; }
  .band { background: #fff; color: #000; }
  .wrap { padding-block: 1.5rem; }
  .reveal { opacity: 1; transform: none; }
}
