/*
 * Sage — the company page at sage.show.
 *
 * Direction: a colour-press card. The logo is loud — four serif letters in
 * red, violet, blue and gold over a hand-painted infinity — so the page around
 * it is quiet paper and ink, and borrows only those four inks as accents. Every
 * coloured thing on the page is one of the logo's letters; nothing is invented.
 *
 * Its own file rather than site.css: site.css is Show Browser's system (the
 * six swirl inks). Sage is the publisher, not the product,
 * and the two are not interchangeable.
 */
/* Type: Archivo for Latin headlines, IBM Plex Sans Thai for Thai and for body
   in both scripts. The site used Bodoni Moda, a high-contrast display serif:
   its hairline strokes made English headlines hard to read on screen, and next
   to Thai — which has no such contrast — the two scripts looked like different
   weights. Archivo and IBM Plex Sans Thai share an even stroke, so a headline
   reads the same whichever script it is in. */
@import url("https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=IBM+Plex+Sans+Thai:wght@400;500;600;700&display=swap");

:root {
  /* The logo's four letters, sampled. */
  --s: #e5231f;
  --a: #9a22e6;
  --g: #1638d8;
  --e: #e6b43a;
  --s-text: #d11d19;
  --g-text: #1638d8;

  --paper: #fbf7ef;
  --paper-2: #f3ecdf;
  --card: #ffffff;
  --ink: #17130e;
  --ink-2: #4a4238;
  --ink-3: #7a7065;
  --rule: #e4dac8;
  --shadow: 0 1px 0 rgba(23, 19, 14, .06), 0 24px 60px -24px rgba(58, 40, 12, .35);

  --display: "Archivo", "IBM Plex Sans Thai", "Leelawadee UI", system-ui, sans-serif;
  --body: "IBM Plex Sans Thai", "Leelawadee UI", system-ui, sans-serif;

  --wrap: min(1160px, 100% - 2.5rem);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15120e;
    --paper-2: #1d1914;
    --card: #221d17;
    --ink: #f6efe3;
    --ink-2: #cfc4b3;
    --ink-3: #9a8f80;
    --rule: #3a3229;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 30px 70px -28px rgba(0, 0, 0, .8);
    --s-text: #ff6b5f;
    --g-text: #8aa2ff;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15120e;
  --paper-2: #1d1914;
  --card: #221d17;
  --ink: #f6efe3;
  --ink-2: #cfc4b3;
  --ink-3: #9a8f80;
  --rule: #3a3229;
  --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 30px 70px -28px rgba(0, 0, 0, .8);
  --s-text: #ff6b5f;
  --g-text: #8aa2ff;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.0625rem/1.75 var(--body);
  overflow-x: hidden;
}
/* Paper grain — fine enough to read as texture, not pattern. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .35;
  background-image: radial-gradient(rgba(120, 96, 60, .12) 1px, transparent 1px);
  background-size: 3px 3px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--g); outline-offset: 3px; border-radius: 6px; }

.wrap { width: var(--wrap); margin-inline: auto; position: relative; z-index: 1; }

/* The four-ink rule: the logo's letters as a line. Used as the page's only
   ornament, so it stays meaningful. */
.inks { display: flex; height: 6px; }
.inks i { flex: 1; }
.inks i:nth-child(1) { background: var(--s); }
.inks i:nth-child(2) { background: var(--a); }
.inks i:nth-child(3) { background: var(--g); }
.inks i:nth-child(4) { background: var(--e); }

