/* Butter's welcome: the painted landing, then the sign-up card. Everything is scoped to #welcome so
   the workspace styles in style.css (which style every button, input and label) don't leak in. */
@import url("https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300..700;1,300..700&family=Bricolage+Grotesque:opsz,wght@12..96,500..800&display=swap");

#welcome {
  --ink: #2f2a12;
  --muted: #5d5a44;
  --butter: #f4dd8c;
  --olive: #2b2606;
  --font: "Cormorant Garamond", Georgia, serif;
  --ui: "Bricolage Grotesque", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.65, 0, .25, 1);
  --title-size: 84px;
  --col: 520px;
  --gap: 80px;
  position: fixed; inset: 0; z-index: 10; overflow: hidden;
  background: linear-gradient(#a9c1d6, #d3e0e6 58%, #e4eadf); color: var(--ink); -webkit-font-smoothing: antialiased;
}
#welcome * { box-sizing: border-box; }
#welcome :is(h1, h2, p) { margin: 0; }
#welcome button { all: unset; box-sizing: border-box; cursor: pointer; }
#welcome button:focus-visible, #welcome a:focus-visible { outline: 2px solid #2f5e9e; outline-offset: 4px; border-radius: 12px; }

/* The painted scene. */
/* Until it's painted, the scene is hidden over a plain sky gradient, then fades in all at once. */
#welcome .scene { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity .9s ease; }
#welcome .scene.painted { opacity: 1; }
#welcome canvas[data-scene] { position: absolute; top: -8px; left: -8px; width: calc(100% + 16px); height: calc(100% + 16px); filter: url(#impasto); }
#welcome .cloud { position: absolute; left: 0; z-index: 1; opacity: .85; filter: url(#impasto); animation: butter-drift linear infinite; will-change: transform; pointer-events: none; }
@keyframes butter-drift { from { transform: translateX(-30vw); } to { transform: translateX(130vw); } }
#welcome .flock { position: absolute; left: 0; z-index: 3; animation: butter-fly linear infinite; pointer-events: none; }
#welcome .flock svg { position: absolute; overflow: visible; }
#welcome .flock path { fill: none; stroke: #2e2a1c; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@keyframes butter-fly { 0% { transform: translate(-8vw, 0); } 50% { transform: translate(50vw, -16px); } 100% { transform: translate(112vw, 4px); } }

/* The line: a title that stays put, and a word that changes and underlines itself. */
#welcome .title { font: 400 var(--title-size)/1 var(--font); letter-spacing: -0.02em; color: var(--ink); white-space: nowrap; }
#welcome .title .part { display: inline-block; }
#welcome .changing { position: relative; display: inline-block; font-style: italic; text-align: center; }
#welcome .changing .word { display: inline-block; transition: opacity .3s ease, transform .3s ease; }
#welcome .changing .word.out { opacity: 0; transform: translateY(8px); }
#welcome .changing .underline { position: absolute; left: 0; bottom: -4px; overflow: visible; filter: url(#boil); }
#welcome .changing .reveal { fill: none; stroke: #fff; stroke-width: 26; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
#welcome .changing .ink { fill: none; stroke: #f2c94c; stroke-width: 5.5; stroke-linecap: round; }
#welcome .changing .skip { fill: #000; stroke: #000; stroke-linejoin: round; }
#welcome .changing .base { display: inline-block; width: 0; height: 0; vertical-align: baseline; }

/* The landing. */
/* Coming back from the card, the landing waits for the "Melt away" line to leave before it returns. */
#welcome .hero { position: absolute; z-index: 4; left: 0; right: 0; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; align-items: center; text-align: center; transition: opacity .55s ease .35s, transform .8s var(--ease) .3s, visibility 0s; }
#welcome .start { margin-top: 26px; }

/* Buttons are Otis's iMessage stickers, just bigger. */
#welcome .sticker {
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 56px; padding: 0 34px; text-decoration: none; white-space: nowrap; cursor: pointer;
  border-radius: 26px 30px 25px 31px / 30px 25px 31px 26px;
  font: 700 20px/1 var(--ui); font-variation-settings: "opsz" 20; letter-spacing: -0.01em; color: var(--olive);
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .22));
  transition: transform .2s ease, opacity .2s ease;
}
#welcome .sticker::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; background: var(--butter); filter: url(#paint); }
#welcome .sticker:hover { transform: rotate(-1.5deg) scale(1.03); }
#welcome .sticker[aria-disabled="true"] { opacity: .6; pointer-events: none; }
#welcome .sticker svg { width: 20px; height: 14px; overflow: visible; filter: url(#boil); }
#welcome .sticker svg path, #welcome .back path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* After "Get started": the landing (line and button together, as one piece) drifts left and fades out.
   Only once it's gone does "Melt away your" fade in, so the two lines never overlap. The card comes in
   beside it, and the two sit together as one centred pair: [ line ] gap [ card ]. */
