/* 1Sense, concept B: a one-screen letter, after the layout of instinct.com.
   A look-and-feel study only. It is not part of the built site in public/. */

:root {
  --ink: #1f2322;
  --paper: #ffffff;
  --sand-100: #f4efec;
  --sand-400: #e1d5cd;
  --rule: rgba(31, 35, 34, 0.2);
  --error: #b3261e;

  /* Open stand-ins for the two commercial faces the reference uses. */
  --font-text: "Petrona", "Iowan Old Style", Georgia, serif;
  --font-small: "Instrument Sans", ui-sans-serif, system-ui, sans-serif;

  --text: 24px;
  --gap: calc(var(--text) * 1.9);
  --pop: linear(0, .092, .296, .528, .736, .897, 1.004, 1.063, 1.085, 1.084, 1.068, 1.049,
                1.029, 1.014, 1.003, .996, .993, .993, .993, .995, .997, .998, .999, 1);
  --hidden-scale: 0;
}

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

html, body { margin: 0; background: var(--paper); }

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding: 16px;
  color: var(--ink);
  font-family: var(--font-small);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
}

::selection { background: var(--sand-100); color: var(--ink); }

a { color: inherit; }

.small-link {
  position: relative;
  text-decoration: underline 1px var(--rule);
  text-underline-offset: calc(0.1em + 1px);
}
.small-link::after { content: ""; position: absolute; inset: -16px -8px; }

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

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 20px 16px;
}
.top-home { display: block; width: 28px; color: var(--ink); }
.top-home svg { display: block; width: 100%; height: auto; overflow: visible; }
.top-links {
  display: flex;
  gap: 24px;
  font-size: 13px;
  line-height: 1.02;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.top { position: relative; z-index: 10; }  /* keeps the open language menu above the letter */
.top-links { align-items: center; }

/* language menu */
.lang { position: relative; }
.lang summary {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  list-style: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: ""; position: absolute; inset: -16px -8px; }
.lang summary > span {
  text-decoration: underline 1px var(--rule);
  text-underline-offset: calc(0.1em + 1px);
}
.lang-code { display: none; }
.lang-caret { flex: none; width: 9px; height: 9px; transition: rotate .15s; }
.lang[open] .lang-caret { rotate: 180deg; }
.lang-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: -10px;
  z-index: 5;
  display: grid;
  gap: 2px;
  min-width: 136px;
  padding: 6px;
  border-radius: 9px;
  background: var(--sand-100);
  animation: reveal .25s cubic-bezier(.22, 1, .36, 1) both;
}
.lang-menu a {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: 5px;
  line-height: 1.2;
  text-decoration: none;
}
.lang-menu a[aria-current] { background: color-mix(in srgb, var(--sand-400) 55%, var(--sand-100)); }
.lang summary:focus-visible, .lang-menu a:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}
.lang-menu a:focus-visible { outline-offset: -1px; border-radius: 5px; }
@media (hover: hover) {
  .lang summary:hover > span { text-decoration-color: var(--ink); }
  .lang-menu a:hover { background: color-mix(in srgb, var(--sand-400) 55%, var(--sand-100)); }
}

@media (max-width: 23rem) {
  .top-links { gap: 18px; }
  .lang-name { display: none; }  /* very small phones: EN, DE, ... instead of the full name */
  .lang summary > .lang-code { display: inline; }
  .lang-menu { right: auto; left: -10px; }
}

/* ---------- the letter ---------- */

.home {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  gap: 64px;
  padding: 44px 16px 20px;
}

.letter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--gap);
  max-width: 41rem;
}
.letter > * {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--text);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-box: trim-both cap alphabetic;
}
.letter h1, .letter strong { font-weight: 600; }
.letter > * { max-width: 100%; overflow-wrap: break-word; }
:lang(de) .letter > *, :lang(nl) .letter > * { hyphens: auto; hyphenate-limit-chars: 12 5 5; }
.done { margin: 0; }

.asks { position: relative; }

.ask {
  cursor: pointer;
  text-decoration: underline 1px var(--rule);
  text-underline-offset: calc(0.1em + 1px);
  -webkit-tap-highlight-color: transparent;
}

.pop-anchor { position: absolute; left: var(--pop-x, 0); top: var(--pop-y, 0); }
.pop {
  position: absolute;
  bottom: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  width: 35.6px;
  height: 35.6px;
  border-radius: 50%;
  background: var(--sand-400);
  pointer-events: none;
  opacity: 0;
  scale: var(--hidden-scale);
  transform-origin: 0 100%;
  transition: scale .15s, opacity .15s;
}
.pop svg { display: block; width: 20px; height: 20px; scale: var(--hidden-scale); }

