/* elyslabs.ca. Colours, type and radii come from brand.css (a copy of brand/tokens/brand.css). */

:root {
  /* Background isles: Shallows on Foam, Swell on Deep Sea (style guide section 6) */
  --isles-land: var(--elys-shallows);
  --chart-line: #A9BEDC;
  --gutter: clamp(24px, 6.5vw, 112px);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --isles-land: #1F2B38;
    --chart-line: #3A5068;
  }
}
:root[data-theme='dark'] {
  --isles-land: #1F2B38;
  --chart-line: #3A5068;
}

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

html { overflow-x: clip; }

body {
  margin: 0;
  background: var(--elys-bg);
  color: var(--elys-fg);
  font-family: var(--elys-font-body);
  font-size: 16px;
  line-height: 24px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--elys-accent);
  color: var(--elys-bg);
}

a { color: inherit; }
a:focus-visible {
  outline: 2px solid var(--elys-accent);
  outline-offset: 4px;
  border-radius: 2px;
}

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

/* Quiet links: muted text with an underline that draws in from the left on hover */
.quiet {
  color: var(--elys-fg-muted);
  font-weight: 500;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px;
  transition: color 0.3s ease, background-size 0.45s var(--ease-out);
}
.quiet:hover,
.quiet:focus-visible {
  color: var(--elys-fg);
  background-position: 0 100%;
  background-size: 100% 1px;
}

/* --- Header -------------------------------------------------------------- */

.top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px var(--gutter) 0;
}
/* On the home page the header floats over the first screen, so the sea chart runs behind it */
.home .top {
  position: absolute;
  inset: 0 0 auto;
}
.logo { display: block; }
.logo img {
  display: block;
  width: auto;
  height: 30px;
}

.nav {
  display: flex;
  gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 15px;
  line-height: 20px;
}
.nav a {
  display: inline-block;
  padding: 6px 0;
}

/* --- First screen: tagline and sea chart ---------------------------------- */

.hero {
  position: relative;
  isolation: isolate;
  overflow: clip;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  min-height: 100vh;
  min-height: 100svh;
}
.hero-text {
  position: relative;
  z-index: 1;
  padding: 126px var(--gutter);
}

