/* =========================================================
   Emline landing page
   - Style options via html[data-style]: mono | editorial | night
     (more in /themes/*.css: monograph, denim)
   - Corner joint via html[data-joint]: (none = square) | rounded | inverse | bend
   - Corner radius via html[data-radius]: s | (none = m) | l
   - Edge via html[data-dock]: (none = flush) | inset
   - State via body[data-view]: enterprise | individuals | (none)
   ========================================================= */

/* ---------- Style tokens ---------- */
:root,
[data-style="mono"] {
  --paper: #ffffff;
  --ink: #0a0a0a;
  --muted: #8a8a8a;
  --accent: var(--ink);
  --line: 2px;
  --font-display: "Inter", "Helvetica Neue", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --title-weight: 700;
  --title-style: normal;
  --title-tracking: -0.03em;
  --bubble-fill: var(--ink);
  --bubble-border: var(--ink);
  --glow: none;
  color-scheme: light;
}

[data-style="editorial"] {
  --paper: #f5f0e6;
  --ink: #1c1a17;
  --muted: #8b8174;
  --accent: #a2482b;
  --line: 1px;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --title-weight: 400;
  --title-style: italic;
  --title-tracking: -0.01em;
  --bubble-fill: var(--paper);
  --bubble-border: var(--ink);
  --glow: none;
  color-scheme: light;
}

[data-style="night"] {
  --paper: #0c0c0f;
  --ink: #ececf1;
  --muted: #7d7d88;
  --accent: #f5b84b;
  --line: 1px;
  --font-display: "Inter", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --title-weight: 300;
  --title-style: normal;
  --title-tracking: 0.02em;
  --bubble-fill: var(--accent);
  --bubble-border: var(--accent);
  --glow: 0 0 14px rgba(245, 184, 75, 0.55);
  color-scheme: dark;
}

/* ---------- Line sizes ----------
   Each style sets its own --line. The header and branches stay slim;
   the vertical line (the trunk) is twice as thick so it reads as the spine. */
html {
  --rule: var(--line);                      /* header border */
  --trunk: calc(var(--line) * 2);           /* the vertical line */
  --branch-w: var(--line);                  /* company branches (projects are half) */
  --bubble: 13px;                           /* company bubble */
  --bubble-sm: 8px;                         /* project bubble */
  --joint-r: 24px;                          /* corner radius (Radius option) */
  --joint-color: var(--ink);
  --inset: 32px;                            /* gap from the screen edge when docked (Edge option) */
}
[data-radius="s"] { --joint-r: 10px; }
[data-radius="l"] { --joint-r: 52px; }

/* ---------- Motion ---------- */
:root {
  --ease: cubic-bezier(0.65, 0, 0.35, 1);
  --slide: 750ms;
  --after-slide: 650ms;      /* when content starts appearing after the line moves */
  --stagger: 160ms;          /* delay between timeline rows */
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  transition: background 300ms, color 300ms;
}

button { font: inherit; color: inherit; }

/* ---------- Header ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 22px 16px;
  border-bottom: var(--rule) solid var(--ink);
}

.title {
  grid-column: 2;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3.6vw, 2.25rem);
  font-weight: var(--title-weight);
  font-style: var(--title-style);
  letter-spacing: var(--title-tracking);
  text-align: center;
}

.wordmark {
  grid-column: 3;
  justify-self: end;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Back button: small and grey, only visible once a side is chosen */
.back {
  grid-column: 1;
  justify-self: start;
  appearance: none;
  border: 0;
  background: none;
  padding: 6px 8px;
  margin-left: -8px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateX(-6px);
  transition: opacity 200ms, transform 200ms, visibility 0s 200ms, color 150ms;
}
.back:hover,
.back:focus-visible { color: var(--ink); outline: none; }

[data-view] .back {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 300ms ease 400ms, transform 300ms ease 400ms, visibility 0s, color 150ms;
}

/* ---------- Split stage ----------
   --split = where the vertical line sits. Both panels are sized from it,
   so animating that one value moves everything together. */