/* ---------- header ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}
.word {
  font: 800 1.6rem/1 var(--display);
  letter-spacing: .02em;
  text-decoration: none;
}
.word span:nth-child(1) { color: var(--s); }
.word span:nth-child(2) { color: var(--a); }
.word span:nth-child(3) { color: var(--g-text); }
.word span:nth-child(4) { color: var(--e); }
.top nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.top nav a {
  text-decoration: none;
  font-weight: 500;
  font-size: .95rem;
  color: var(--ink-2);
  padding: .5rem .85rem;
  border-radius: 999px;
  transition: background-color .2s, color .2s;
}
.top nav a:hover { background: var(--paper-2); color: var(--ink); }

/* ---------- hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  padding-block: clamp(2.5rem, 7vw, 6rem) clamp(3rem, 8vw, 7rem);
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1.25rem;
}
.eyebrow::before {
  content: "";
  width: 2.25rem;
  height: 2px;
  background: linear-gradient(90deg, var(--s) 25%, var(--a) 25% 50%, var(--g) 50% 75%, var(--e) 75%);
}
h1 {
  font: 800 clamp(2.5rem, 5.6vw, 4.6rem)/1.12 var(--display);
  letter-spacing: -.028em;
  margin: 0 0 1.5rem;
  text-wrap: balance;
}
/* Not italic: Thai has no italic, and a browser-slanted Thai glyph reads as a
   rendering fault rather than emphasis. Colour carries it instead. */
h1 em {
  font-style: normal;
  color: var(--g-text);
}
h1 .red { color: var(--s-text); }
.lede {
  font-size: clamp(1.08rem, 1.5vw, 1.25rem);
  color: var(--ink-2);
  max-width: 34rem;
  margin: 0 0 2.25rem;
}
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  min-height: 3.1rem;
  padding: .8rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  text-decoration: none;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), background-color .2s;
}
.btn-ink { background: var(--ink); color: var(--paper); box-shadow: 0 10px 24px -12px rgba(23, 19, 14, .6); }
.btn-ink:hover { transform: translateY(-2px); box-shadow: 0 18px 30px -14px rgba(23, 19, 14, .6); }
.btn-ink .arrow { transition: transform .35s var(--ease); }
.btn-ink:hover .arrow { transform: translateX(4px); }
.btn-line { border: 1.5px solid var(--rule); color: var(--ink); }
.btn-line:hover { background: var(--card); }
.btn:active { transform: translateY(0) scale(.98); }
/* One lead button per device. Without the script only the general one shows. */
.for-ios { display: none; }
[data-platform="ios"] .for-ios { display: inline-flex; }
[data-platform="ios"] .not-ios { display: none; }

/* The logo, pinned to the paper like a printed card. The artwork is already a
   white rounded tile, so it is the card: a second white frame around it read
   as a card inside a card. The shadow follows its alpha rather than a box. */
.mark {
  position: relative;
  justify-self: center;
  width: min(100%, 440px);
  --tile: 17%;
}
.mark .card {
  position: relative;
  z-index: 2;
  transform: rotate(-2.5deg);
  transition: transform .8s var(--ease);
}
.mark:hover .card { transform: rotate(0deg) translateY(-4px); }
.mark .card img {
  width: 100%;
  aspect-ratio: 912 / 848;
  filter: drop-shadow(0 26px 34px rgba(58, 40, 12, .28)) drop-shadow(0 2px 2px rgba(23, 19, 14, .12));
}
/* Two paper offsets behind the tile, in the infinity's red and blue. */
.mark::before, .mark::after {
  content: "";
  position: absolute;
  inset: 2% 2%;
  border-radius: var(--tile);
  z-index: 1;
}
.mark::before { background: var(--s); transform: rotate(4deg) translate(14px, 10px); opacity: .9; }
.mark::after { background: var(--g); transform: rotate(-7deg) translate(-12px, 16px); opacity: .85; z-index: 0; }
.mark figcaption {
  position: absolute;
  z-index: 3;
  bottom: -1.1rem;
  left: 50%;
  transform: translateX(-50%) rotate(1.5deg);
  background: var(--e);
  color: #2a1d02;
  font: 600 .8rem/1 var(--body);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: .55rem .9rem;
  border-radius: 6px;
  white-space: nowrap;
}

/* ---------- the infinity band ---------- */
.band {
  position: relative;
  z-index: 1;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  padding-block: clamp(3rem, 7vw, 5.5rem);
}
.band svg {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(1400px, 160%);
  transform: translate(-50%, -50%);
  opacity: .22;
}
.band path { fill: none; stroke-width: 34; stroke-linecap: round; }
.band .loop-r { stroke: var(--s); }
.band .loop-b { stroke: var(--g); }
.band blockquote {
  position: relative;
  margin: 0 auto;
  max-width: 50rem;
  text-align: center;
  font: 600 clamp(1.6rem, 3.4vw, 2.6rem)/1.35 var(--display);
  text-wrap: balance;
}
.band blockquote span { color: var(--e); }

