/* Expandr — holding page */

:root{
  --cream:      #FAF3E6;
  --cream-2:    #F3E8D4;
  --ink:        #2E2118;
  --ink-soft:   #6B5748;
  --rust:       #A8511F;
  --rust-deep:  #8A3F16;
  --rust-soft:  #C9702F;
  --line:       #E2D2B7;
  --panel:      #FFFCF6;
  --shadow:     18px 40px -28px rgba(80, 44, 20, .45);
  --radius:     14px;
  --ink-hover:  #140F0A;

  /* One content column, one gutter, shared by header, main and footer.
     .wrap and .bar-inner carry the gutter as padding (box-sizing: border-box),
     so their max-width has to include it to end up the same width as the
     footer's inner column. */
  --measure:    39rem;
  --gutter:     1.5rem;
  --sans:       -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto,
                "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark){
  :root{
    --cream:    #1E1710;
    --cream-2:  #2A2019;
    --ink:      #F3E7D4;
    --ink-hover:#FFFBF2;
    --ink-soft: #B9A48D;
    --rust:     #E2914F;
    --rust-deep:#F0A868;
    --rust-soft:#C9702F;
    --line:     #3B2E23;
    --panel:    #261D16;
    --shadow:   18px 40px -28px rgba(0, 0, 0, .7);
  }
}

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

/* Text links take the colour of the text around them — no browser blue, and
   no separate :visited colour — and darken on hover. Buttons (.download)
   set their own colour and are unaffected. */
a{
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:visited{ color: inherit; }
a:hover,
a:focus-visible{ color: var(--ink-hover); }

html{ -webkit-text-size-adjust: 100%; }

body{
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.6;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

.glow{
  position: fixed;
  inset: -20vh 0 auto 0;
  height: 70vh;
  pointer-events: none;
  background:
    radial-gradient(50% 55% at 50% 0%, rgba(201,112,47,.20), rgba(201,112,47,0) 70%);
}
@media (prefers-color-scheme: dark){
  .glow{ background: radial-gradient(50% 55% at 50% 0%, rgba(201,112,47,.16), rgba(201,112,47,0) 70%); }
}

.wrap{
  position: relative;
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(2.4rem, 7vw, 4rem) var(--gutter) 3rem;
}

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

.bar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--cream) 84%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease;
}
/* the rule only appears once there is something scrolled underneath it */
.bar.is-stuck{ border-bottom-color: var(--line); }

.bar-inner{
  max-width: calc(var(--measure) + var(--gutter) * 2);
  margin: 0 auto;
  padding: .7rem var(--gutter);
  display: flex;
  align-items: center;
  gap: .7rem;
}

.brand{
  display: flex;
  align-items: center;
  gap: .7rem;
  text-decoration: none;
  color: inherit;
}

.mark{
  display: block;
  width: 40px; height: 40px;
  border-radius: 10px;
  box-shadow: 0 6px 18px -8px rgba(138,63,22,.7);
  flex: none;
}

.wordmark{
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: -.015em;
  font-variation-settings: "SOFT" 8, "opsz" 24;
}

.pill{
  margin-left: auto;
  font-family: var(--sans);
  font-weight: 600;
  font-size: .68rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--rust-deep);
  background: color-mix(in srgb, var(--rust-soft) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--rust-soft) 34%, transparent);
  border-radius: 999px;
  padding: .3rem .7rem;
  white-space: nowrap;
}

/* the version is nice-to-have — drop it before the nav gets squeezed */
@media (max-width: 27rem){
  .pill{ display: none; }
}

/* --- type -------------------------------------------------------------- */

h1{
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: clamp(2.3rem, 7.5vw, 3.6rem);
  line-height: 1.06;
  letter-spacing: -.025em;
  margin: 0 0 1.2rem;
  font-variation-settings: "SOFT" 12, "WONK" 1, "opsz" 100;
  text-wrap: balance;
}

.lede{
  font-size: 1.16rem;
  color: var(--ink-soft);
  margin: 0 0 clamp(2.4rem, 6vw, 3.4rem);
  max-width: 32rem;
  text-wrap: pretty;
}

