/* ==========================================================================
   CUSTOMER WEBSHOP — STYLES
   ==========================================================================
   Who this is for: someone who may not have stood at this grave in years, or
   ever. Often far away. Often older, on a phone, in the evening.

   The partner portal is a work tool in daylight and reads accordingly: white
   paper, high contrast, big blunt buttons. This surface is its opposite. It is
   dusk in a Finnish cemetery in November, when the candles are lit — deep
   spruce-charcoal, generous space, and one small warm flame.

   The palette is the same family so it is recognisably one company. The
   feeling is not.
   ========================================================================== */

:root {
  --dusk:      #202B27;   /* spruce at nightfall — the hero and the closing */
  --dusk-soft: #2C3A34;
  --snow:      #F3F4F0;   /* granite-tinted daylight for the working steps */
  --card:      #FFFFFF;
  --ink:       #242E2A;
  --granite:   #5E6863;
  --spruce:    #2C4A3E;
  --spruce-dim:#E9EDE6;
  --flame:     #E4A54B;
  --flame-soft:#F4D9AC;
  --flame-dim: #FBF3E4;
  --alert:     #8A4B2D;
  --alert-dim: #F6EEE7;
  --rule:      #E1E3DD;

  --tap: 48px;
  --radius: 16px;
  --radius-lg: 22px;

  /* Layered and warm-tinted, never a flat grey drop shadow. */
  --lift:    0 1px 3px rgba(32,43,39,.05), 0 8px 22px rgba(32,43,39,.08);
  --lift-lg: 0 2px 6px rgba(32,43,39,.07), 0 18px 44px rgba(32,43,39,.14);

  --sans: 'Schibsted Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--snow);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;              /* generous: this is read slowly */
  -webkit-font-smoothing: antialiased;
}

.shell { max-width: 460px; margin: 0 auto; min-height: 100vh; }

