/* Byte Studio — site stylesheet */

/* ---------- tokens ---------- */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --fg: #2d3748;
  --fg-muted: #718096;
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --border: #e2e8f0;
  --link: #2d3748;
  --link-hover: #1a202c;
  --accent: #2b6cb0;

  --radius: 8px;
  --max-w: 64rem;
  --pad: clamp(1rem, 4vw, 2rem);
  --gap: 1.5rem;
}

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

html {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}
body {
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img, video, iframe, embed, object { max-width: 100%; }
img { display: block; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
ul { list-style: none; }
code { font-family: var(--font-mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

/* ---------- layout shell ---------- */
body {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  gap: 2rem;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.site-logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}
.site-nav {
  display: flex;
  gap: 1.5rem;
  font-size: 0.95rem;
}
.site-nav a[aria-current="page"] {
  color: var(--fg-muted);
  pointer-events: none;
}

.site-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  min-width: 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  color: var(--fg-muted);
  font-size: 0.85rem;
}

/* ---------- typography defaults ---------- */
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.015em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.35rem, 2.5vw, 1.75rem); }
h3 { font-size: 1.15rem; }
p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

.text > * + * { margin-top: 1rem; }
.text h2, .text h3, .text h4 { margin-top: 1.5rem; }

/* ---------- hero (home) ---------- */
.hero {
  padding: clamp(2rem, 8vw, 5rem) 0 clamp(1rem, 4vw, 2rem);
  text-align: center;
}
.hero-headline {
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.05;
  max-width: 18ch;
  margin-inline: auto;
}
.hero-subline {
  margin: clamp(1.25rem, 5vw, 45px) auto 0;
  color: var(--fg-muted);
  font-size: clamp(1.1rem, 5.1vw, 3.19rem);
  max-width: 40ch;
  padding-inline: 0.5rem;
}

/* ---------- page header ---------- */
.page-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 1.25rem;
}
.page-intro {
  margin-top: 0.75rem;
  color: var(--fg-muted);
  max-width: 60ch;
}

/* ---------- layout field grid (used by snippets/layouts.php) ---------- */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gutter, var(--gap));
}
@media (min-width: 720px) {
  .grid {
    grid-template-columns: repeat(12, 1fr);
  }
  .grid > .column {
    grid-column: span var(--columns, 12);
  }
}
.margin-xl { margin-block: 2rem; }

/* ---------- project grid ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: var(--gap);
}
.project-card a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color 120ms ease, transform 120ms ease;
}
.project-card a:hover {
  text-decoration: none;
  border-color: var(--fg);
  transform: translateY(-1px);
}
.project-cover {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  object-fit: cover;
  object-position: center;
  border-radius: calc(var(--radius) - 2px);
  display: block;
}
.project-card-body { flex: 1; min-width: 0; }
.project-card h2 { margin-bottom: 0.25rem; font-size: 1.2rem; }
.project-card p { color: var(--fg-muted); margin: 0; font-size: 0.95rem; }

/* ---------- app page ---------- */
.app {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 50rem;
  min-width: 0;
}
.app-header h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
.app-tagline { color: var(--fg-muted); font-size: 1.15rem; margin-top: 0.25rem; }
.app-description { max-width: 65ch; }

.app-stores {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.store-link {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--fg);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
}
.store-link:hover {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}

