:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --border: #e5e5e5;
  --text: #1a1a1a;
  --muted: #666666;
  --radius: 20px;
  --radius-lg: 28px;
  --radius-sm: 12px;
  --max-width: 960px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101010;
    --surface: #1a1a1a;
    --border: #2c2c2c;
    --text: #f2f2f2;
    --muted: #9a9a9a;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 48px;
}

.page-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--muted);
}

.intro {
  color: var(--muted);
  font-size: 1rem;
  max-width: 40ch;
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.lang-option {
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

.lang-option.is-active {
  background: var(--text);
  color: var(--bg);
}

/* --- App grid: closed tiles, each carrying its own app's brand theme --- */

.app-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

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

.app-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
  padding: 36px 32px;
  min-height: 220px;
  border: 1px solid rgb(128 128 128 / 0.16);
  border-radius: var(--radius-lg);
  background: var(--tile-bg);
  color: var(--tile-text);
  font-family: var(--tile-font);
  cursor: pointer;
  text-align: left;
  box-shadow: 0 4px 16px -8px rgb(0 0 0 / 0.18);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.app-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 36px -14px rgb(0 0 0 / 0.32);
}

.app-card:active {
  transform: translateY(-1px) scale(0.99);
}

.app-icon {
  width: 72px;
  height: 72px;
  border-radius: 22%;
  display: block;
  flex-shrink: 0;
}

.app-card-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.app-name {
  font-size: 1.5rem;
  font-weight: var(--tile-name-weight, 600);
  letter-spacing: var(--tile-name-spacing, -0.01em);
}

.app-tagline {
  font-size: 1rem;
  color: var(--tile-muted);
  max-width: 34ch;
}

/* --- Modal overlay: opens in the clicked app's own brand theme --- */

.modal-scrim {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(10 10 10 / 0.55);
  animation: scrim-in 0.25s var(--ease);
}

.app-modal {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  padding: 40px;
  border-radius: var(--radius-lg);
  background: var(--tile-bg);
  color: var(--tile-text);
  font-family: var(--tile-font);
  animation: modal-in 0.3s var(--ease);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: rgb(127 127 127 / 0.16);
  color: var(--tile-text);
  cursor: pointer;
  transition: background 0.2s var(--ease);
}

.modal-close:hover {
  background: rgb(127 127 127 / 0.28);
}

.modal-header {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding-right: 40px;
}

.modal-icon {
  width: 64px;
  height: 64px;
  border-radius: 22%;
  display: block;
  flex-shrink: 0;
}

.modal-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-title .app-name {
  font-size: 1.4rem;
}

.modal-title .app-tagline {
  font-size: 0.92rem;
}

.modal-philosophy,
.modal-benefit {
  font-size: 1rem;
  margin-bottom: 16px;
  max-width: 65ch;
}

.modal-features {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-features li {
  position: relative;
  padding-left: 22px;
  font-size: 0.95rem;
}

.modal-features li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tile-accent);
}

.modal-screenshots {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  margin-bottom: 24px;
  padding-bottom: 4px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* legacy Edge/IE */
}

.modal-screenshots::-webkit-scrollbar {
  display: none; /* Chrome, Safari, new Edge */
}

.modal-screenshots img {
  scroll-snap-align: start;
  height: 320px;
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(128 128 128 / 0.28);
  flex-shrink: 0;
  cursor: zoom-in;
  transition: transform 0.2s var(--ease);
}

.modal-screenshots img:hover {
  transform: scale(1.02);
}

.app-store-button,
.app-coming-soon {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-store-button {
  background: var(--tile-accent);
  color: var(--tile-button-text);
}

.app-coming-soon {
  background: none;
  border: 1px solid currentColor;
  color: var(--tile-muted);
}

/* --- Screenshot lightbox: zooms one screenshot above the modal --- */

.lightbox-scrim {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(0 0 0 / 0.85);
  animation: scrim-in 0.2s var(--ease);
}

.lightbox-scrim img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: var(--radius-sm);
  border: 1px solid rgb(255 255 255 / 0.14);
  box-shadow: 0 24px 64px -16px rgb(0 0 0 / 0.6);
  animation: modal-in 0.2s var(--ease);
}

@keyframes scrim-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.page-footer {
  margin-top: 64px;
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-footer a {
  color: inherit;
  text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
  .app-card,
  .modal-scrim,
  .app-modal,
  .lightbox-scrim,
  .lightbox-scrim img,
  .modal-screenshots img {
    transition: none;
    animation: none;
  }
}