/* --- demo -------------------------------------------------------------- */

.demo{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: clamp(2.4rem, 6vw, 3.4rem);
}

.demo-bar{
  display: flex;
  gap: .45rem;
  padding: .75rem .95rem;
  border-bottom: 1px solid var(--line);
  background: var(--cream-2);
}
.demo-bar i{
  width: 10px; height: 10px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--rust-soft) 45%, transparent);
}
.demo-bar i:nth-child(2){ background: color-mix(in srgb, var(--rust-soft) 30%, transparent); }
.demo-bar i:nth-child(3){ background: color-mix(in srgb, var(--rust-soft) 18%, transparent); }

.demo-body{
  padding: 1.4rem 1.25rem;
  position: relative;
  transition: min-height .3s ease;
  min-height: 9.5rem;   /* room for the tallest snippet, so nothing jumps */
  display: flex;
  align-items: flex-start;
}

.demo-out{
  margin: 0;
  font-size: 1.06rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}


.caret{
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -.16em;
  background: var(--rust);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink{ 50%{ opacity: 0; } }

.demo-note{
  margin: 0;
  padding: .8rem 1.25rem .95rem;
  border-top: 1px solid var(--line);
  background: var(--cream-2);
  font-size: .88rem;
  color: var(--ink-soft);
}

kbd{
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: .82em;
  color: var(--rust-deep);
  background: var(--panel);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: .1rem .4rem;
  margin: 0 .12rem;
}

/* --- the form dialog inside the demo ----------------------------------- */

.demo-stage{ display: none; width: 100%; }
.demo.form-open .demo-stage{ display: block; }
.demo.form-open .demo-out{ display: none; }

.demo-dialog{
  width: 100%;
  background: linear-gradient(155deg,
              color-mix(in srgb, var(--cream-2) 55%, var(--panel)),
              var(--cream-2));
  border: 1px solid color-mix(in srgb, var(--rust-soft) 22%, var(--line));
  border-radius: 14px;
  box-shadow: 0 20px 38px -28px rgba(80, 44, 20, .55);
  padding: 1.15rem 1.2rem 1rem;
  opacity: 0;
  transform: translateY(7px) scale(.985);
  transition: opacity .22s ease, transform .22s ease;
}
.demo-dialog.is-in{ opacity: 1; transform: none; }

.dlg-field{ margin-bottom: .95rem; position: relative; }
.dlg-field.is-open{ z-index: 2; }

.dlg-label{
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: .92rem;
  color: var(--rust-deep);
  margin-bottom: .3rem;
  font-variation-settings: "SOFT" 8, "opsz" 20;
}

.dlg-input{
  min-height: 2.5rem;
  background: var(--panel);
  border: 1.5px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 9px;
  padding: .55rem .65rem;
  font-size: .95rem;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.dlg-input.is-area{ min-height: 3.4rem; }

.dlg-input.is-select{
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink-soft);
}
.dlg-input.is-select.is-chosen{ color: var(--ink); }
.dlg-input.is-select{ padding-right: .4rem; position: relative; }

/* a tinted well with a chevron, so the control reads as a pop-up button */
.dlg-input.is-select::after{
  content: "";
  margin-left: auto;
  flex: none;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 6px;
  background: color-mix(in srgb, var(--rust-soft) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--rust-soft) 28%, transparent);
}
.dlg-input.is-select::before{
  content: "";
  position: absolute;
  top: 50%;
  right: calc(.4rem + .52rem);
  width: .36rem;
  height: .36rem;
  border-right: 1.7px solid var(--rust-deep);
  border-bottom: 1.7px solid var(--rust-deep);
  transform: translateY(-70%) rotate(45deg);
}

/* the open pop-up menu */
.dlg-menu{
  position: absolute;
  left: -1px;
  right: -1px;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid color-mix(in srgb, var(--rust-soft) 26%, var(--line));
  border-radius: 10px;
  box-shadow: 0 22px 40px -20px rgba(80, 44, 20, .6);
  padding: .3rem;
  opacity: 0;
  transform: translateY(-4px) scale(.99);
  transform-origin: top center;
  transition: opacity .16s ease, transform .16s ease;
}
.dlg-menu.is-in{ opacity: 1; transform: none; }

