/* App shell: bottom tab bar (Home and Services) and the Home launcher. Loaded after home.css / services.css.
   Colours match the rest of the app (see PROJECT.md, "Design Direction"); change them together. */
:root {
  --sh-accent: #3DDC6B;
  --sh-link: #0B6B2E;
  --sh-ink: #14201A;
  --sh-muted: #46544B;
  --sh-card: #FFFFFF;
  --sh-line: #D5DDD7;
  --sh-on-ink: #FFFFFF;
  --sh-on-ink-soft: #D5DFD8;
}

[hidden] { display: none !important; }

/* Room so the fixed tab bar never covers the end of a page. */
body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Bottom tab bar ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  width: 100%;
  max-width: 40rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--sh-card);
  border-top: 1px solid var(--sh-line);
}

.tabbar a {
  position: relative;
  flex: 1;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--sh-muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
}

.tabbar svg,
.tile svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tabbar svg { width: 24px; height: 24px; }

.tabbar a[aria-current="page"] { color: var(--sh-link); font-weight: 600; }

.tabbar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 25%;
  right: 25%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--sh-accent);
}

.tabbar a:focus-visible {
  outline: 3px solid var(--sh-link);
  outline-offset: -3px;
}

/* ---------- Home launcher ---------- */
.hero {
  margin: 4px 0 16px;
  padding: 20px 20px 24px;
  background: var(--sh-ink);
  border-radius: 20px;
}

.hero-cable {
  display: block;
  width: 100%;
  max-width: 20rem;
  height: auto;
}

#launcher .hero h1 {
  margin: 12px 0 6px;
  color: var(--sh-on-ink);
  font-size: 1.75rem;
  line-height: 1.15;
  font-weight: 600;
}

#launcher .hero-lede {
  margin: 0;
  color: var(--sh-on-ink-soft);
}

.tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  min-height: 120px;
  padding: 16px;
  background: var(--sh-card);
  color: var(--sh-ink);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--sh-line);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
}

.tile svg { width: 32px; height: 32px; color: var(--sh-link); }

.tile--main { background: var(--sh-accent); box-shadow: none; }

.tile--main svg { color: var(--sh-ink); }

.tile:focus-visible,
.cta:focus-visible,
.back:focus-visible {
  outline: 3px solid var(--sh-link);
  outline-offset: 3px;
}

/* ---------- "Check my project" panel and back link ---------- */
.panel {
  padding: 20px;
  background: var(--sh-card);
  color: var(--sh-ink);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--sh-line);
}

.back {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  color: var(--sh-link);
  font-weight: 600;
  text-decoration: none;
}

.back::before {
  content: "";
  width: 8px;
  height: 8px;
  margin-right: 10px;
  border: solid currentColor;
  border-width: 0 0 2px 2px;
  transform: rotate(45deg);
}

.cta {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 8px;
  padding: 0 16px;
  background: var(--sh-accent);
  color: var(--sh-ink);
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Motion: the cable line draws once, then the title appears ---------- */
@media (prefers-reduced-motion: no-preference) {
  .hero-cable path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: hero-draw 1.4s ease-out var(--sd, 0s) forwards;
  }
  .hero-cable circle {
    opacity: 0;
    animation: hero-show 0.3s ease-out calc(1.3s + var(--sd, 0s)) forwards;
  }
  .hero-reveal {
    opacity: 0;
    animation: hero-show 0.6s ease-out calc(0.8s + var(--sd, 0s)) forwards;
  }
  .tile { transition: transform 0.12s ease-out; }
  .tile:active { transform: scale(0.98); }
}

@keyframes hero-draw { to { stroke-dashoffset: 0; } }
@keyframes hero-show { to { opacity: 1; } }

/* ---------- Opening screen. The logo rolls in from the right (Home, when the app is opened from outside) ---------- */
.splash { display: none; }

/* While the opening animation plays, the Home header animation waits for it to finish. */
.has-splash { --sd: 2.6s; }

@media (prefers-reduced-motion: no-preference) {
  .has-splash .splash {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: var(--sh-ink);
    animation: splash-out 0.5s ease-in 2.7s forwards;
  }
  .splash__logo {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    animation: roll-in 1.4s cubic-bezier(0.4, 0.3, 0.25, 1) both;
  }
  .splash__cable { width: 100%; max-width: 12rem; height: auto; }
  .splash__cable path {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: hero-draw 0.9s ease-out 1.35s forwards;
  }
  .splash__cable circle {
    opacity: 0;
    animation: hero-show 0.2s ease-out 2.1s forwards;
  }
}

@keyframes roll-in {
  from { transform: translateX(60vw) rotate(480deg); }
  to { transform: translateX(0) rotate(0deg); }
}
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
