@font-face {
  font-family: "JFP Lilita";
  src: url("assets/lilita-one.ttf") format("truetype");
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #0d111a;
  font-family: system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
body {
  --ink: #f1f5ff;
  --secondary: #b3bdd0;
  --solid: #151b29;
  --line: #353e50;
  --blue: #a3d9ff;
  --pink: #ffc0e0;
  --accent: var(--blue);
  --accent-rgb: 149 209 253;
  --glow-rgb: 60 105 172;
  --active-ink: #121c2a;
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse min(74vw, 470px) 320px at 50% -30px, rgb(var(--glow-rgb) / .54), transparent 100%),
    linear-gradient(165deg, #151926 0, #0d111a 65%);
}
body[data-design="selva"] {
  --accent: var(--pink);
  --accent-rgb: 249 171 213;
  --glow-rgb: 137 63 111;
  --active-ink: #2c1827;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.workbench {
  width: min(calc(100% - 16px), 30rem);
  margin-inline: auto;
  padding-block: clamp(10px, 2.1vh, 24px) 24px;
}
.design-switch {
  isolation: isolate;
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(100%, 17.5rem);
  margin: 0 auto 10px;
  padding: 4px;
  border: 1px solid rgb(var(--accent-rgb) / .22);
  border-radius: 15px;
  background: #101624;
  box-shadow: 0 0 40px -14px rgb(var(--accent-rgb) / .58);
}
.design-switch::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 4px auto 4px 4px;
  width: calc(50% - 4px);
  border-radius: 11px;
  background: var(--accent);
  box-shadow: 0 0 14px rgb(var(--accent-rgb) / .28);
  transition: transform .24s cubic-bezier(.22,.74,.27,1), background-color .2s ease;
}
[data-design="selva"] .design-switch::before { transform: translateX(100%); }
.design-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 7px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--ink);
  font-size: .94rem;
  font-weight: 720;
}
.design-switch button[data-design="expedicion"] svg { color: var(--blue); }
.design-switch button[data-design="selva"] svg { color: var(--pink); }
.design-switch button[aria-pressed="true"], .design-switch button[aria-pressed="true"] svg { color: var(--active-ink); }

.preview {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding-bottom: 45px;
  border: 1px solid rgb(var(--accent-rgb) / .31);
  border-radius: clamp(14px, 3.7vw, 24px);
  background: #131b15;
  box-shadow: 0 10px 28px #080a1094, 0 0 20px rgb(var(--accent-rgb) / .09);
}
.open-preview {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  cursor: zoom-in;
}
.open-preview:focus-visible { outline-offset: -3px; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 4; }
.export-tools {
  position: absolute;
  inset: auto 8px 8px auto;
  display: flex;
  gap: 3px;
  padding: 4px;
  border: 1px solid rgb(var(--accent-rgb) / .35);
  border-radius: 14px;
  background: #111622f2;
  box-shadow: 0 5px 18px #0008;
}
.is-ready .export-tools { animation: arrive .42s cubic-bezier(.22,.74,.27,1) both; }
.is-ready #download svg { animation: download-hop .48s ease-in-out .38s both; }
.export-tools button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: var(--accent);
  background: transparent;
  transition: background-color .15s ease, transform .15s ease;
}
.export-tools button:hover:not(:disabled) { background: rgb(var(--accent-rgb) / .16); }
.export-tools button:active:not(:disabled) { transform: scale(.91); }
.export-tools button:disabled { opacity: .55; }
#share { background: var(--accent); color: var(--active-ink); }
#share:hover:not(:disabled) { background: color-mix(in srgb, var(--accent), white 19%); }
@keyframes arrive {
  from { opacity: .36; transform: translateY(7px) scale(.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes download-hop {
  0%, 100% { transform: translateY(0); }
  42% { transform: translateY(-5px); }
  75% { transform: translateY(1px); }
}

#invitation { margin: 13px auto 0; width: 100%; }
.fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.fields label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  font-size: .91rem;
  font-weight: 670;
}
.name-field, .date-field { grid-column: 1 / -1; }
.input-shell {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-inline: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--solid);
}
.input-shell:focus-within {
  border-color: var(--accent);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.input-shell svg {
  color: var(--accent);
  pointer-events: none;
}
.input-shell input {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  margin: 0;
  /* The shell owns the padding since iOS can add input padding to 100% width. */
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-size: max(17px, 1rem);
  font-weight: 520;
}
.input-shell input::placeholder { color: var(--secondary); opacity: 1; }
.input-shell input:focus { outline: none; }
.picker { grid-template-columns: minmax(0, 1fr) 20px; }
.picker input { -webkit-appearance: none; appearance: none; }
.picker input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0 3px 0 auto;
  width: 32px;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.picker input::-webkit-date-and-time-value { min-width: 0; margin: 0; text-align: start; }
.message { margin: 10px 0 0; color: var(--secondary); font-size: .89rem; }
.message:empty { display: none; }

dialog {
  max-width: calc(100% - 14px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--solid);
  color: var(--ink);
}
dialog::backdrop { background: #06080ce5; }
dialog form { display: flex; justify-content: flex-end; margin-bottom: 7px; }
dialog button { min-height: 38px; padding-inline: 12px; border: 0; border-radius: 9px; background: var(--accent); color: var(--active-ink); }
dialog canvas { width: min(86vw, calc((91dvh - 64px) * .75)); border-radius: 8px; }

@media (min-width: 761px) {
  .workbench { width: clamp(325px, calc((100svh - 355px) * .75), 480px); }
  .export-tools { inset: auto 11px 11px auto; }
  #invitation { width: calc(100% - 22px); }
}
@media (prefers-reduced-motion: reduce) {
  .design-switch::before, .export-tools button { transition: none; }
  .is-ready .export-tools, .is-ready #download svg { animation: none; }
}