.ask.is-popping .pop { opacity: 1; scale: 1; transition: scale .5s var(--pop), opacity .12s; }
.ask.is-popping .pop svg { scale: 1; transition: scale .43s .07s var(--pop); }

/* ---------- call to action ---------- */

.cta {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  letter-spacing: inherit;
  text-decoration: none;
  cursor: pointer;
}
.brush { position: relative; isolation: isolate; }
.brush::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: auto 0 0.13em;
  height: 0.42em;
  background: color-mix(in srgb, var(--sand-400) 33%, var(--sand-100));
  -webkit-mask: var(--brush) center / 100% 100% no-repeat;
  mask: var(--brush) center / 100% 100% no-repeat;
  scale: 1.05;
  transition: background-color .15s;
  animation: brush-draw .7s cubic-bezier(.33, 1, .68, 1) calc(var(--i, 0) * 90ms + .25s) both;
  --brush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M3 8.500C22 3.500 48 6.200 88 4.600c40-1.500 82-2.800 109 1.200 2.400 3.400.600 7.800-2.200 10.600-33-2.600-74 1.300-113 .300-31-.700-58 2.700-78 .400C.600 14.500.400 11 3 8.500Z'/%3E%3C/svg%3E");
}
.chevron {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  margin-left: 0.1em;
  vertical-align: -0.18em;
}
.chevron svg { display: block; width: 100%; height: 100%; }

.join { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.7em 0.9em; width: 100%; }
.join[hidden], .cta[hidden], .done[hidden] { display: none; }
.join input[type="email"] {
  flex: 0 1 15em;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  box-shadow: 0 1px 0 var(--rule);
  transition: box-shadow .15s;
}
.join input[type="email"]:focus { box-shadow: 0 1px 0 var(--ink); }
.join input[type="email"]::placeholder { color: rgba(31, 35, 34, 0.38); }
.join.has-error input[type="email"] { box-shadow: 0 1px 0 var(--error); }
.join-error {
  flex-basis: 100%;
  margin: 0.9em 0 0;
  color: var(--error);
  font-family: var(--font-small);
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.join-error:empty { display: none; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

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

.legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  font-size: 13px;
  line-height: 1.02;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.legal p { margin: 0; }
.legal a[aria-current="page"] { text-decoration-color: var(--ink); }

/* ---------- legal pages ---------- */

.doc {
  max-width: 41rem;
  font-family: var(--font-text);
  font-size: 18px;
  line-height: 1.45;
  letter-spacing: -0.005em;
  overflow-wrap: break-word;
  animation: reveal .6s cubic-bezier(.22, 1, .36, 1) 90ms both;
}
.doc h1 { margin: 0; font-size: var(--text); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.doc h2 { margin: 0 0 0.5em; font-size: inherit; font-weight: 600; }
.doc section { margin-top: 2.1em; }
.doc section p { margin: 0.45em 0 0; }
.doc-note {
  margin: 1.4em 0 0;
  font-family: var(--font-small);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.doc .small-link { text-decoration-thickness: 1px; }
.todo { padding: 0.05em 0.3em; border-radius: 3px; background: var(--sand-400); color: inherit; }
.legal nav { display: flex; gap: 24px; }

/* ---------- entrance ---------- */

.top, .letter > *, .legal {
  animation: reveal .6s cubic-bezier(.22, 1, .36, 1) calc(var(--i, 0) * 90ms) both;
}
.letter > :nth-child(1) { --i: 1; }
.letter > :nth-child(2) { --i: 2; }
.letter > :nth-child(3) { --i: 3; }
.letter > :nth-child(4) { --i: 4; }
.legal { --i: 5; }

@keyframes reveal { from { opacity: 0; translate: 0 8px; } }
@keyframes reveal-fade { from { opacity: 0; } }
@keyframes brush-draw { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0); } }

@media (hover: hover) {
  .small-link:hover, .ask:hover { text-decoration-color: var(--ink); }
  .ask:hover .pop { opacity: 1; scale: 1; transition: scale .5s var(--pop), opacity .12s; }
  .ask:hover .pop svg { scale: 1; transition: scale .43s .07s var(--pop); }
  .cta:hover .brush::before { background: color-mix(in srgb, var(--sand-400) 67%, var(--sand-100)); }
}

.cta:focus-visible, .small-link:focus-visible, .top-home:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
  border-radius: 2px;
}

@media (min-width: 80rem) {
  .top { padding: 20px 20px 0; }
  .top-home { width: 34px; }
  .home { padding: 64px 20px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  :root { --hidden-scale: 1; }
  .top, .letter > *, .legal, .doc { animation: reveal-fade .3s ease both; }
  .brush::before { animation: none; }
}

.join[aria-busy="true"] .cta { opacity: 0.5; cursor: progress; }