/* ---------- sections ---------- */
section { padding-block: clamp(4rem, 9vw, 7.5rem); position: relative; z-index: 1; }
.kicker {
  font: 600 .8rem/1 var(--body);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 0 0 1rem;
}
h2 {
  font: 800 clamp(2rem, 4vw, 3.1rem)/1.15 var(--display);
  letter-spacing: -.022em;
  margin: 0 0 1rem;
  text-wrap: balance;
}
.section-lede { color: var(--ink-2); max-width: 40rem; margin: 0 0 3rem; }

/* Product: one wide card, screenshot bleeding off the right edge. */
.product {
  display: grid;
  grid-template-columns: .85fr 1.15fr;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.product .text { padding: clamp(1.75rem, 4vw, 3.25rem); display: flex; flex-direction: column; }
.product h3 { font: 800 clamp(1.8rem, 3vw, 2.4rem)/1.15 var(--display); margin: 0 0 .75rem; }
.product h3 .s { color: var(--s); }
.product h3 .h { color: var(--e); }
.product h3 .o { color: var(--g-text); }
.product h3 .w { color: #1fa64a; }
.product p { color: var(--ink-2); margin: 0 0 1.5rem; }
.platforms { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; gap: .5rem; }
.platforms a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  text-decoration: none;
  padding: .85rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 14px;
  font-weight: 500;
  transition: border-color .2s, transform .35s var(--ease), background-color .2s;
}
.platforms a:hover { border-color: var(--ink-3); transform: translateX(4px); background: var(--paper); }
.platforms small { color: var(--ink-3); font-size: .85rem; }
.platforms .soon {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem; border: 1px dashed var(--rule); border-radius: 14px;
  font-weight: 500; color: var(--ink-3);
}
/* The visitor's own platform first (see /platform.js); without the script the
   list keeps its written order. */
.platforms li { display: block; }
.platforms { display: flex; flex-direction: column; }
[data-platform="ios"] .platforms [data-for="ios"],
[data-platform="android"] .platforms [data-for="android"],
[data-platform="windows"] .platforms [data-for="windows"] { order: -1; }
[data-platform="ios"] .platforms [data-for="ios"] a,
[data-platform="windows"] .platforms [data-for="windows"] a { border-color: var(--ink); border-width: 1.5px; }
.product .text .btn { margin-top: auto; align-self: flex-start; }
/* The screenshot is shown whole. It used to bleed off the card's right edge,
   which cut off the weather card and the window's own edge — the product is
   the point of the picture, so none of it is cropped. */
.product .shot {
  background: linear-gradient(135deg, var(--paper-2), var(--card));
  padding: clamp(1.25rem, 3vw, 2.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}
.product .shot img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--rule);
  box-shadow: 0 30px 60px -30px rgba(23, 19, 14, .45);
}

/* Ecosystem: one card per product, status first. Status is a word and a shape
   as well as a colour: filled dot for live, ring for demo, dashed ring and a
   dashed card for coming soon. */