.dlg-option{
  font-size: .92rem;
  line-height: 1.3;
  color: var(--ink);
  padding: .42rem .55rem;
  border-radius: 7px;
}
.dlg-option.is-hot{
  background: var(--rust);
  color: #FFF7EA;
}
@media (prefers-color-scheme: dark){
  .dlg-option.is-hot{ color: #21160E; }
}

/* the field being filled, mirroring the app's focus ring */
.dlg-input.is-focused{
  border-color: var(--rust);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--rust-soft) 26%, transparent);
}
.dlg-caret{ vertical-align: -.14em; }

.dlg-actions{
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: .45rem;
  margin-top: .9rem;
}

.dlg-btn{
  font-family: var(--sans);
  font-weight: 600;
  font-size: .9rem;
  border-radius: 9px;
  padding: .45rem .95rem;
}
.dlg-cancel{ color: var(--ink-soft); }
.dlg-submit{
  color: #FFF7EA;
  background: var(--rust);
  box-shadow: 0 10px 18px -14px rgba(138, 63, 22, .95);
  transition: background .15s ease, transform .1s ease;
}
.dlg-submit.is-pressed{
  background: var(--rust-deep);
  transform: translateY(1px);
}
@media (prefers-color-scheme: dark){
  .dlg-submit{ color: #21160E; }
}

/* --- the insertion flourish -------------------------------------------- */

/* The expanded fragment drops in slightly oversized and settles, ringed by a
   brief glow and a scatter of sparks. */
.pop{
  display: inline-block;
  position: relative;
  animation: pop-settle .72s cubic-bezier(.18, .89, .28, 1) both;
}
.pop::after{
  content: "";
  position: absolute;
  inset: -2px -3px;
  border-radius: 6px;
  border: 1.5px solid color-mix(in srgb, var(--rust-soft) 70%, transparent);
  box-shadow: 0 0 16px 2px color-mix(in srgb, var(--rust-soft) 34%, transparent);
  pointer-events: none;
  animation: pop-ring 1.5s ease-out both;
}

/* a wider, softer halo pushing out past the ring */
.pop::before{
  content: "";
  position: absolute;
  inset: -16px -22px;
  border-radius: 16px;
  background: radial-gradient(closest-side,
              color-mix(in srgb, var(--rust-soft) 20%, transparent),
              transparent 78%);
  pointer-events: none;
  animation: pop-halo 1.7s ease-out both;
}
@keyframes pop-halo{
  0%   { opacity: 0; transform: scale(.72); }
  28%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.28); }
}

.pop.is-soft{ animation-name: pop-settle-soft; }

@keyframes pop-settle-soft{
  from{ transform: scale(1.05); }
  to  { transform: scale(1); }
}
@keyframes pop-settle{
  from{ transform: scale(1.16); }
  to  { transform: scale(1); }
}
@keyframes pop-ring{
  0%   { opacity: 0;  transform: scale(.94); }
  14%  { opacity: 1;  transform: scale(1); }
  60%  { opacity: .8; transform: scale(1.03); }
  100% { opacity: 0;  transform: scale(1.1); }
}

.spark{
  position: absolute;
  display: block;
  background: var(--rust-soft);
  /* a four-point star, drawn rather than typed — no font, no emoji fallback */
  -webkit-clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0;
  animation: spark-out 1.7s ease-out both;
}
@keyframes spark-out{
  0%   { opacity: 0; transform: scale(.15) translateY(6px)  rotate(-20deg); }
  22%  { opacity: 1; transform: scale(1)   translateY(0)    rotate(0deg); }
  60%  { opacity: .9; transform: scale(.9) translateY(-8px) rotate(12deg); }
  100% { opacity: 0; transform: scale(.4)  translateY(-20px) rotate(26deg); }
}