.stage {
  --split: 50%;
  position: relative;
  flex: 1;
  overflow-x: clip;           /* clip sideways, but let the corner pieces overlap the header line */
  overflow-y: visible;
}
[data-view="enterprise"] .stage  { --split: 100%; }   /* line → right edge */
[data-view="individuals"] .stage { --split: 0%; }     /* line → left edge  */

/* Edge: Inset stops the line short of the screen edge, so it meets the header
   line in a T instead of forming the page's corner. */
[data-dock="inset"] [data-view="enterprise"] .stage  { --split: calc(100% - var(--inset)); }
[data-dock="inset"] [data-view="individuals"] .stage { --split: var(--inset); }

.panel {
  position: absolute;
  top: 0;
  bottom: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  transition: width var(--slide) var(--ease);
}
.panel--left  { left: 0;  width: var(--split); }
.panel--right { right: 0; width: calc(100% - var(--split)); }

.divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split);
  width: var(--trunk);
  margin-left: calc(var(--trunk) / -2);
  background: var(--ink);
  box-shadow: var(--glow);
  pointer-events: none;
  transition: left var(--slide) var(--ease), margin-left var(--slide) var(--ease);
}
[data-view="enterprise"] .divider  { margin-left: calc(var(--trunk) * -1); }
[data-view="individuals"] .divider { margin-left: 0; }
[data-dock="inset"] [data-view] .divider { margin-left: calc(var(--trunk) / -2); }
[data-style="night"] .divider { box-shadow: 0 0 10px rgba(236, 236, 241, 0.35); }

/* ---------- Corner: where the header line meets the vertical line ----------
   square  — plain join (default)
   rounded — concave fillets fill the inside corners, like a bent pipe
   inverse — a solid quarter-circle sits in each inside corner, bulging outwards
   bend    — the header line curves down into the vertical line as one stroke,
             thickening from the slim header weight to the bold trunk weight */
.divider::before,
.divider::after {
  content: "";
  position: absolute;
  top: 0;
  display: none;
  pointer-events: none;
}

[data-joint="rounded"] .divider::before,
[data-joint="rounded"] .divider::after,
[data-joint="inverse"] .divider::before,
[data-joint="inverse"] .divider::after {
  display: block;
  width: var(--joint-r);
  height: var(--joint-r);
}
[data-joint="rounded"] .divider::before {     /* left of the line */
  right: 100%;
  background: radial-gradient(circle at 0 100%, transparent calc(var(--joint-r) - 0.5px), var(--joint-color) var(--joint-r));
}
[data-joint="rounded"] .divider::after {      /* right of the line */
  left: 100%;
  background: radial-gradient(circle at 100% 100%, transparent calc(var(--joint-r) - 0.5px), var(--joint-color) var(--joint-r));
}

[data-joint="inverse"] .divider::before {     /* left of the line */
  right: 100%;
  background: radial-gradient(circle at 100% 0, var(--joint-color) calc(var(--joint-r) - 0.5px), transparent var(--joint-r));
}
[data-joint="inverse"] .divider::after {      /* right of the line */
  left: 100%;
  background: radial-gradient(circle at 0 0, var(--joint-color) calc(var(--joint-r) - 0.5px), transparent var(--joint-r));
}

/* Bend: each side is an R×R tile laid over the header line. Its layers, top to bottom:
   paper inside an ellipse (cuts the inside of the curve), ink inside a circle (the
   stroke), and solid paper (hides the square corner of the header line and the top
   of the trunk). The ellipse is narrower by the trunk width and shorter by the header
   width, so the stroke tapers from one thickness to the other. */