#welcome.signing-up .hero { opacity: 0; visibility: hidden; pointer-events: none; transform: translate(-120px, -50%); transition: opacity .35s ease, transform .6s var(--ease), visibility 0s .6s; }

#welcome .side { position: absolute; z-index: 4; left: calc(50% - var(--gap) / 2 - var(--col)); width: var(--col); top: 50%; transform: translate(-16px, -50%); opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s ease, transform .4s var(--ease), visibility 0s .4s; }
#welcome.signing-up .side { opacity: 1; visibility: visible; transform: translate(0, -50%); transition: opacity .6s ease .4s, transform .7s var(--ease) .35s, visibility 0s; }
#welcome .side .title { line-height: 1.06; }
#welcome .side .changing { text-align: left; }

/* The card. */
#welcome .card {
  position: absolute; z-index: 5; left: calc(50% + var(--gap) / 2); top: 50%; width: var(--col);
  max-height: calc(100vh - 32px); overflow: auto;
  padding: 34px 44px 28px; border-radius: 34px;
  background: rgba(255, 252, 244, .8);
  -webkit-backdrop-filter: blur(16px) saturate(1.1); backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: 0 26px 80px rgba(28, 52, 80, .2), 0 1px 0 rgba(255, 255, 255, .8) inset;
  font-family: var(--ui); color: var(--ink);
  opacity: 0; visibility: hidden; transform: translate(56px, -50%); pointer-events: none;
  transition: opacity .55s ease .2s, transform .8s var(--ease) .15s, visibility 0s .9s;
}
#welcome.signing-up .card { opacity: 1; visibility: visible; transform: translate(0, -50%); pointer-events: auto; transition: opacity .55s ease .2s, transform .8s var(--ease) .15s, visibility 0s; }

#welcome .card-top { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
#welcome .card-brand { font: 400 30px/1 var(--font); letter-spacing: -0.01em; }
#welcome .back { display: inline-flex; align-items: center; gap: 6px; padding: 6px 2px; font: 600 15px var(--ui); color: var(--muted); }
#welcome .back svg { width: 16px; height: 12px; }
#welcome .back:hover { color: var(--ink); }
#welcome .card:not([data-step="phone"]):not([data-step="code"]) .back { visibility: hidden; }
#welcome .step-count { margin-top: 26px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #9a8429; }

