/* Aisake Family – site styles */

:root {
  --ink: #111;
  --muted: #5a5f5d;
  --paper: #fff;
  --mint: #e9f5f1;
  --mint-deep: #cde8de;
  --green: #1a9e46;
  --wrap: 980px;
  --font: "Overlock", "Trebuchet MS", "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, h4 { font-weight: 400; line-height: 1.2; margin: 0 0 .5em; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

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

.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.wrap-wide { width: min(100% - 32px, 1040px); margin-inline: auto; }

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

.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 100;
  background: #000; color: #fff; padding: 8px 14px; text-decoration: none;
}
.skip-link:focus { top: 8px; }

/* ---------- Header & footer ---------- */

.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px 32px;
  padding-block: 36px 44px;
}
.wordmark {
  font-size: 2.4rem; line-height: 1.1;
  text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px;
}
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 22px; }
.site-nav a { font-size: .92rem; text-decoration: none; padding-block: 4px; border-bottom: 1px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="page"] { border-bottom-color: currentColor; }

@media (max-width: 560px) {
  .site-header .wrap { flex-direction: column; padding-block: 24px 28px; }
  .wordmark { font-size: 1.9rem; }
  .site-nav ul { justify-content: center; gap: 4px 14px; }
  .site-nav a { font-size: 1rem; }
}

.site-footer { background: #000; color: #fff; margin-top: 32px; }
.site-footer p {
  margin: 0; padding-block: 10px;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-weight: 300; font-size: .875rem;
}

/* ---------- Shared content ---------- */

.section { padding-block: 56px 40px; }
.display { font-size: clamp(2rem, 4.5vw, 2.5rem); margin-bottom: .25em; }
.lead { font-size: 1.25rem; margin-bottom: 1.3em; }
.prose > p, .prose > h4 { max-width: 820px; }
.prose h3 { font-size: 1.2rem; font-weight: 700; margin: 0 0 .9em; }
.prose h4 { font-size: 1rem; font-weight: 700; margin: 1.6em 0 .15em; }

.button {
  display: inline-block; background: #000; color: #fff; text-decoration: none;
  padding: 12px 22px; border: 0; font: inherit;
}
.button:hover { background: #2b2b2b; }

/* ---------- Home ---------- */

.hero {
  position: relative; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  min-height: clamp(460px, 58vw, 640px);
  color: #fff; background: #23402f;
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, .36); }
.hero-content { position: relative; z-index: 1; max-width: 790px; padding: 48px 20px; text-shadow: 0 1px 14px rgba(0, 0, 0, .35); }
.hero h1 { font-size: clamp(3rem, 8vw, 4.6rem); letter-spacing: .02em; margin-bottom: .1em; }
.hero-sub { font-size: clamp(1.15rem, 2.6vw, 1.4rem); margin-bottom: 1.3em; }
.hero-content p:last-child { font-size: 1.1rem; line-height: 1.6; margin: 0; }

/* ---------- Contact band ---------- */

.contact-band { background: #000; color: #fff; padding-block: 64px 76px; scroll-margin-top: 16px; }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px 56px; }
.contact-band h2 { font-size: clamp(2rem, 4.5vw, 2.5rem); margin-bottom: .75em; }
.contact-details address { font-style: normal; font-size: .95rem; line-height: 1.85; }
.contact-details a { text-decoration: none; }
.contact-details a:hover { text-decoration: underline; }
.form-note { font-size: .9rem; color: rgba(255, 255, 255, .78); margin-top: 1.6em; }

.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; align-content: start; }
.contact-form .full { grid-column: 1 / -1; }
.contact-form input,
.contact-form textarea {
  width: 100%; font: inherit; font-size: .95rem; color: #fff;
  background: transparent; border: 0; border-bottom: 1px solid #fff; border-radius: 0;
  padding: 12px 12px 10px;
}
.contact-form textarea { min-height: 124px; resize: vertical; margin-top: 10px; }
.contact-form ::placeholder { color: rgba(255, 255, 255, .88); opacity: 1; }
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-bottom-color: var(--mint-deep); background: rgba(255, 255, 255, .07); }
.contact-form button {
  grid-column: 1 / -1; margin-top: 30px; height: 50px;
  font: inherit; font-size: 1.15rem; color: #000; background: #fff; border: 0; cursor: pointer;
}
.contact-form button:hover { background: var(--mint); }
.contact-form button[disabled] { opacity: .7; cursor: progress; }
.form-status { grid-column: 1 / -1; min-height: 1.65em; margin: 10px 0 0; }
.form-status.is-error { color: #ffb3a6; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 760px) {
  .contact-grid, .contact-form { grid-template-columns: 1fr; }
}

