/* Unfolded Technologies - corporate site.

   Every colour on the page comes from the palette tokens below, including the
   triangle field, which app.js only tags with a level class (.l0 to .l5).

   Two palettes. The default follows the new UnfoldedData logo, gold on maroon.
   The earlier bright one - the unfoldeddata.ai yellow and orange plus red - is
   kept as `data-palette="bright"`: put that attribute on <html> to use it. */

:root {
  --ink:       #1a1a1a;
  --ink-soft:  #4a4540;
  --ink-mute:  #807870;
  --paper:     #ffffff;
  --line:      #e7e1d8;

  /* The marks. These stay the same in both palettes. */
  --gold:      #cc8d3b;
  --maroon:    #7b251b;

  /* Triangle field, lightest to darkest, and the accents taken from it. */
  --pale:      #f6ead8;
  --fold-1:    #e4b565;
  --fold-2:    #cc8d3b;
  --fold-3:    #b3652d;
  --fold-4:    #963d21;
  --fold-5:    #7b251b;
  --accent:      var(--fold-3);   /* nav underline, focus ring, list bullets */
  --accent-deep: var(--fold-5);   /* button hover, mission rule, form errors */
  --product:     var(--gold);     /* the "Data" in UnfoldedData */

  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body:    "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;

  --art-width: 42vw;
  --gutter: clamp(20px, 4vw, 64px);
}