/* One step shows at a time, easing in when it appears. */
#welcome .step { display: none; flex-direction: column; gap: 14px; margin-top: 8px; }
#welcome .card[data-step="phone"] .step-phone, #welcome .card[data-step="code"] .step-code, #welcome .card[data-step="accounts"] .step-accounts,
#welcome .card[data-step="about"] .step-about, #welcome .card[data-step="done"] .step-done { display: flex; animation: butter-step .45s var(--ease); }
@keyframes butter-step { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

#welcome .step h2 { font: 500 58px/1 var(--font); letter-spacing: -0.02em; }
#welcome .sub { font-size: 16px; line-height: 1.45; color: var(--muted); margin: -2px 0 8px; }
#welcome .sub b { color: var(--ink); font-weight: 600; }
#welcome .field-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: -6px; }

#welcome .phone, #welcome .text { height: 60px; border-radius: 16px; background: rgba(255, 255, 255, .88); border: 1px solid rgba(47, 42, 18, .12); }
#welcome .phone { display: flex; align-items: center; overflow: hidden; }
#welcome .phone:focus-within, #welcome .text:focus { border-color: #e3bd3d; box-shadow: 0 0 0 3px rgba(242, 201, 76, .35); outline: none; }
#welcome .phone .cc { padding: 0 14px 0 18px; height: 100%; display: flex; align-items: center; border-right: 1px solid rgba(47, 42, 18, .12); font-weight: 600; font-size: 17px; }
#welcome .phone input { flex: 1; min-width: 0; height: 100%; border: 0; border-radius: 0; background: none; padding: 0 18px; font: 500 19px var(--ui); color: var(--ink); outline: none; }
#welcome .text { width: 100%; padding: 0 18px; font: 500 17px var(--ui); color: var(--ink); outline: none; }
#welcome .phone input::placeholder, #welcome .text::placeholder { color: #a7a28c; font-weight: 400; }
#welcome .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
#welcome .pair > div { display: flex; flex-direction: column; gap: 14px; }

#welcome .digits { display: flex; gap: 10px; }
#welcome .digits input { flex: 1; min-width: 0; height: 68px; padding: 0; border-radius: 16px; text-align: center; background: rgba(255, 255, 255, .88); border: 1px solid rgba(47, 42, 18, .12); font: 600 26px var(--ui); color: var(--ink); outline: none; transition: border-color .2s, background .2s; }
#welcome .digits input:focus { border-color: #e3bd3d; box-shadow: 0 0 0 3px rgba(242, 201, 76, .35); }
#welcome .step-code.checking .digits input { background: rgba(255, 246, 214, .95); border-color: #e3bd3d; }
#welcome .step-code.verified .digits input { background: rgba(226, 242, 214, .95); border-color: #8fbf6e; }
#welcome .step-code.wrong .digits input { background: rgba(252, 230, 222, .95); border-color: #d9826a; }
#welcome .status { font-size: 14px; color: var(--muted); text-align: center; min-height: 20px; }
#welcome .status.problem { color: #9a3b1f; }
#welcome .step-code.verified .status { color: #3f6e2a; font-weight: 600; }

#welcome .sticker.wide { width: 100%; height: 58px; margin-top: 8px; font-size: 19px; }
#welcome .alt { text-align: center; font-size: 14px; color: var(--muted); margin-top: 2px; }
#welcome .alt a, #welcome .alt button, #welcome .quiet { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
#welcome .quiet { align-self: center; font-size: 15px; margin-top: 2px; }

#welcome .number { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border-radius: 18px; background: rgba(255, 255, 255, .7); border: 1px solid rgba(47, 42, 18, .1); }
#welcome .number span { font-size: 13px; font-weight: 600; color: var(--muted); }
#welcome .number strong { font: 500 34px/1.1 var(--font); letter-spacing: -0.01em; font-variant-numeric: lining-nums; }

#welcome .fine { margin-top: 20px; font-size: 12px; color: #8a866f; text-align: center; }
#welcome .fine a { color: var(--muted); text-decoration: underline; }
#welcome .card:not([data-step="phone"]):not([data-step="code"]) .fine-terms { display: none; }
#welcome .card[data-step="phone"] .fine-signout, #welcome .card[data-step="code"] .fine-signout { display: none; }

/* Narrower laptops: shrink the two columns a little. */
@media (max-width: 1200px) and (min-width: 601px) {
  #welcome { --col: 440px; --gap: 48px; --title-size: 70px; }
  #welcome .card { padding: 30px 34px 24px; }
  #welcome .step h2 { font-size: 48px; }
}

/* Tablets and small windows: no room for two columns, so the card sits alone in the middle. */
@media (max-width: 980px) and (min-width: 601px) {
  #welcome .side { display: none; }
  #welcome .card { left: 50%; transform: translate(calc(-50% + 56px), -50%); }
  #welcome.signing-up .card { transform: translate(-50%, -50%); }
}

/* Phone: the line shrinks to fit; after "Get started" it moves to the top and the card rises from the bottom. */
@media (max-width: 600px) {
  #welcome .hero .title { font-size: 10vw; }
  #welcome .hero { padding: 0 16px; }
  #welcome .start { margin-top: 22px; height: 46px; padding: 0 24px; font-size: 16px; }
  #welcome .side, #welcome.signing-up .side { left: 20px; right: 20px; width: auto; top: 28px; transform: none; }
  #welcome .side .title { font-size: 40px; }
  #welcome .card { left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: calc(100vh - 150px); padding: 24px 22px 20px; border-radius: 28px; transform: translateY(40px); }
  #welcome.signing-up .card { transform: translateY(0); }
  #welcome .step h2 { font-size: 40px; }
  #welcome .digits { gap: 6px; }
  #welcome .digits input { height: 56px; }
  #welcome .pair { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #welcome .cloud, #welcome .flock { animation-play-state: paused; }
  #welcome .card, #welcome .side, #welcome .hero, #welcome .scene { transition: none !important; }
  #welcome .step { animation: none !important; }
}