.screenshot-carousel {
  position: relative;
  min-width: 0;
  outline: none;
}
.screenshot-carousel:focus-visible {
  box-shadow: 0 0 0 2px var(--accent);
  border-radius: var(--radius);
}
.screenshots {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-block: 0.25rem 1rem;
  scrollbar-width: thin;
  cursor: grab;
  user-select: none;
}
.screenshots.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}
.screenshots.dragging img { pointer-events: none; }

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: opacity 150ms ease, background-color 120ms ease, color 120ms ease;
}
.carousel-btn:hover { background: var(--fg); color: var(--bg); }
.carousel-prev { left: 0.25rem; }
.carousel-next { right: 0.25rem; }
.carousel-btn:disabled { opacity: 0; pointer-events: none; }
@media (hover: none) and (pointer: coarse) {
  .carousel-btn { display: none; }
  .screenshots { cursor: auto; }
}
.screenshots li {
  flex: 0 0 200px;
  scroll-snap-align: start;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.screenshots img {
  width: 100%;
  aspect-ratio: 9 / 19;
  object-fit: cover;
  display: block;
}

/* ---------- latest update block (home) ---------- */
.latest-update {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.latest-update-label {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin: 0;
}
.latest-update-card {
  display: block;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color 120ms ease, transform 120ms ease;
}
.latest-update-card:hover {
  border-color: var(--fg);
  text-decoration: none;
  transform: translateY(-1px);
}
.latest-update-date {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}
.latest-update-title { font-size: 1.25rem; margin-bottom: 0.5rem; }
.latest-update-summary { color: var(--fg-muted); margin-bottom: 0.75rem; }
.latest-update-cta { font-size: 0.9rem; font-weight: 600; }

/* ---------- updates list (/updates) ---------- */
.update-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.update-item a {
  display: block;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  transition: border-color 120ms ease;
}
.update-item a:hover { border-color: var(--fg); text-decoration: none; }
.update-date {
  display: block;
  font-size: 0.85rem;
  color: var(--fg-muted);
  margin-bottom: 0.25rem;
}
.update-title { font-size: 1.2rem; margin-bottom: 0.4rem; }
.update-summary { color: var(--fg-muted); margin: 0 0 0.5rem; }
.update-tag {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--fg-muted);
}

/* ---------- single update (/updates/<slug>) ---------- */
.update {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  max-width: 50rem;
  min-width: 0;
}
.update-header h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-top: 0.25rem;
}
.update-meta { color: var(--fg-muted); font-size: 0.9rem; margin: 0; }
.update-meta a { color: var(--fg); }
.update-body { max-width: 65ch; }
.update-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  font-size: 0.9rem;
}

/* ---------- recent updates on app page ---------- */
.app-updates {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}
.app-updates h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
}
.app-updates ul {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.app-updates li a {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0;
}
.app-updates li time {
  flex-shrink: 0;
  color: var(--fg-muted);
  font-size: 0.85rem;
  width: 6.5rem;
}
.app-update-title { color: var(--fg); }
.app-updates-more {
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

/* ---------- block defaults ---------- */
figure { margin: 0; }
figure img { border-radius: var(--radius); }
figcaption { color: var(--fg-muted); font-size: 0.85rem; margin-top: 0.5rem; }
blockquote {
  border-left: 3px solid var(--border);
  padding-left: 1rem;
  font-style: italic;
  color: var(--fg-muted);
}

/* used by image snippet */
.video {
  display: block;
  position: relative;
  padding-top: calc(var(--h, 9) / var(--w, 16) * 100%);
}
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- empty states ---------- */
.empty {
  color: var(--fg-muted);
  font-style: italic;
  padding: 2rem 0;
}

/* ---------- legal / privacy pages ---------- */
.legal {
  max-width: 50rem;
  min-width: 0;
}
.legal .page-meta {
  margin-top: 0.4rem;
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.legal-body {
  max-width: 65ch;
}
.legal-body > * + * { margin-top: 1rem; }
.legal-body h2 {
  margin-top: 2rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}
.legal-body h3 {
  margin-top: 1.5rem;
  font-size: 1.05rem;
}
.legal-body p { line-height: 1.6; }
.legal-body a { color: var(--fg); text-decoration: underline; text-underline-offset: 2px; }
.legal-body strong { font-weight: 700; }
.legal-body ul, .legal-body ol {
  padding-left: 1.5rem;
}
.legal-body li {
  list-style: disc;
  margin-bottom: 0.4rem;
}
.legal-body ol li { list-style: decimal; }

/* ---------- mobile breakpoints ---------- */
@media (max-width: 600px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .site-nav {
    flex-wrap: wrap;
    width: 100%;
    gap: 1rem 1.25rem;
  }
  .site-nav a {
    padding-block: 0.4rem;
  }
  .hero {
    padding-top: clamp(1rem, 6vw, 3rem);
  }
  .project-card a { padding: 0.75rem; }
  .project-cover { flex-basis: 72px; width: 72px; height: 72px; }
  .screenshots li { flex-basis: 75vw; max-width: 280px; }
  .app-updates li a {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
  }
  .app-updates li time { width: auto; }
}

@media (max-width: 380px) {
  :root { --pad: 1rem; }
  .hero-headline { font-size: clamp(1.75rem, 9vw, 2.25rem); }
  .hero-subline { font-size: clamp(1rem, 5.5vw, 1.5rem); }
}