.eco-section { padding-bottom: 0; }
.eco { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.eco-card { position: relative; display: flex; flex-direction: column; gap: .45rem; padding: 1.5rem 1.4rem 1.3rem; border: 1px solid var(--rule); border-radius: 22px; background: var(--card); text-decoration: none; transition: transform .45s var(--ease), box-shadow .45s var(--ease), border-color .2s; }
.eco-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--ink-3); }
.eco-card img { width: 56px; height: 56px; border-radius: 14px; margin-bottom: .5rem; }
.eco-card h3 { margin: 0; font: 800 1.35rem/1.25 var(--display); }
.eco-card p { margin: 0; color: var(--ink-2); font-size: .98rem; }
.eco-meta { color: var(--ink-3); font-size: .86rem; }
.eco-go { margin-top: auto; padding-top: .9rem; font-weight: 600; font-size: .9rem; color: var(--g-text); }
.eco-status { position: absolute; top: 1.3rem; right: 1.2rem; display: inline-flex; align-items: center; gap: .4rem; font-size: .78rem; font-weight: 600; color: var(--ink-2); }
.eco-status i { width: .6rem; height: .6rem; border-radius: 50%; }
.live .eco-status i { background: #1fae4b; }
.demo .eco-status i { border: 2px solid var(--e); }
.soon .eco-status i { border: 2px dashed var(--ink-3); }
.eco-card.soon { background: transparent; border-style: dashed; }
@media (max-width: 1000px) { .eco { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .eco { grid-template-columns: 1fr; } }

/* Principles: three numbered columns, each numeral in one of the logo's inks. */
.principles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
}
.principles li { padding: 2rem 2rem 0 0; }
.principles li + li { padding-left: 2rem; border-left: 1px solid var(--rule); }
.principles .n {
  display: block;
  font: 800 3.5rem/1 var(--display);
  margin-bottom: 1rem;
}
.principles li:nth-child(1) .n { color: var(--s-text); }
.principles li:nth-child(2) .n { color: var(--a); }
.principles li:nth-child(3) .n { color: var(--g-text); }
.principles h3 { font: 800 1.35rem/1.3 var(--display); margin: 0 0 .5rem; }
.principles p { color: var(--ink-2); margin: 0; }

/* ---------- footer ---------- */
footer { position: relative; z-index: 1; border-top: 1px solid var(--rule); padding-block: 2.5rem 3rem; color: var(--ink-3); font-size: .9rem; }
footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
footer nav { display: flex; flex-wrap: wrap; gap: 1.25rem; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- load choreography ---------- */
@media (prefers-reduced-motion: no-preference) {
  .rise { opacity: 0; transform: translateY(18px); animation: rise .9s var(--ease) forwards; }
  .d1 { animation-delay: .05s; }
  .d2 { animation-delay: .15s; }
  .d3 { animation-delay: .25s; }
  .d4 { animation-delay: .35s; }
  .mark { opacity: 0; animation: drop 1.1s var(--ease) .2s forwards; }
  .band path { stroke-dasharray: 3200; stroke-dashoffset: 3200; animation: draw 3.2s var(--ease) .3s forwards; }
  @keyframes rise { to { opacity: 1; transform: none; } }
  @keyframes drop { from { opacity: 0; transform: translateY(-24px) scale(.96); } to { opacity: 1; transform: none; } }
  @keyframes draw { to { stroke-dashoffset: 0; } }
}

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .mark { order: -1; width: min(78%, 360px); margin-bottom: 1.5rem; }
  .product { grid-template-columns: 1fr; }
  .principles { grid-template-columns: 1fr; }
  .principles li, .principles li + li { padding: 1.75rem 0; border-left: 0; }
  .principles li + li { border-top: 1px solid var(--rule); }
}
@media (max-width: 560px) {
  .top nav a:not(.primary) { display: none; }
}

/* ------------------------------------------------------------------ doc ---
   The written pages — about and the questions. Same paper and ink as the
   home page, set narrow so a long Thai paragraph stays readable. */
.doc { width: min(46rem, calc(100% - 2.5rem)); margin: clamp(2rem, 5vw, 3.5rem) auto 0; position: relative; z-index: 1; }
.doc .crumb { margin: 0 0 1rem; color: var(--ink-3); font-size: .9rem; }
.doc .crumb a { color: inherit; text-decoration: none; }
.doc .crumb a:hover { color: var(--ink); }
.doc h1 { font: 800 clamp(1.9rem, 4.4vw, 2.9rem)/1.22 var(--display); letter-spacing: -.02em; margin: 0 0 1rem; text-wrap: balance; }
.doc h2 { font: 800 clamp(1.3rem, 2.4vw, 1.7rem)/1.3 var(--display); margin: 2.6rem 0 .6rem; }
.doc .lede { font-size: 1.1rem; color: var(--ink-2); line-height: 1.85; margin: 0 0 1.5rem; }
.doc p { color: var(--ink-2); line-height: 1.9; margin: 0 0 .9rem; }
.doc strong { color: var(--ink); }
.doc a { color: var(--a); }
.doc a:hover { text-decoration: underline; }