/* ---------- About ---------- */

.collage img { width: 100%; }
.about { padding-top: 40px; }
.signoff { margin-top: 1.6em; }

/* ---------- Swimming Teacher ---------- */

.swim { --serif: "Playfair Display", Georgia, serif; font-family: "Caudex", Georgia, serif; }
.swim h1, .swim h2 { font-family: var(--serif); }
.swim h2 { font-size: clamp(2rem, 3.8vw, 3rem); font-weight: 700; text-align: center; margin-bottom: .45em; }

.swim-title { text-align: center; padding-bottom: 28px; }
.swim-title h1 { font-size: clamp(2.2rem, 4.4vw, 3.5rem); margin: 0; }
.swim-title h1 span { display: block; margin-top: .35em; font-size: 1.15em; font-weight: 700; line-height: 1.1; }

.swim-grid { max-width: 1440px; margin-inline: auto; border-top: 1px solid #000; }
.swim-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #000; }
.swim-cell + .swim-cell { border-left: 1px solid #000; }
@media (min-width: 1441px) { .swim-grid { border-inline: 1px solid #000; } }

.swim-text { padding: 48px clamp(20px, 4.5vw, 64px) 56px; }
.swim-text p { font-size: 1.25rem; line-height: 1.55; margin-bottom: 1.55em; }
.swim-text p:last-child { margin-bottom: 0; }
.swim .swim-tagline { font-weight: 700; text-align: center; margin-bottom: 2.4em; }

.swim-cover { padding-block: 36px; }
.swim-cover img { width: 100%; height: 100%; object-fit: cover; object-position: 56% center; }
.swim-photo { display: grid; place-items: center; padding: 8px clamp(16px, 3vw, 40px); }

.quals { list-style: none; margin: 1.6em 0 0; padding: 0; font-family: var(--serif); font-size: clamp(1.2rem, 2vw, 1.5625rem); line-height: 1.25; }
.quals li + li { margin-top: 1.25em; }
.quals strong, .quals small { display: block; }
.quals small { font-size: .68em; font-weight: 700; line-height: 1.5; }

.swim-row + .swim-row .swim-text { display: grid; align-content: center; }
.enquiries { width: min(100%, 490px); margin-inline: auto; }
.enquiries h2 { margin-bottom: .9em; }
.swim .enquiries p { font-family: var(--serif); font-size: clamp(1.4rem, 2.6vw, 2rem); line-height: 1.4; margin-bottom: 1.4em; }
.enquiries a { overflow-wrap: anywhere; }
.enquiries .tel { text-decoration: none; }

@media (max-width: 760px) {
  .swim-row { grid-template-columns: 1fr; }
  .swim-cell + .swim-cell { border-left: 0; border-top: 1px solid #000; }
  .swim-cover { padding: 0; }
  .swim-cover img { aspect-ratio: 4 / 3.4; }
  .swim-photo { padding-block: 20px; }
  .swim-text { padding-block: 36px 44px; }
  .swim-text p { font-size: 1.125rem; }
}

/* ---------- Contact page ---------- */

.tree-callout { text-align: center; padding-block: 8px 56px; }
.tree-callout p { font-size: 1.15rem; margin-bottom: .8em; }

/* ---------- Photo grids & lightbox ---------- */

.photo-grid {
  list-style: none; margin: 0 0 28px; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 5px;
}
.photo-grid a { display: block; aspect-ratio: 1; overflow: hidden; background: #d9e6e1; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.photo-grid a:hover img { transform: scale(1.05); }

.lightbox { width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; margin: 0; padding: 0; border: 0; background: transparent; }
.lightbox::backdrop { background: rgba(0, 0, 0, .9); }
.lightbox figure { margin: 0; height: 100%; display: grid; place-items: center; padding: 60px 72px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; }
.lightbox button {
  position: fixed; width: 48px; height: 48px; border: 0; border-radius: 50%;
  font-size: 28px; line-height: 1; color: #fff; background: rgba(255, 255, 255, .14); cursor: pointer;
}
.lightbox button:hover { background: rgba(255, 255, 255, .28); }
.lb-close { top: 12px; right: 12px; }
.lb-prev { left: 12px; top: calc(50% - 24px); }
.lb-next { right: 12px; top: calc(50% - 24px); }
.lb-count { position: fixed; left: 0; right: 0; bottom: 16px; text-align: center; color: #ccc; font-size: .9rem; }
@media (max-width: 600px) {
  .lightbox figure { padding: 64px 8px; }
  .lb-prev, .lb-next { top: auto; bottom: 8px; }
}

/* ---------- Tree page ---------- */

.tree-intro { padding-bottom: 40px; text-align: center; scroll-margin-top: 80px; }
.portraits { grid-template-columns: repeat(auto-fill, minmax(80px, 96px)); margin-bottom: 30px; }
.tree-intro h1 { font-size: 1.7rem; font-weight: 700; margin-bottom: 18px; }
.tree-intro h1 span { font-weight: 400; }
.tree-caption { margin: 26px auto 0; }

.tree-overview { margin-inline: auto; }
.tree-overview > noscript img { margin-inline: auto; }
.ov-couple { display: flex; justify-content: center; align-items: center; }
.ov-person {
  width: 230px; padding: 12px 14px; font: inherit; line-height: 1.3; text-align: center;
  color: inherit; background: #fff; border: 2.5px solid #000; cursor: pointer;
}
.ov-person:hover { background: var(--mint); }
.ov-person small { display: block; color: var(--muted); font-size: .82rem; }
.ov-bond { flex: none; width: 24px; height: 9px; border-block: 2.5px solid #000; }
.ov-stem { width: 2.5px; height: 24px; margin-inline: auto; background: #000; }
/* Rows of children: --cols is set by tree.js, --count per row. */
.ov-children { --cols: 8; --gap: 8px; --row-gap: 16px; --stub: 18px; display: grid; row-gap: var(--row-gap); }
.ov-row {
  --count: var(--cols);
  --cell: calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));
  position: relative; display: flex; justify-content: center; gap: var(--gap); padding-top: var(--stub);
}
/* Bar joining the children in this row */
.ov-row::before {
  content: ""; position: absolute; top: 0; height: 2.5px; background: #000;
  left: calc((var(--cols) - var(--count)) * (var(--cell) + var(--gap)) / 2 + var(--cell) / 2 - 1.25px);
  width: calc((var(--count) - 1) * (var(--cell) + var(--gap)) + 2.5px);
}
/* Line from this row's bar down to the next row's bar */
.ov-row:not(:last-child)::after {
  content: ""; position: absolute; left: calc(50% - 1.25px); top: 0; bottom: calc(-1 * var(--row-gap));
  width: 2.5px; background: #000;
}
.ov-item { position: relative; flex: 0 0 var(--cell); }
.ov-item::before {
  content: ""; position: absolute; left: calc(50% - 1px); top: calc(-1 * var(--stub));
  width: 2px; height: var(--stub); background: #000;
}
.ov-child {
  display: flex; flex-direction: column; align-items: center; height: 100%;
  padding: 6px 4px 9px; line-height: 1.25; text-align: center; text-decoration: none;
  background: #fff; border: 1.5px solid #000;
}
.ov-child:hover { background: var(--mint); }
.ov-num { color: var(--green); font-weight: 700; font-size: .8rem; }
.ov-child strong { font-size: .98rem; }
.ov-middle, .ov-dates { font-size: .76rem; color: var(--muted); }

@media (max-width: 460px) {
  .ov-person { width: auto; flex: 1; }
}

.tree-tools {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, .96); border-block: 1px solid #e2e6e4;
}
.tree-tools .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding-block: 10px; }
.tree-search { position: relative; flex: 1 1 260px; max-width: 420px; }
.tree-search input {
  width: 100%; font: inherit; padding: 8px 14px 8px 38px;
  border: 1.5px solid #000; border-radius: 999px; background: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23111' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5.5'/%3E%3Cpath d='m11 11 4 4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 14px center;
}
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
  list-style: none; margin: 0; padding: 4px; max-height: 60vh; overflow-y: auto;
  background: #fff; border: 1px solid #000; box-shadow: 0 12px 32px rgba(0, 0, 0, .14);
}
.search-results li { padding: 7px 10px; line-height: 1.3; cursor: pointer; }
.search-results li[aria-selected="true"], .search-results li:hover { background: var(--mint); }
.search-results small { display: block; color: var(--muted); }
.search-results .no-results { color: var(--muted); cursor: default; }
.search-results .no-results:hover { background: none; }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: .8rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend svg { flex: none; }
@media (max-width: 640px) {
  .tree-tools .legend { display: none; }
  .tree-search { max-width: none; }
}

.branch { background: var(--mint); margin-top: 22px; padding-block: 26px 44px; scroll-margin-top: 64px; }
.branch-title { text-align: center; font-size: 1.45rem; font-weight: 700; margin-bottom: 2px; }
.branch-num { font-size: .8rem; font-weight: 400; vertical-align: .2em; margin-right: 1px; }
.branch-sub { text-align: center; color: var(--muted); font-size: .92rem; margin-bottom: 18px; }
.branch .story { max-width: 920px; font-size: 1.05rem; }
.branch-empty {
  margin: 0 0 18px; padding: 14px 16px; text-align: center; color: var(--muted);
  border: 1.5px dashed #9ec3b5; border-radius: 6px;
}
.to-top { display: block; width: fit-content; margin: 16px auto 0; font-size: .85rem; color: var(--muted); }

/* ---------- Family charts ---------- */

.family-chart {
  margin-bottom: 26px; overflow: hidden; background: #fff; border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 26px rgba(20, 70, 50, .07);
}
.family-chart > noscript img, .chart-fallback { margin-inline: auto; padding: 16px; }

.chart-toolbar {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid #edf1ef;
}
.chart-toolbar button {
  min-width: 34px; height: 32px; padding: 0 11px;
  font: inherit; font-size: .86rem; color: var(--ink); background: #fff; border: 1px solid #c6d2cd; cursor: pointer;
}
.chart-toolbar button:hover { background: var(--mint); }
.chart-views { display: flex; }
.chart-views button + button { margin-left: -1px; }
.chart-views button[aria-pressed="true"] { color: #fff; background: #000; border-color: #000; }
.chart-zoom { display: flex; gap: 4px; }

.chart-scroll {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  cursor: grab; user-select: none; -webkit-user-select: none;
}
.chart-scroll.is-dragging { cursor: grabbing; }
.chart-svg { display: block; margin-inline: auto; }
.chart-hint { margin: 0; padding: 2px 12px 10px; text-align: center; font-size: .78rem; color: var(--muted); }
.chart-list { padding: 16px 20px 22px; }

.chart-svg text { font-family: var(--font); fill: #111; }
.chart-svg .link { fill: none; stroke: #1a1a1a; stroke-width: 1.4; }
.chart-svg .link-bond { stroke-width: 2; }
.chart-svg .link-bond.is-separated { stroke-dasharray: 4 3; }
.chart-svg .card { cursor: pointer; outline: none; }
.chart-svg .card rect { fill: #fff; stroke: #1a1a1a; stroke-width: 1.3; transition: fill .15s; }
.chart-svg .card.is-root rect { stroke-width: 2.8; }
.chart-svg .card.is-partner rect { stroke: #8d9893; }
.chart-svg .card.is-unknown rect { fill: #f6f8f7; stroke: #99a39f; stroke-dasharray: 4 3; }
.chart-svg .card:hover rect { fill: var(--mint); }
.chart-svg .card:focus-visible rect { fill: var(--mint); stroke: var(--green); stroke-width: 2.8; }
.chart-svg .card.is-highlight rect { stroke: var(--green); stroke-width: 3.5; animation: card-pulse .9s ease-in-out 3; }
.chart-svg .card-name { font-size: 13px; font-weight: 700; }
.chart-svg .card-meta { font-size: 11px; fill: #545b58; }
.chart-svg .card-unknown { font-size: 18px; fill: #8b9590; }
.chart-svg .toggle { cursor: pointer; outline: none; }
.chart-svg .toggle circle { fill: #fff; stroke: #1a1a1a; stroke-width: 1.3; }
.chart-svg .toggle text { font-size: 11px; font-weight: 700; }
.chart-svg .toggle:hover circle, .chart-svg .toggle:focus-visible circle { fill: var(--mint-deep); }
@keyframes card-pulse { 50% { fill: var(--mint-deep); } }

.family-list, .family-list ul { list-style: none; margin: 0; padding: 0; }
.family-list ul { margin: 2px 0 4px 8px; padding-left: 18px; border-left: 1.5px solid var(--mint-deep); }
.family-list li { padding-block: 3px; }
.list-union { font-size: .93rem; }
.list-label, .list-dates { color: var(--muted); }
.list-dates { font-size: .88rem; }
.list-unknown { color: var(--muted); font-style: italic; }

.person-link {
  padding: 0; font: inherit; color: inherit; text-align: left; background: none; border: 0; cursor: pointer;
  text-decoration: underline; text-decoration-color: #9bbcb0; text-underline-offset: 3px;
}
.person-link:hover { text-decoration-color: currentColor; }

/* ---------- Person panel ---------- */

.person-panel {
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0;
  width: min(380px, 100%); padding: 24px 24px 32px; overflow-y: auto;
  background: #fff; box-shadow: -8px 0 40px rgba(0, 0, 0, .18);
  transform: translateX(105%); transition: transform .2s ease;
}
.person-panel.is-open { transform: none; }
@media (max-width: 640px) {
  .person-panel {
    top: auto; left: 0; width: 100%; max-height: 75vh;
    border-radius: 14px 14px 0 0; box-shadow: 0 -8px 40px rgba(0, 0, 0, .2);
    transform: translateY(105%);
  }
}
.panel-close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px;
  font-size: 28px; line-height: 1; color: inherit; background: transparent; border: 0; cursor: pointer;
}
.panel-body h2 { font-size: 1.5rem; margin: 6px 40px 4px 0; }
.panel-branch { margin-bottom: 0; }
.panel-branch a { color: var(--green); font-size: .9rem; text-decoration: none; }
.panel-branch a:hover { text-decoration: underline; }
.panel-intro { margin-top: 12px; }
.panel-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 16px 0 0; }
.panel-facts dt { color: var(--muted); }
.panel-facts dd { margin: 0; }
.panel-rel h3 {
  margin: 20px 0 4px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.panel-rel ul { list-style: none; margin: 0; padding: 0; }
.panel-rel li { padding-block: 2px; }
.panel-rel .rel-type { color: var(--muted); font-size: .88rem; }
.panel-verify { margin-top: 20px; padding: 10px 12px; font-size: .9rem; background: #fff6dc; border-left: 3px solid #dba400; }
.panel-action { margin-top: 22px; }
