/* Flag emoji for Windows, which has no flag glyphs (shows "PL" letters instead).
   Twemoji Country Flags, CC-BY 4.0 (c) Twitter, via country-flag-emoji-polyfill.
   unicode-range keeps it limited to flags; Apple devices use Apple Color Emoji first. */
@font-face {
  font-family: "Twemoji Country Flags";
  src: url("../fonts/TwemojiCountryFlags.woff2") format("woff2");
  unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E0063, U+E0065, U+E0067, U+E006C, U+E006E, U+E0073-E0074, U+E0077, U+E007F;
  font-display: swap;
}

:root {
  --text-light: #f2f2f0;
  --text-muted: #9b9b98;
  --card-bg: #232326;
  --page-bg: #17171a;
  --header-border: rgba(255,255,255,0.08);
}

html[data-theme="light"] {
  --text-light: #1a1a18;
  --text-muted: #6b6b68;
  --card-bg: #ffffff;
  --page-bg: #f7f7f5;
  --header-border: rgba(20, 20, 18, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--text-light);
  font-family: -apple-system, "Helvetica Neue", "Apple Color Emoji", "Twemoji Country Flags", Arial, sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
}

a { color: inherit; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 20px;
}

header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 0;
  max-width: 640px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  color: var(--text-light);
  min-width: 0;
  flex-shrink: 1;
}

.brand img.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

@media (max-width: 480px) {
  .brand-text {
    display: none;
  }
}

.header-controls {
  display: flex;
  align-items: center;
  margin-left: auto;
  flex-shrink: 0;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--header-border);
  border-radius: 20px;
  width: 36px;
  height: 36px;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-light);
}

.lang-switch {
  display: flex;
  margin-left: 10px;
}

/* Language picker: a native <select> (a row of flag links overflowed a phone header). */
.lang-switch select {
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  font-size: 13px;
  color: var(--text-light);
  background: var(--card-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: none;
  border-radius: 8px;
  padding: 6px 28px 6px 10px;
  cursor: pointer;
}

/* iOS Safari zooms into any form control under 16px when it gets focus. */
@media (max-width: 480px) {
  .lang-switch select { font-size: 16px; }
  .brand { flex-shrink: 0; }
  .header-controls { flex-shrink: 1; min-width: 0; }
}

.hub-hero {
  text-align: center;
  padding: 40px 20px 8px;
  max-width: 640px;
  margin: 0 auto;
}

.hub-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  margin-bottom: 18px;
  object-fit: cover;
}

.avatar-flip {
  width: 84px;
  height: 84px;
  margin: 0 auto 18px;
  perspective: 600px;
  cursor: pointer;
}

.avatar-flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
}

.avatar-flip.flipped .avatar-flip-inner {
  transform: rotateY(180deg);
}

.avatar-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-face-wave {
  background: var(--card-bg);
  font-size: 40px;
}

.avatar-face-photo {
  transform: rotateY(180deg);
}

.avatar-face-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.hub-hero h1 {
  font-size: 1.7rem;
  margin: 0 0 10px;
}

.hub-bio {
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.6;
  max-width: 420px;
  margin: 0 auto;
}

.projects {
  max-width: 640px;
  margin: 32px auto 0;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 520px) {
  .projects { grid-template-columns: 1fr; }
}

.project-card {
  display: block;
  background: var(--card-bg);
  border-radius: 14px;
  padding: 22px;
  text-decoration: none;
  color: var(--text-light);
  transition: transform 0.15s ease;
}

.project-card:hover {
  transform: translateY(-2px);
}

.project-card.disabled {
  opacity: 0.7;
  cursor: default;
  position: relative;
}

.project-card .icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  margin-bottom: 14px;
  display: block;
}

.project-card .icon.placeholder {
  background: var(--page-bg);
  border: 1px solid var(--header-border);
}

.project-card h2 {
  font-size: 1.05rem;
  margin: 0 0 6px;
  font-weight: 600;
}

.project-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.project-card .cta {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-light);
}

.badge-soon {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 0.7rem;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--page-bg);
  color: var(--text-muted);
}

/* "New version" badge on a hub card; site.js reveals it until the app's page is visited. */
.project-card {
  position: relative;
}

.badge-new {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  padding: 4px 9px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #fff;
  background: linear-gradient(135deg, #ff5f45, #ff2d6f);
  box-shadow: 0 2px 8px rgba(255, 45, 111, 0.25);
  animation: badge-new-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.badge-new[hidden] {
  display: none;
}

.badge-new::after {
  content: " " attr(data-version);
}

/* Echo: two rings expanding out of the badge and fading, one after the other. */
.badge-new::before,
.badge-new > .badge-new-echo {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid #ff2d6f;
  pointer-events: none;
  animation: badge-new-echo 2.8s ease-out infinite;
}

.badge-new > .badge-new-echo {
  animation-delay: 1.4s;
}

@keyframes badge-new-echo {
  0%   { transform: scale(1);   opacity: 0.5; }
  60%  { opacity: 0; }
  100% { transform: scale(1.25, 1.6); opacity: 0; }
}

@keyframes badge-new-pop {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .badge-new,
  .badge-new::before,
  .badge-new > .badge-new-echo {
    animation: none;
  }
  .badge-new::before,
  .badge-new > .badge-new-echo {
    display: none;
  }
}

.site-footer {
  margin-top: 48px;
  padding: 24px 20px 40px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text-light);
}

.legal {
  padding: 40px 0 60px;
  line-height: 1.6;
}

.legal h1 {
  font-size: 1.6rem;
}

.legal h2 {
  font-size: 1.15rem;
  margin-top: 28px;
}

.legal p, .legal li {
  color: var(--text-muted);
}

.legal .updated {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 24px;
}

.back-link {
  display: inline-block;
  margin-bottom: 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.app-store-badge {
  display: inline-block;
  transition: transform 0.15s ease;
}

.app-store-badge:hover {
  transform: translateY(-2px);
}

.app-store-badge img {
  width: 180px;
  height: auto;
  display: block;
}

.download-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.qr-code {
  width: 64px;
  height: 64px;
  border-radius: 10px;
}

html[data-theme="light"] .dark-only { display: none; }
html:not([data-theme="light"]) .light-only { display: none; }