.eyebrow {
  margin: 0 0 28px;
  color: var(--elys-fg-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tagline {
  margin: 0;
  font-family: var(--elys-font-display);
  font-weight: 600;
  /* "carefully shipped." is about 8.6em wide and stays on one line */
  font-size: clamp(2.5rem, 6vw, 6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
/* Each line is a window the words rise through on load. The padding keeps descenders unclipped. */
.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.1em;
  margin-bottom: -0.1em;
}
.line > span { display: inline-block; }
/* The full stop is the small isle: a round Aegean dot that lands with it (Sora's own is square) */
.dot {
  display: inline-block;
  width: 0.18em;
  height: 0.18em;
  margin-left: 0.05em;
  border-radius: 50%;
  background: var(--elys-accent);
}

.lede {
  margin: 28px 0 0;
  max-width: 28em;
  color: var(--elys-fg-muted);
  font-size: clamp(17px, 1.35vw, 20px);
  line-height: 1.5;
  text-wrap: balance;
}

/* Sits where the footer used to, so the first screen keeps its shape and still points down the page */
.cue {
  position: absolute;
  z-index: 1;
  left: var(--gutter);
  bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  line-height: 18px;
}
.cue-arrow { display: inline-block; }

/* The sea chart. Sized by the smaller of the window's height and width so the isles never reach the text. */
.sea {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: 0;
  display: block;
  height: min(118vh, 74vw);
  width: auto;
  aspect-ratio: 56 / 74;
  translate: 0 -50%;
  pointer-events: none;
}
.contour {
  fill: none;
  stroke: var(--chart-line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: var(--a);
}
/* Scales from the middle of the big isle */
.lvl { transform-origin: 17.5px 28px; }

.isle { fill: var(--isles-land); }
.isle-3 { fill: var(--elys-accent); }
.ripple {
  fill: none;
  stroke: var(--elys-accent);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  opacity: 0;
}
.isle,
.ripple {
  transform-box: fill-box;
  transform-origin: center;
}

/* --- Sections: apps, about, contact --------------------------------------- */

.block {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr);
  column-gap: clamp(32px, 6vw, 112px);
  row-gap: 32px;
  padding: clamp(72px, 9vw, 128px) var(--gutter);
  border-top: 1px solid var(--elys-border);
}
.block-title {
  margin: 0;
  font-family: var(--elys-font-display);
  font-weight: 600;
  font-size: clamp(24px, 2.2vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.block-body {
  min-width: 0;
  max-width: 56rem;
}

.apps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 20px;
}
.app {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px;
  background: var(--elys-surface);
  border: 1px solid var(--elys-border);
  border-radius: var(--elys-radius-lg);
}
.app-head {
  display: flex;
  align-items: center;
  gap: 16px;
}
.app-icon {
  flex: none;
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 13px;
  box-shadow: 0 0 0 1px var(--elys-border);
}
.app-name {
  margin: 0;
  font-family: var(--elys-font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.02em;
}
.app-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 0;
  color: var(--elys-fg-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}
.app-status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--elys-mist);
}
/* Released apps get the small isle's colour */
.app-status.is-live::before { background: var(--elys-accent); }
.app-desc { margin: 0; }
.app-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--elys-border);
  border-radius: var(--elys-radius-pill);
  color: var(--elys-fg);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  text-decoration: none;
  transition: border-color 0.3s ease;
}
.pill:hover { border-color: var(--elys-fg-muted); }
.pill:focus-visible { border-radius: var(--elys-radius-pill); }
.pill-arrow { color: var(--elys-fg-muted); }

.about-text {
  margin: 0;
  max-width: 34em;
  font-size: clamp(18px, 1.5vw, 22px);
  line-height: 1.55;
  text-wrap: pretty;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 24px 32px;
  margin: 48px 0 0;
  padding: 28px 0 0;
  border-top: 1px solid var(--elys-border);
}
.facts dt {
  color: var(--elys-fg-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.facts dd { margin: 6px 0 0; }

.email {
  display: inline-block;
  padding-bottom: 4px;
  color: var(--elys-fg);
  font-family: var(--elys-font-display);
  font-size: clamp(28px, 4.4vw, 56px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-decoration: none;
  overflow-wrap: anywhere;
  background: linear-gradient(var(--elys-accent), var(--elys-accent)) no-repeat 0 100% / 0 2px;
  transition: background-size 0.45s var(--ease-out);
}
.email:hover,
.email:focus-visible { background-size: 100% 2px; }
.contact-note {
  margin: 20px 0 0;
  max-width: 32em;
  color: var(--elys-fg-muted);
}
.contact-note + .contact-note { margin-top: 8px; }

/* Inline links in running text */
.contact-note a,
.doc a:not(.pill) {
  color: var(--elys-fg);
  text-decoration: underline;
  text-decoration-color: var(--elys-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.contact-note a:hover,
.doc a:not(.pill):hover { text-decoration-thickness: 2px; }

/* --- Footer --------------------------------------------------------------- */

.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 28px var(--gutter);
  border-top: 1px solid var(--elys-border);
  color: var(--elys-fg-muted);
  font-size: 13px;
  line-height: 18px;
}
.footer p { margin: 0; }
.footer-links {
  display: flex;
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- Legal pages and 404 -------------------------------------------------- */

/* One reading column, centred in the window. The text inside stays left-aligned. */
.doc {
  box-sizing: content-box;
  max-width: 42rem;
  margin-inline: auto;
  padding: clamp(56px, 8vw, 104px) var(--gutter) clamp(72px, 9vw, 128px);
}
.doc .eyebrow { margin-bottom: 20px; }
.doc h1 {
  margin: 0;
  font-family: var(--elys-font-display);
  font-size: clamp(2.25rem, 4.5vw, 3.5rem);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
}
.doc-meta {
  margin: 16px 0 0;
  color: var(--elys-fg-muted);
  font-size: 14px;
}
.doc-lede {
  margin: 32px 0 0;
  font-size: 19px;
  line-height: 1.55;
  text-wrap: pretty;
}
.doc h2 {
  margin: 48px 0 0;
  font-family: var(--elys-font-display);
  font-size: 21px;
  font-weight: 600;
  line-height: 28px;
  letter-spacing: -0.01em;
}
.doc p,
.doc ul { margin: 12px 0 0; }
.doc ul { padding-left: 1.25em; }
.doc li + li { margin-top: 6px; }
.doc .actions { margin-top: 32px; }

/* --- Phones, narrow windows and portrait tablets -------------------------- */

@media (max-width: 760px), (orientation: portrait) and (max-width: 1100px) {
  .top { padding-top: 24px; }
  .logo img { height: 26px; }
  .nav {
    gap: 18px;
    font-size: 14px;
  }

  /* The chart moves below the text */
  .hero {
    grid-template-rows: auto 1fr;
    align-content: stretch;
    padding-bottom: 64px;
  }
  .hero-text {
    align-self: start;
    padding: 106px var(--gutter) 0;
  }
  .eyebrow { margin-bottom: 20px; }
  .tagline { font-size: min(4.5rem, calc((100vw - 2 * var(--gutter)) / 9)); }
  .lede {
    margin-top: 20px;
    font-size: 16px;
    line-height: 24px;
  }
  .sea {
    --w: min(118vw, 720px);
    position: relative;
    grid-row: 2;
    top: auto;
    translate: none;
    justify-self: end;
    align-self: center;
    width: var(--w);
    height: auto;
    /* Let the faint outer contours run under the text */
    margin-top: calc(var(--w) * -0.3);
  }

  .block { grid-template-columns: minmax(0, 1fr); }
  .app { padding: 24px; }
}

@media (max-width: 360px) {
  .logo img { height: 22px; }
  .nav {
    gap: 14px;
    font-size: 13px;
  }
}

/* --- Motion --------------------------------------------------------------- */
/* Everything above is the finished, still page; this only adds the way in and the tide. */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .home .top,
  .hero .eyebrow,
  .hero .lede,
  .cue {
    animation: fade-up 1.1s var(--ease-out) both;
  }
  .home .top { animation-delay: 0.1s; }
  .hero .eyebrow { animation-delay: 0.25s; }
  .hero .lede { animation-delay: 0.75s; }
  .cue { animation-delay: 1.4s; }
  .cue-arrow { animation: drift 2.8s ease-in-out 2.6s infinite; }

  .line > span { animation: rise 1.2s var(--ease-out) both; }
  .line:nth-child(1) > span { animation-delay: 0.35s; }
  .line:nth-child(2) > span { animation-delay: 0.48s; }
  .dot { animation: land 0.8s var(--ease-pop) 1.25s both; }

  /* The isles surface, the water settles around them, then the small isle lands */
  .isle-1 { animation: surface 1.6s var(--ease-out) 0.1s both; }
  .isle-2 { animation: surface 1.6s var(--ease-out) 0.3s both; }
  .isle-3 { animation: land 0.8s var(--ease-pop) 1.25s both; }
  .lvl { animation: settle 1.8s var(--ease-out) both; animation-delay: calc(0.4s + var(--k) * 0.12s); }

  /* The tide: a slow brightening that travels outward through the contours */
  .contour { animation: tide 8s ease-in-out infinite; animation-delay: calc(2.6s + var(--k) * 0.38s); }
  .ripple { animation: ripple 5.6s cubic-bezier(0.25, 0.6, 0.3, 1) infinite; animation-delay: calc(1.5s + var(--i) * 2.8s); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
}
@keyframes rise {
  from { transform: translateY(105%); }
}
@keyframes surface {
  from { opacity: 0; transform: scale(0.72); }
}
@keyframes land {
  from { opacity: 0; transform: scale(0); }
}
@keyframes settle {
  from { opacity: 0; transform: scale(0.9); }
}
@keyframes tide {
  0%, 45%, 100% { opacity: var(--a); }
  16% { opacity: calc(var(--a) + 0.38); }
}
@keyframes ripple {
  0% { opacity: 0.6; transform: scale(1); }
  100% { opacity: 0; transform: scale(3.6); }
}
@keyframes drift {
  0%, 100% { transform: none; }
  50% { transform: translateY(3px); }
}