:root[data-palette="bright"] {
  --pale:      #fff1d6;
  --fold-1:    #ffb800;
  --fold-2:    #ffa700;   /* unfoldeddata.ai --brand-400 */
  --fold-3:    #ff8d00;   /* unfoldeddata.ai --brand-500 */
  --fold-4:    #f25c05;
  --fold-5:    #d92b1c;
  --accent:      var(--fold-4);
  --accent-deep: var(--fold-5);
  --product:     var(--fold-3);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

a { color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.brand-logo, .product-logo { fill: currentColor; }

/* ---- page frame: content on the left, the folded field on the right ---- */

.site {
  position: relative;
  z-index: 1;
  width: calc(100vw - var(--art-width));
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding-inline: var(--gutter);
  transition: width .6s ease;
}

.field-art {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: var(--art-width);
  background: var(--pale);
  transition: width .6s ease;
}
/* The team view needs the width for three bios, so the field gives way. */
body[data-view="team"] { --art-width: 24vw; }
.folds { display: block; width: 100%; height: 100%; }

/* ---- header ---- */

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px 32px; flex-wrap: wrap;
  padding-block: 28px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-logo { width: 30px; height: 34px; flex: none; color: var(--maroon); }
.brand-name {
  font-family: var(--display);
  font-weight: 700; font-size: 21px; letter-spacing: -0.01em;
}
.brand-suffix { font-weight: 400; color: var(--ink-soft); }

.site-nav { display: flex; gap: 28px; }
.site-nav a {
  text-decoration: none; font-weight: 500; color: var(--ink-soft);
  padding-block: 4px; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ---- views ---- */

.views { position: relative; min-height: 0; }

.view {
  height: 100%;
  overflow-y: auto;
  /* Reserve the scrollbar's width even when there is none, so fitting the
     view (app.js fitView) does not change the width the text wraps in. */
  scrollbar-gutter: stable;
  display: flex; flex-direction: column;
  max-width: 760px;
  padding-block: 12px 32px;
  animation: view-in .35s ease-out;
}
/* Centred with auto margins rather than justify-content: centre, which pushes
   the top of a too-tall view out of reach of its own scrollbar. */
.view > :first-child { margin-top: auto; }
/* --fit is set by app.js to shrink a too-tall view until it fits the screen. */
.view > * { zoom: var(--fit, 1); }
.view > :last-child { margin-bottom: auto; }
/* `display: flex` above outranks the browser's own [hidden] rule. */
.view[hidden] { display: none; }
@keyframes view-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.view h1 {
  font-family: var(--display);
  font-variation-settings: "wdth" 82;
  font-weight: 700;
  font-size: clamp(34px, 4.2vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  margin: 0 0 24px;
}
.view h1:focus { outline: none; }

/* The landing headline is the one piece of type that is allowed to be big. */
.view-home h1 { font-size: clamp(42px, 6.4vw, 96px); max-width: 13ch; margin-bottom: 32px; }

.lead { font-size: clamp(17px, 1.4vw, 20px); color: var(--ink-soft); max-width: 58ch; margin: 0 0 36px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 0; }

/* ---- buttons ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: 600 15px/1 var(--body);
  padding: 14px 22px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  background: transparent; color: var(--ink);
  text-decoration: none; cursor: pointer;
  transition: background-color .15s, color .15s;
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

a:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}

/* ---- product ---- */

.product { max-width: 60ch; }
.product-name {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--display); font-weight: 700;
  font-size: 30px; letter-spacing: -0.015em; margin: 0 0 6px;
}
.product-logo { width: 38px; height: 33px; flex: none; color: var(--gold); }
.product-suffix { color: var(--product); }
.product-line { font-size: 19px; color: var(--ink); margin: 0 0 16px; }
.product p { color: var(--ink-soft); }
.product-points { list-style: none; padding: 0; margin: 20px 0 32px; }
.product-points li {
  padding: 12px 0 12px 20px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  position: relative;
}
.product-points li:last-child { border-bottom: 1px solid var(--line); }
.product-points li::before {
  content: ""; position: absolute; left: 0; top: 20px;
  border-left: 9px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.product-points strong { color: var(--ink); font-weight: 600; }

/* ---- about ---- */

.mission {
  font-family: var(--display);
  font-variation-settings: "wdth" 92;
  font-weight: 500;
  font-size: clamp(22px, 2.2vw, 32px);
  line-height: 1.25;
  letter-spacing: -0.01em;
  max-width: 30ch;
  margin: 0 0 32px;
  padding-left: 24px;
  border-left: 6px solid var(--accent-deep);
}
.about-body { display: grid; gap: 0 32px; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 720px; }
.about-body p { color: var(--ink-soft); margin: 0 0 16px; }

/* ---- team ---- */

.team-intro { color: var(--ink-soft); margin: 0 0 28px; }
.view-team { max-width: 1080px; }
.team-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 36px;
}
/* Rows: name, role, bio, LinkedIn. The bio row stretches, so the LinkedIn
   links line up along the bottom whatever the bio lengths. */
.member { display: grid; grid-template-columns: 88px minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; column-gap: 16px; }
.member-art { display: block; grid-row: span 2; width: 88px; height: 88px; background: var(--pale); }
.member-name { align-self: end; font-family: var(--display); font-weight: 700; font-size: 19px; line-height: 1.2; letter-spacing: -0.01em; margin: 0; }
.member-role { align-self: start; margin: 2px 0 0; color: var(--ink-soft); font-size: 14.5px; line-height: 1.35; }
.member-bio { grid-column: 1 / -1; margin-top: 16px; font-size: 14.5px; line-height: 1.55; color: var(--ink-soft); }
.member-bio p { margin: 0 0 10px; }
.member-link {
  grid-column: 1 / -1; justify-self: start; margin-top: 6px;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500; color: var(--ink-soft); text-decoration: none;
}
.member-link:hover { color: var(--ink); }
.member-link svg { width: 18px; height: 18px; fill: var(--accent-deep); }

/* Shared drawing style for the three animations. Every animated line has
   pathLength="1", so a dash of 1 is its whole length whatever its size. Each
   element's resting style is its finished state; the keyframes only run the
   way there, so with motion turned off the drawing simply shows. */
.member-art .ink { fill: none; stroke: var(--fold-5); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.member-art .fill-gold   { fill: var(--fold-2); }
.member-art .fill-copper { fill: var(--fold-3); }
.member-art .fill-deep   { fill: var(--fold-5); }
.member-art .fill-paper  { fill: var(--paper); }
.member-art .fill-pale   { fill: var(--pale); }
.member-art .fill-light  { fill: var(--fold-1); }
.member-art .ink-faint   { fill: none; stroke: var(--pale); stroke-opacity: .3; stroke-width: 2; }

/* Science: three drawings take four seconds each of a twelve-second loop. */
.sci { animation: sci-show 12s infinite both; animation-delay: calc(var(--i) * 4s); }
.sci .ink { stroke-dasharray: 1; animation: sci-draw 12s ease-out infinite both; animation-delay: inherit; }
@keyframes sci-show {
  0%        { opacity: 0; }
  2%, 29%   { opacity: 1; }
  33%, 100% { opacity: 0; }
}
@keyframes sci-draw {
  0%        { stroke-dashoffset: 1; }
  15%, 100% { stroke-dashoffset: 0; }
}
.bubble {
  transform-box: fill-box; transform-origin: center;
  animation: bubble 2.4s ease-in infinite both;
  animation-delay: calc(var(--b) * .8s);
}
@keyframes bubble {
  0%   { transform: translateY(0); opacity: 0; }
  20%  { opacity: 1; }
  100% { transform: translateY(-36px); opacity: 0; }
}

/* Code: each line types in, stepwise, then clears in the same order. */
.code-line {
  transform-box: fill-box; transform-origin: 0 50%;
  animation: code-type 9s steps(6, end) infinite both;
  animation-delay: calc(var(--i) * .7s);
}
@keyframes code-type {
  0%        { transform: scaleX(0); opacity: 1; }
  10%, 75%  { transform: scaleX(1); opacity: 1; }
  80%, 100% { transform: scaleX(1); opacity: 0; }
}
.code-cursor { animation: blink 1s steps(1, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* Business: bars grow, the trend line draws, the arrowhead lands, all clear. */
.biz-bar {
  transform-box: fill-box; transform-origin: 50% 100%;
  animation: biz-grow 8s cubic-bezier(.2, .7, .3, 1) infinite both;
  animation-delay: calc(var(--i) * .2s);
}
@keyframes biz-grow {
  0%        { transform: scaleY(0); opacity: 1; }
  14%, 84%  { transform: scaleY(1); opacity: 1; }
  92%, 100% { transform: scaleY(1); opacity: 0; }
}
.biz-line { stroke-dasharray: 1; animation: biz-draw 8s ease-in-out infinite both; }
@keyframes biz-draw {
  0%, 16%   { stroke-dashoffset: 1; opacity: 1; }
  34%, 84%  { stroke-dashoffset: 0; opacity: 1; }
  92%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
.biz-head { animation: biz-head 8s infinite both; }
@keyframes biz-head {
  0%, 32%   { opacity: 0; }
  36%, 84%  { opacity: 1; }
  92%, 100% { opacity: 0; }
}

/* ---- contact ---- */

.contact-grid { display: grid; grid-template-columns: minmax(160px, 1fr) minmax(0, 2.4fr); gap: 32px 48px; align-items: start; }

.address { font-style: normal; color: var(--ink-soft); line-height: 1.7; }
.address strong { color: var(--ink); font-weight: 600; }

.contact-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-weight: 500; font-size: 14px; }
.optional { color: var(--ink-mute); font-weight: 400; }
.field input, .field textarea {
  font: 16px/1.4 var(--body); color: var(--ink);
  padding: 10px 12px;
  border: 1px solid #cfc7bb; border-radius: 4px;
  background: var(--paper);
  resize: vertical;
}
.field input:hover, .field textarea:hover { border-color: var(--ink-mute); }
.gotcha { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.form-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 20px; margin-top: 4px; }
.form-status { margin: 0; font-size: 15px; }
.form-status.is-ok { color: #1d7a3a; }
.form-status.is-error { color: var(--accent-deep); }

/* ---- footer ---- */

.site-footer { padding-block: 20px 28px; font-size: 13px; color: var(--ink-mute); }
.site-footer p { margin: 0; }

/* ---- the folded field ---- */

/* Fill and stroke both follow `color`, so one transition moves both. The
   stroke closes the hairline gaps anti-aliasing leaves between triangles. */
.folds polygon {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linejoin: round;
  transition: color .5s ease;
}
.folds .l0 { color: var(--pale); }
.folds .l1 { color: var(--fold-1); }
.folds .l2 { color: var(--fold-2); }
.folds .l3 { color: var(--fold-3); }
.folds .l4 { color: var(--fold-4); }
.folds .l5 { color: var(--fold-5); }
/* The shaded half of each square, so the field reads as folded paper rather
   than a flat mosaic. color-mix rather than `filter`, which Safari ignores on
   SVG shapes. */
.folds .shade.l0 { color: color-mix(in srgb, var(--pale), #000 4%); }
.folds .shade.l1 { color: color-mix(in srgb, var(--fold-1), #000 8%); }
.folds .shade.l2 { color: color-mix(in srgb, var(--fold-2), #000 8%); }
.folds .shade.l3 { color: color-mix(in srgb, var(--fold-3), #000 8%); }
.folds .shade.l4 { color: color-mix(in srgb, var(--fold-4), #000 8%); }
.folds .shade.l5 { color: color-mix(in srgb, var(--fold-5), #000 10%); }

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  .member-art *, .sci .ink { animation: none; }
  .sci + .sci, .bubble { display: none; }
  .folds polygon { transition: none; }
  .site, .field-art { transition: none; }
}

/* ---- narrow screens: the field becomes a band under the header and the
   page scrolls normally, since a contact form will not fit a phone screen. */

@media (max-width: 820px) {
  body { overflow: auto; display: flex; flex-direction: column; }
  .site { width: 100%; height: auto; min-height: calc(100dvh - 96px); }
  .site-header { padding-block: 18px; }
  .field-art { position: relative; width: 100%; height: 96px; flex: none; order: -1; }
  .views { min-height: auto; }
  .view { height: auto; overflow: visible; padding-block: 28px 32px; }
  .view > :first-child { margin-top: 0; }
  .about-body { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: 1fr; gap: 32px; }
}

@media (max-width: 480px) {
  .brand-name { font-size: 18px; }
  .brand-logo { width: 26px; height: 30px; }
  .site-nav { gap: 20px; }
  .contact-form { grid-template-columns: 1fr; }
}