@media (prefers-reduced-motion: reduce){
  .pop, .pop::after, .pop::before, .spark{ animation: none; }
  .spark{ display: none; }
}

/* --- facts ------------------------------------------------------------- */

.facts{
  list-style: none;
  margin: 0 0 clamp(2.6rem, 7vw, 3.6rem);
  padding: 0;
  display: grid;
  gap: 1.6rem;
}
@media (min-width: 46rem){
  .facts{ grid-template-columns: repeat(3, 1fr); gap: 1.8rem; }
}

.facts li{
  font-size: .97rem;
  color: var(--ink-soft);
  line-height: 1.55;
  padding-top: .9rem;
  border-top: 1px solid var(--line);
}
.facts b{
  display: block;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: .3rem;
  font-variation-settings: "SOFT" 8, "opsz" 20;
}

/* --- download ----------------------------------------------------------- */

.download{
  display: inline-block;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -.005em;
  color: #FFF7EA;
  background: var(--rust);
  border: 0;                /* .download is used on both <a> and <button> */
  border-radius: 12px;
  padding: .85rem 1.6rem;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 12px 24px -16px rgba(138,63,22,.9);
  transition: background .15s, transform .08s;
}
.download:hover{ background: var(--rust-deep); }
.download:active{ transform: translateY(1px); }
.download:focus-visible{ outline: 2px solid var(--rust-deep); outline-offset: 3px; }
@media (prefers-color-scheme: dark){
  .download{ color: #21160E; }
}

/* On narrow screens the button spans the column — it reads as a proper tap
   target, and on the contact page it lines up with the full-width fields.
   Applies to the submit button too: it shares this class. */
@media (max-width: 30rem){
  .download{
    display: block;
    width: 100%;
    text-align: center;
  }
}

.meta{
  font-size: .9rem;
  line-height: 1.65;
  color: var(--ink-soft);
  margin: 1rem 0 0;
  max-width: 30rem;
}
.meta code{
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  font-size: .88em;
}

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

.site-foot{
  margin-top: clamp(3rem, 8vw, 4.5rem);
  padding: 0 var(--gutter) clamp(2.5rem, 6vw, 3.5rem);
}
.foot-inner{
  max-width: var(--measure);
  margin: 0 auto;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
}

.foot-line{
  margin: 0;
  font-size: .88rem;
  color: var(--ink-soft);
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}
.dot{ opacity: .5; }

/* the Espanso credit sits below the rule, quieter than the links above it */
.colophon{
  margin: .7rem 0 0;
  font-size: .8rem;
  line-height: 1.55;
  color: color-mix(in srgb, var(--ink-soft) 80%, transparent);
  max-width: 34rem;
}

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

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{ animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

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

.contact{ max-width: 30rem; }

.field{ margin-bottom: 1.15rem; }

.field label{
  display: block;
  font-family: var(--sans);
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: .35rem;
}

.field input,
.field textarea{
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: .7rem .85rem;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea{ resize: vertical; min-height: 8rem; line-height: 1.55; }

.field input:focus-visible,
.field textarea:focus-visible{
  outline: none;
  border-color: var(--rust-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--rust-soft) 22%, transparent);
}
.field [aria-invalid="true"]{ border-color: #C0563B; }

.field .err{
  font-family: var(--sans);
  font-size: .82rem;
  color: #B3462B;
  margin: .35rem 0 0;
}
@media (prefers-color-scheme: dark){
  .field .err{ color: #E8836A; }
}

/* honeypot — off-screen rather than display:none, which some bots skip */
.trap{
  position: absolute;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.notice{
  font-size: .95rem;
  line-height: 1.6;
  border-radius: 12px;
  padding: .9rem 1.1rem;
  margin: 0 0 1.5rem;
}
.notice-ok{
  background: color-mix(in srgb, var(--rust-soft) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--rust-soft) 30%, transparent);
}
.notice-bad{
  background: color-mix(in srgb, #C0563B 10%, transparent);
  border: 1px solid color-mix(in srgb, #C0563B 34%, transparent);
}