/* --- Header ------------------------------------------------------------- */
.bar { padding: 16px 20px 8px; }
.bar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.wordmark {
  font-family: var(--display); font-weight: 600; font-size: 19px;
  letter-spacing: -.02em; color: var(--ink);
  background: none; border: 0; padding: 0 2px; cursor: pointer; min-height: 44px;
}
.wordmark .dot { color: var(--flame); }
.bar.on-dusk .wordmark { color: #F5F2EA; }

.back {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; cursor: pointer;
  font-family: var(--sans); font-size: 14px; color: var(--granite);
  min-height: 44px; padding: 0 6px 0 0;
}

/* Language switcher: own names, never flags, on every screen. */
.langs { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.langs button {
  background: none; border: 0; cursor: pointer;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--granite); padding: 6px 9px; border-radius: 8px; min-height: 44px;
}
.langs button[aria-current='true'] { color: var(--ink); font-weight: 700; }
.bar.on-dusk .langs button { color: #8E9C93; }
.bar.on-dusk .langs button[aria-current='true'] { color: #F5F2EA; }
.langs .sep { color: #B6BDB7; font-size: 11px; }

/* --- The candle ---------------------------------------------------------
   The one piece of illustration in the product, drawn rather than
   photographed: no stock image of a real grave, ever. It breathes slowly.
   ---------------------------------------------------------------------- */
.candle { display: flex; flex-direction: column; align-items: center; }
.candle .halo {
  position: absolute; width: 108px; height: 108px; top: -30px; border-radius: 50%;
  background: radial-gradient(circle, rgba(228,165,75,.55) 0%, rgba(228,165,75,.17) 45%, rgba(228,165,75,0) 70%);
  animation: breathe 2.8s ease-in-out infinite;
}
.candle .flame {
  position: absolute; bottom: 9px; width: 20px; height: 34px;
  background: radial-gradient(ellipse at 50% 78%, #FFF7E4 0%, #F7CE8B 42%, #E4A54B 68%, rgba(228,165,75,0) 100%);
  border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%;
  animation: flicker 2.8s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.candle .top { position: relative; display: flex; justify-content: center; width: 68px; height: 84px; }
.candle .wick { position: absolute; bottom: 7px; width: 2px; height: 7px; background: #4A3A28; border-radius: 2px; }
.candle .body {
  width: 38px; height: 52px; border-radius: 7px;
  background: linear-gradient(180deg, #F1EADB 0%, #E4DBC7 100%);
  box-shadow: inset 0 -10px 14px rgba(0,0,0,.10);
}
@keyframes flicker {
  0%,100% { transform: scaleY(1) skewX(0); opacity: 1; }
  30% { transform: scaleY(1.05) skewX(-1.5deg); opacity: .96; }
  60% { transform: scaleY(.95) skewX(1.3deg); opacity: 1; }
}
@keyframes breathe { 0%,100% { opacity: .9 } 50% { opacity: .62 } }

/* --- Hero and closing: the two dusk moments ----------------------------- */
.dusk {
  background: var(--dusk);
  border-radius: 0 0 28px 28px;
  padding: 4px 22px 40px;
  color: #F5F2EA;
}
.hero-title {
  font-family: var(--display); font-weight: 500; font-size: 31px;
  line-height: 1.22; letter-spacing: -.03em;
  margin: 26px 0 0;
}
.hero-sub { color: #B9C4BB; font-size: 16px; margin: 12px 0 0; }

/* --- Working pages ------------------------------------------------------ */
.page { padding: 6px 20px 40px; }

h1.title {
  font-family: var(--display); font-weight: 600; font-size: 25px;
  letter-spacing: -.03em; margin: 6px 0 4px;
}
.sub { color: var(--granite); font-size: 14px; margin: 0 0 18px; }

.card {
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--radius-lg); box-shadow: var(--lift);
  padding: 17px; margin-bottom: 12px;
}
.muted { color: var(--granite); font-size: 14px; }
.tiny  { color: var(--granite); font-size: 12.5px; line-height: 1.55; }

/* Progress: four steps, filled with a transform so nothing reflows. */
.progress { padding: 0 20px 4px; }
.progress-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 7px; }
.progress-row .n { color: var(--granite); font-weight: 500; }
.progress-row .s { color: var(--spruce); font-weight: 600; }
.progress-track { height: 3px; border-radius: 999px; background: var(--rule); overflow: hidden; }
.progress-fill {
  height: 3px; border-radius: 999px; background: var(--spruce);
  transform-origin: left; transition: transform .4s ease-out;
}

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; border: 0; border-radius: var(--radius);
  font-family: var(--sans); font-size: 16px; font-weight: 600; cursor: pointer;
  transition: background-color .25s ease-out, transform .12s ease-out;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--spruce); color: #fff; }
.btn-primary:hover { background: #24402F; }
.btn-primary:disabled { background: #BAC2BC; cursor: not-allowed; }
.btn-flame { background: var(--flame); color: var(--dusk); box-shadow: 0 4px 16px rgba(228,165,75,.26); }
.btn-flame:hover { background: #DC9C3D; }
.btn-quiet { background: var(--card); color: var(--ink); border: 1.5px solid var(--rule); }
.btn-quiet:hover { background: #FAFAF7; }
.btn-ghost { background: transparent; color: var(--granite); border: 1.5px solid var(--rule); }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

:where(button, a, input, select, textarea):focus-visible {
  outline: 3px solid var(--flame); outline-offset: 2px;
}

/* --- Forms -------------------------------------------------------------- */
.field { display: block; margin-bottom: 15px; }
.field .label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.field .help { display: block; font-size: 12.5px; color: var(--granite); margin-bottom: 6px; }
input[type='text'], input[type='email'], input[type='date'], textarea {
  width: 100%; min-height: var(--tap); padding: 13px 15px;
  border: 1.5px solid var(--rule); border-radius: var(--radius);
  background: #fff; color: var(--ink);
  font-family: var(--sans); font-size: 16px;   /* 16px: stops iOS zooming */
}
textarea { min-height: 92px; resize: vertical; line-height: 1.65; }
input:focus, textarea:focus {
  border-color: var(--spruce); box-shadow: 0 0 0 3px rgba(44,74,62,.12); outline: none;
}
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* --- Search results ----------------------------------------------------- */
.result {
  width: 100%; text-align: left; background: var(--card);
  border: 1.5px solid var(--rule); border-radius: var(--radius-lg);
  box-shadow: var(--lift); padding: 16px; margin-bottom: 11px; cursor: pointer;
  font-family: var(--sans); color: var(--ink);
  transition: border-color .2s ease-out;
}
.result:hover { border-color: var(--spruce); }
.result .nm { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.result .also { font-size: 13px; color: var(--granite); }
.result .go { color: var(--spruce); font-size: 13px; font-weight: 600; margin-top: 9px; display: block; }

/* --- THE DESCENT --------------------------------------------------------
   Seven seconds, four stages. The long duration is a deliberate exception to
   the 300–600 ms house rule and is explained in map.js. The frame is dusk so
   the arrival feels like evening rather than a dashboard.
   ---------------------------------------------------------------------- */
.map-frame {
  position: relative; height: 62vh; min-height: 380px; max-height: 520px;
  border-radius: var(--radius-lg); overflow: hidden;
  background: var(--dusk); box-shadow: var(--lift-lg);
}
.map-stage { width: 100%; height: 100%; will-change: transform; }
.map-label {
  position: absolute; left: 14px; top: 14px;
  background: rgba(32,43,39,.82); color: #E6EAE4;
  border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 500;
}
.map-skip {
  position: absolute; right: 14px; bottom: 14px;
  background: rgba(255,255,255,.94); color: var(--ink);
  border: 0; border-radius: 999px; padding: 0 18px; min-height: 44px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.map-note { position: absolute; left: 14px; right: 14px; bottom: 14px; text-align: center; }
.map-note span {
  background: rgba(32,43,39,.82); color: #D8DED6;
  border-radius: 999px; padding: 5px 13px; font-size: 11.5px;
}

/* The confirmation card fades up only once the camera has stopped. */
.confirm { animation: arrive .5s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.person + .person { border-top: 1px solid #F0F1EC; margin-top: 11px; padding-top: 11px; }
.person .nm { font-family: var(--display); font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.person .dt { font-size: 13.5px; color: var(--granite); }

.notice { border-radius: var(--radius); padding: 13px 15px; font-size: 13.5px; line-height: 1.55; }
.notice-soft { background: var(--spruce-dim); color: var(--ink); }
.notice-warm { background: var(--flame-dim); color: #7A5A21; }
.notice-alert { background: var(--alert-dim); color: var(--alert); }

/* --- Packages and the grave scene --------------------------------------- */
.pkg {
  width: 100%; text-align: left; display: flex; gap: 14px; align-items: flex-start;
  background: var(--card); border: 2px solid var(--rule); border-radius: var(--radius-lg);
  padding: 15px; margin-bottom: 11px; cursor: pointer; font-family: var(--sans); color: var(--ink);
  transition: border-color .2s ease-out;
}
.pkg[aria-pressed='true'] { border-color: var(--spruce); box-shadow: var(--lift); }
.pkg .ic {
  width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--spruce-dim); font-size: 20px;
}
.pkg[aria-pressed='true'] .ic { background: var(--dusk); color: var(--flame); }
.pkg .nm { font-weight: 700; }
.pkg .pr { color: var(--spruce); font-weight: 700; font-size: 14px; white-space: nowrap; }

.scene { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--lift-lg); position: relative; }
.spot-hit {
  position: absolute; width: 48px; height: 48px; transform: translate(-50%,-50%);
  background: transparent; border: 0; border-radius: 50%; padding: 0; cursor: pointer;
}

/* --- Item rows and money ------------------------------------------------ */
.line { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 15px; }
.line + .line { border-top: 1px solid #F0F1EC; }
.line .val { font-weight: 600; white-space: nowrap; }
.line.total { font-weight: 700; font-size: 17px; padding-top: 13px; border-top: 1px solid var(--rule); }
.line.total .val { font-family: var(--display); font-size: 23px; color: var(--spruce); }

/* The seller is named before purchase and on every document — it is never
   folded into "muistaen.fi". */
.seller {
  display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--granite); margin-top: 3px;
}
.seller .co { font-weight: 600; color: var(--ink); }

.chip {
  min-height: 44px; padding: 9px 15px; border: 1.5px solid var(--rule); border-radius: 999px;
  background: #fff; color: var(--ink); font-family: var(--sans); font-size: 14px;
  font-weight: 500; cursor: pointer;
}
.chip[aria-pressed='true'] { background: var(--spruce); border-color: var(--spruce); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.choice {
  width: 100%; text-align: left; background: var(--card);
  border: 2px solid var(--rule); border-radius: var(--radius); padding: 14px 15px;
  cursor: pointer; font-family: var(--sans); color: var(--ink); min-height: var(--tap);
}
.choice[aria-pressed='true'] { border-color: var(--spruce); }
.choice .t { font-weight: 600; font-size: 14.5px; }
.choice .d { font-size: 12.5px; color: var(--granite); }

.check { display: flex; gap: 12px; align-items: flex-start; text-align: left; }
.check .box {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; margin-top: 2px;
  border: 1.5px solid #AEB6B0; background: #fff;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px; line-height: 1;
}
.check[aria-pressed='true'] .box { background: var(--spruce); border-color: var(--spruce); }

.steps-list { margin: 0; padding: 0; list-style: none; }
.steps-list li { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px; }
.steps-list .n {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--dusk); color: var(--flame-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}
.steps-list .n.done { background: var(--spruce); color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  max-width: 420px; width: calc(100% - 40px);
  background: var(--dusk); color: #F3F4F0; border-radius: var(--radius);
  padding: 13px 16px; font-size: 14px; box-shadow: var(--lift-lg); z-index: 50;
  animation: arrive .3s ease-out both;
}

.demo {
  background: var(--dusk); color: #B9C4BB;
  font-size: 11.5px; text-align: center; padding: 7px 14px;
}

/* Everything stops when the system asks for less movement — including the
   descent, which is skipped entirely in map.js. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* --- iOS: living under the notch ---------------------------------------
   viewport-fit=cover lets the dusk hero run to the very top of the screen,
   which is the point — but the content inside it must not. These insets are
   zero on every other device, so there is nothing to undo elsewhere.
   ---------------------------------------------------------------------- */
.bar { padding-top: calc(16px + env(safe-area-inset-top)); }
.dusk { padding-left: calc(22px + env(safe-area-inset-left));
        padding-right: calc(22px + env(safe-area-inset-right)); }
.page { padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
        padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(22px + env(safe-area-inset-bottom)); }

/* Safari's rubber-band scroll shows the page background behind the dusk hero,
   which looks like a rendering fault. Painting the body dusk hides the seam. */
body { background: var(--snow); overscroll-behavior-y: none; }

/* In standalone mode there is no browser chrome to fall back on, so a stray
   long-press selection is harder to escape. Text the customer wrote stays
   selectable; the furniture does not. */
@media (display-mode: standalone) {
  body { -webkit-user-select: none; user-select: none; }
  input, textarea, .greeting, .person, .line { -webkit-user-select: text; user-select: text; }
}
