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

:root {
  --bg: #121212;
  --surface: #1e1e1e;
  --border: #2a2a2a;
  --text: #ffffff;
  --muted: #888;
  --accent: #fff973;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Rubik', sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
header {
  padding: 1.5rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(18, 18, 18, 0.9);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: var(--text);
}

.logo span {
  color: var(--accent);
}

nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

nav a:hover { color: var(--text); }

nav a.tab-link.active {
  color: var(--accent);
  font-weight: 700;
}

.tab-panel[hidden] { display: none; }

/* ── Hero ── */
.hero {
  text-align: center;
  padding: 6rem 2rem 5rem;
  max-width: 640px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1.25rem;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero p {
  color: var(--muted);
  font-size: 1.1rem;
}

/* ── App sections ── */
.app-section {
  max-width: 1000px;
  margin: 0 auto;
  padding: 5rem 2rem;
  border-top: 1px solid var(--border);
}

.app-section:last-of-type {
  border-bottom: 1px solid var(--border);
}

.app-layout {
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.app-info {
  max-width: 560px;
}

.app-tag {
  display: inline-block;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.app-info h1,
.app-info h2 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 1rem;
}

.app-info p {
  color: var(--muted);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.app-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn-store {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent);
  color: #121212;
  font-family: 'Rubik', sans-serif;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-store:hover { opacity: 0.85; }

.app-links {
  display: flex;
  gap: 1rem;
}

.app-links a {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}

.app-links a:hover {
  color: var(--text);
  border-color: var(--text);
}

/* ── App grid (home) ── */
.app-grid {
  max-width: 800px;
  margin: 0 auto;
  padding: 4rem 2rem 5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3rem 2.5rem;
}

.app-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  color: var(--text);
}

.app-card img {
  display: block;
  width: 100%;
  max-width: 180px;
  height: auto;
  aspect-ratio: 1;
  border-radius: 22.37%;
  border: 1px solid var(--border);
  transition: transform 0.15s;
}

.app-card span {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  transition: color 0.15s;
}

.app-card:hover img { transform: scale(1.04); }

.app-card:hover span { color: var(--accent); }

/* ── App detail page ── */
.app-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 4rem 2rem 5rem;
}

/* Either a bare <p>, or a wrapper when the blurb has several parts. */
.app-blurb {
  max-width: 560px;
  color: var(--muted);
  font-size: 1rem;
}

.app-blurb p + p { margin-top: 1rem; }

.app-heading {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.app-heading h1 {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 0;
}

/* Official Apple badge. The artwork must not be recoloured or reproportioned,
   so this only sets a height and lets the width follow. */
.btn-badge {
  display: inline-block;
  flex-shrink: 0;
  transition: opacity 0.15s;
}

.btn-badge:hover { opacity: 0.85; }

.btn-badge img {
  display: block;
  height: 48px;
  width: auto;
}

.app-heading .btn-badge { margin-left: auto; }

/* Below this the title and CTA can't share a row. Grid rather than flex-wrap:
   flex breaks lines on each item's intrinsic width, which strands the icon on
   a row of its own once the title is long. */
@media (max-width: 900px) {
  .app-heading {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.25rem;
  }

  .app-heading .btn-badge {
    grid-column: 1 / -1;
    justify-self: start;
    margin-left: 0;
  }
}

.app-icon {
  display: block;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: 22.37%;
  border: 1px solid var(--border);
}

/* ── Project images ── */
.project-image {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
}

.project-image img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.project-image.terminal {
  background: var(--surface);
}

/* ── Screenshots ── */
/* Desktop: every screenshot shares the row, so they always fit with no
   scrolling regardless of how many an app has. */
.screenshots {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1rem 0;
}

.screenshots img {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 18px;
  border: 1px solid var(--border);
}

/* ── Footer ── */
footer {
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

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

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

/* ── Responsive ── */
@media (max-width: 680px) {
  /* Three icons across is too tight on a phone — drop to two. */
  .app-grid { grid-template-columns: repeat(2, 1fr); }

  /* Too narrow to fit them all — fixed width, swipe to scroll. */
  .screenshots {
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  .screenshots img {
    flex: 0 0 auto;
    width: 140px;
  }

  .screenshots::-webkit-scrollbar { height: 6px; }

  .screenshots::-webkit-scrollbar-track { background: transparent; }

  .screenshots::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
  }

  /* Give the title more of the row so shorter names stay on one line */
  .app-icon {
    width: 64px;
    height: 64px;
  }
}