[data-joint="bend"] .divider::before,
[data-joint="bend"] .divider::after {
  display: block;
  top: calc(var(--rule) * -1);
  width: var(--joint-r);
  height: var(--joint-r);
}
[data-joint="bend"] .divider::before {        /* left of the line: curves left */
  right: 0;
  background:
    radial-gradient(calc(var(--joint-r) - var(--trunk)) calc(var(--joint-r) - var(--rule)) at 0 100%, var(--paper) 97%, transparent 100%),
    radial-gradient(circle var(--joint-r) at 0 100%, var(--joint-color) 97%, transparent 100%),
    linear-gradient(var(--paper), var(--paper));
}
[data-joint="bend"] .divider::after {         /* right of the line: curves right */
  left: 0;
  background:
    radial-gradient(calc(var(--joint-r) - var(--trunk)) calc(var(--joint-r) - var(--rule)) at 100% 100%, var(--paper) 97%, transparent 100%),
    radial-gradient(circle var(--joint-r) at 100% 100%, var(--joint-color) 97%, transparent 100%),
    linear-gradient(var(--paper), var(--paper));
}

/* ---------- Choice buttons ---------- */
.choice {
  grid-area: 1 / 1;
  appearance: none;
  border: 0;
  background: none;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  /* coming back: fade in after the line returns */
  transition: opacity 350ms ease 500ms, visibility 0s;
}
.choice:focus-visible { outline: none; }

[data-view] .choice {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms, visibility 0s 200ms;
}

.choice__label {
  transition: background 200ms, color 200ms, box-shadow 250ms, border-color 200ms, background-size 300ms var(--ease);
}
.choice__hint {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* Mono: square outlined box, fills black on hover */
[data-style="mono"] .choice__label {
  padding: 14px 30px;
  border: var(--rule) solid var(--ink);
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
[data-style="mono"] .choice:hover .choice__label,
[data-style="mono"] .choice:focus-visible .choice__label { background: var(--ink); color: var(--paper); }
[data-style="mono"] .choice__hint { text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.14em; }

/* Editorial: large italic serif with an underline that draws in on hover */
[data-style="editorial"] .choice__label {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem);
  padding-bottom: 4px;
  background: linear-gradient(var(--accent), var(--accent)) left bottom / 0% 1px no-repeat;
}
[data-style="editorial"] .choice:hover .choice__label,
[data-style="editorial"] .choice:focus-visible .choice__label { background-size: 100% 1px; color: var(--accent); }
[data-style="editorial"] .choice__hint { font-variant: small-caps; letter-spacing: 0.12em; font-size: 0.9rem; }

/* Night: thin pill that glows amber on hover */
[data-style="night"] .choice__label {
  padding: 12px 30px;
  border: var(--rule) solid rgba(236, 236, 241, 0.35);
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.1em;
}
[data-style="night"] .choice:hover .choice__label,
[data-style="night"] .choice:focus-visible .choice__label {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 18px rgba(245, 184, 75, 0.35), inset 0 0 12px rgba(245, 184, 75, 0.12);
}

/* ---------- Demo content ---------- */
.demo {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100vw;               /* fixed width so content doesn't reflow while the panel slides */
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms, visibility 0s 180ms;   /* going back: disappear quickly */
}
.panel--left  .demo { left: 0; }
.panel--right .demo { right: 0; }

[data-view="enterprise"]  .panel--left  .demo,
[data-view="individuals"] .panel--right .demo {
  opacity: 1;
  visibility: visible;
  transition: opacity 400ms ease var(--after-slide), visibility 0s;
}

.demo--center {
  display: grid;
  place-items: center;
  padding: 16px;
}
.placeholder { max-width: 560px; text-align: center; }
.placeholder h2 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-weight: var(--title-weight);
  font-style: var(--title-style);
  font-size: clamp(1.5rem, 3vw, 2rem);
}
.placeholder p { margin: 0; color: var(--muted); }

/* ---------- Individuals timeline ----------
   Branches grow out of the line at the left edge, a bubble pops at the end,
   then the entry text fades in. Each row is staggered by --i.
   Kept to the left part of the screen so the right side is free for later content. */
.demo--timeline { overflow-y: auto; }

/* Leaves spread down the full height. Each row grows by its own --grow,
   and that extra space sits above it, so the gaps are uneven but never overlap. */
.timeline {
  list-style: none;
  margin: 0;
  padding: 3vh 16px 3vh 0;
  min-height: 100%;
  max-width: min(560px, 100%);
  display: flex;
  flex-direction: column;
}
.timeline::after {            /* space under the last leaf */
  content: "";
  flex: var(--tail, 1) 1 0;
}

.timeline li {
  --row: 1.8rem;              /* height of the title line; the branch aligns to it */
  flex: var(--grow, 1) 1 auto;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: 1fr auto;   /* row 1 = the gap above, row 2 = the leaf */
  padding-top: 10px;              /* minimum gap */
}
.timeline li > * { grid-row: 2; align-self: start; }
.timeline li.is-project { --row: 1.45rem; }

.stem {
  flex: none;
  display: flex;
  align-items: center;
  height: var(--row);
}

.branch {
  display: block;
  width: clamp(12px, var(--len), 16vw);
  height: var(--branch-w);
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 200ms ease;
}

.bubble {
  display: block;
  flex: none;
  width: var(--bubble);
  height: var(--bubble);
  margin-left: -1px;
  border-radius: 50%;
  background: var(--bubble-fill);
  border: max(calc(var(--branch-w) * 0.75), 1.5px) solid var(--bubble-border);
  box-shadow: var(--glow);
  transform: scale(0);
  transition: transform 150ms ease;
}

.entry {
  padding-left: 14px;
  max-width: 44ch;
  opacity: 0;
  transform: translateX(-8px);
  transition: opacity 150ms, transform 150ms;
}
.entry__company {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: var(--row);
}
[data-style="editorial"] .entry__company { font-weight: 400; font-style: italic; font-size: 1.25rem; }
[data-style="night"] .entry__company { font-weight: 500; }

.entry__meta {
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.entry__text {
  margin: 6px 0 0;
  font-size: 0.95rem;
}

/* Small leaves: notable projects (title only) */
.is-project .branch { height: max(1px, calc(var(--branch-w) / 2)); }
.is-project .bubble { width: var(--bubble-sm); height: var(--bubble-sm); border-width: max(1px, calc(var(--branch-w) / 2)); }
.is-project .entry { padding-left: 10px; }
.is-project .entry__company { font-size: 0.95rem; font-weight: 500; }
[data-style="editorial"] .is-project .entry__company { font-size: 1.05rem; }

/* Animate in, row by row */
[data-view="individuals"] .branch {
  transform: scaleX(1);
  transition: transform 550ms cubic-bezier(0.2, 0.7, 0.2, 1)
              calc(var(--after-slide) + var(--i) * var(--stagger));
}
[data-view="individuals"] .bubble {
  transform: scale(1);
  transition: transform 380ms cubic-bezier(0.3, 1.6, 0.5, 1)
              calc(var(--after-slide) + 480ms + var(--i) * var(--stagger));
}
[data-view="individuals"] .entry {
  opacity: 1;
  transform: none;
  transition: opacity 450ms ease calc(var(--after-slide) + 600ms + var(--i) * var(--stagger)),
              transform 450ms ease calc(var(--after-slide) + 600ms + var(--i) * var(--stagger));
}

/* ---------- Demo controls: style + line weight ---------- */
.switcher {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
}
.switcher__group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 4px 4px 4px 12px;
  border: 1px solid color-mix(in srgb, var(--muted) 40%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  backdrop-filter: blur(6px);
  color: var(--muted);
}
.switcher__group > span { margin-right: 6px; }
.switcher button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: none;
  padding: 5px 10px;
  color: var(--muted);
  cursor: pointer;
}
.switcher button:hover { color: var(--ink); }
.switcher button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.switcher button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .wordmark { display: none; }
  .topbar { grid-template-columns: auto 1fr auto; }
  .title { text-align: center; }
  .choice__label { padding-inline: 18px !important; }
  .switcher { left: 16px; align-items: stretch; }
  .switcher__group { justify-content: center; border-radius: 14px; padding: 4px; }
  .switcher__group > span { display: none; }
}

/* ---------- Reduced motion: jump instead of slide ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
