/* ─────────────────────────────────────────────
   Apple-flavoured design tokens
   ───────────────────────────────────────────── */
:root {
  /* Apple system colors (light) */
  --blue: #0071e3;
  --blue-strong: #0040dd;
  --green: #34c759;
  --green-deep: #248a3d;
  --orange: #ff9500;
  --red: #ff3b30;
  --purple: #af52de;
  --pink: #ff2d55;
  --teal: #30b0c7;
  --graphite: #6e6e73;

  /* Surfaces — systemGroupedBackground */
  --bg: #f2f2f7;
  --dots: rgba(60, 60, 67, 0.16);
  --card: #ffffff;
  --card-2: #f2f2f7;
  --chip: #ffffff;
  --border: rgba(60, 60, 67, 0.13);
  --border-strong: rgba(60, 60, 67, 0.24);

  /* Text */
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;

  /* Flat by design: surfaces separate by tint, the way iOS groups do */
  --shadow-sm: none;
  --shadow: none;
  --shadow-lg: none;

  --r-card: 22px;
  --r-inner: 16px;
  --r-pill: 999px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.44, 1);
}

/* The theme is always written to <html data-theme="…"> by the inline script in
   the page head, so a single selector covers both auto and manual switching. */
/* Dark palette taken 1:1 from UITableView .insetGrouped in dark mode:
   systemGroupedBackground behind the table, secondarySystemGroupedBackground
   for the cells, tertiary for controls inside them, and the system separator. */
:root[data-theme='dark'] {
  color-scheme: dark;

  --bg: #000000;              /* systemGroupedBackground */
  --dots: rgba(235, 235, 245, 0.14);
  --card: #1c1c1e;            /* secondarySystemGroupedBackground */
  --card-2: #2c2c2e;          /* tertiarySystemGroupedBackground */
  --chip: #1c1c1e;
  --border: rgba(84, 84, 88, 0.65);  /* separator */
  --border-strong: #48484a;          /* systemGray4 */

  --text: #ffffff;                     /* label */
  --text-2: rgba(235, 235, 245, 0.6);  /* secondaryLabel */
  --text-3: rgba(235, 235, 245, 0.3);  /* tertiaryLabel */

  --blue: #0a84ff;
  --blue-strong: #7aaeff;
  --green: #30d158;
  --green-deep: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --purple: #bf5af2;
  --pink: #ff375f;
  --teal: #64d2ff;
  --graphite: #aeaeb2;
}

:root[data-theme='light'] { color-scheme: light; }

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Helvetica Neue', 'Segoe UI', Inter, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.47;
  letter-spacing: -0.012em;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

/* ─────────────────────────────────────────────
   Theme switch
   ───────────────────────────────────────────── */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--chip);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: transform 0.25s var(--spring), color 0.25s var(--ease),
    border-color 0.25s var(--ease), background-color 0.35s var(--ease);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: scale(1.06);
}
.theme-toggle:active { transform: scale(0.94); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-sun { display: none; }
:root[data-theme='dark'] .theme-toggle .icon-moon { display: block; }

@media (max-width: 560px) {
  .theme-toggle { top: 12px; right: 12px; width: 36px; height: 36px; }
}

a { color: inherit; text-decoration: none; }

.wrap {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 48px 20px 96px;
}

/* ─────────────────────────────────────────────
   Hero
   ───────────────────────────────────────────── */
.hero { margin-bottom: 40px; }

.hero-top {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.avatar {
  width: 78px;
  height: 78px;
  border-radius: 18px;
  object-fit: cover;
  background: var(--card-2);
  border: 4px solid var(--card);
  box-shadow: var(--shadow);
  transform: rotate(-2deg);
  transition: transform 0.4s var(--spring);
}
.avatar:hover { transform: rotate(0deg) scale(1.04); }

.name {
  margin: 0;
  font-size: clamp(46px, 9vw, 68px);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.status {
  margin: 18px 0 0;
  font-size: clamp(24px, 4.6vw, 34px);
  font-weight: 400;
  letter-spacing: -0.028em;
  color: var(--text);
}
.status em {
  font-style: normal;
  font-weight: 400;
  color: var(--text-2);
}

.bio {
  margin: 16px 0 0;
  max-width: 620px;
  color: var(--text-2);
  font-size: 17px;
}
.bio:empty { display: none; }

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--chip);
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  font-size: 14.5px;
  color: var(--text);
  white-space: nowrap;
}
.chip .val { color: var(--blue); font-weight: 600; }
.chip .lbl { color: var(--text-2); }
.chip svg { width: 14px; height: 14px; opacity: 0.55; }

/* Linked chip — the studio */
.chip-link {
  color: var(--text-2);
  transition: border-color 0.2s var(--ease);
}
.chip-link .val { color: var(--blue); }
.chip-link svg { width: 12px; height: 12px; color: var(--blue); opacity: 1; }
.chip-link:hover { border-color: var(--blue); }
.chip-link:active { opacity: 0.5; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 22%, transparent);
}

/* ─────────────────────────────────────────────
   Section headers
   ───────────────────────────────────────────── */
.section { margin-top: 44px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 14px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}

.section-note { font-size: 14px; color: var(--text-3); }

/* ─────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────── */
.panel {
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow);
  padding: 22px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 14px;
}

/* Contacts — plain table style: bare rows on the page, hairline separators
   that start after the icon, exactly like a plain UITableView. */
.contact-table .row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  font-size: 17px;
  letter-spacing: -0.022em;
  color: var(--text);
  transition: opacity 0.18s var(--ease);
}
/* Separator inset past the icon, as in a plain table */
.contact-table .row { position: relative; }
.contact-table .row + .row::before {
  content: '';
  position: absolute;
  top: 0;
  left: 38px;
  right: 0;
  height: 1px;
  background: var(--border);
}
.contact-table .row:hover .lbl { text-decoration: underline; }
.contact-table .row:active { opacity: 0.4; }

.contact-table .ico {
  display: flex;
  flex: none;
  width: 22px;
  justify-content: center;
  color: var(--blue);
}
.contact-table .ico svg { width: 16px; height: 16px; }

.contact-table .lbl { flex: none; color: var(--blue); }
.contact-table .val {
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2);
}

/* Project cards */
.project-card {
  position: relative;
  -webkit-user-drag: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  background: var(--card);
  border: 1px solid transparent;
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s var(--ease);
}
/* Focus and hover do one thing: tint the border systemBlue */
.project-card:hover,
.project-card:focus-visible {
  border-color: var(--blue);
  outline: none;
}
.project-card.featured { grid-column: span 1; }

.project-card .head {
  display: flex;
  align-items: flex-start;
  gap: 13px;
}
.project-card .glyph {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: none;
  font-size: 23px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--accent) 14%, var(--card-2));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.project-card h3 {
  margin: 2px 0 3px;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.project-card .tagline {
  margin: 0;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.4;
}

/* App Store style screenshot strip inside a project card */
.strip {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  margin: 2px -20px 0;
  padding: 0 20px 2px;
  cursor: grab;
}
.strip::-webkit-scrollbar { display: none; }
.strip.dragging { cursor: grabbing; }

.strip .shot {
  flex: none;
  overflow: hidden;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
}
.strip .shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

.strip-wide .shot { width: 232px; aspect-ratio: 16 / 10; }
.strip-phone .shot { width: 116px; aspect-ratio: 2 / 3; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
}

/* Accents */
[data-accent='blue'] { --accent: var(--blue); }
[data-accent='green'] { --accent: var(--green-deep); }
[data-accent='orange'] { --accent: var(--orange); }
[data-accent='red'] { --accent: var(--red); }
[data-accent='purple'] { --accent: var(--purple); }
[data-accent='pink'] { --accent: var(--pink); }
[data-accent='teal'] { --accent: var(--teal); }
[data-accent='graphite'] { --accent: var(--graphite); }
[data-accent] { --accent: var(--blue); }

/* ─────────────────────────────────────────────
   Project page
   ───────────────────────────────────────────── */
/* iOS navigation-bar back button: chevron + label, tinted, no chrome */
.back {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin: 0 0 24px -6px;
  padding: 4px 6px;
  font-size: 17px;
  letter-spacing: -0.022em;
  color: var(--blue);
  transition: opacity 0.2s var(--ease);
}
.back svg {
  width: 17px;
  height: 17px;
  transition: transform 0.28s var(--spring);
}
.back:hover svg { transform: translateX(-3px); }
.back:active { opacity: 0.4; }

.project-hero {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 10px;
}
.project-hero .glyph {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  flex: none;
  font-size: 34px;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 14%, var(--card-2));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  box-shadow: var(--shadow-sm);
}
.project-hero h1 {
  margin: 0;
  font-size: clamp(34px, 6.5vw, 50px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.05;
}
.project-hero .tagline {
  margin: 8px 0 0;
  font-size: clamp(17px, 2.6vw, 21px);
  color: var(--text-2);
  letter-spacing: -0.02em;
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 26px;
}

.board-card {
  background: var(--card);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-sm);
  padding: 22px;
}
.board-card.wide { grid-column: 1 / -1; }

.board-card h2 {
  margin: 0 0 12px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-3);
}
.board-card p { margin: 0; color: var(--text); font-size: 16.5px; }

.bullets { margin: 0; padding: 0; list-style: none; }
.bullets li {
  position: relative;
  padding: 8px 0 8px 22px;
  font-size: 16px;
  border-top: 1px solid var(--border);
}
.bullets li:first-child { border-top: none; padding-top: 0; }
.bullets li::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.bullets li:first-child::before { top: 8px; }

/* App icon inside a glyph slot */
.glyph.has-icon {
  padding: 0;
  overflow: hidden;
  background: var(--card-2);
}
.glyph.has-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Screenshot gallery — free-scrolling carousel, next shot peeking,
   card padding bled out so the row runs to the edges */
.gallery {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  margin: 0 -22px;
  padding: 2px 22px;
  scrollbar-width: none;
  cursor: grab;
}
.gallery::-webkit-scrollbar { display: none; }
.gallery.dragging { cursor: grabbing; }

.gallery .shot {
  flex: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card-2);
  border: 1px solid var(--border);
  transition: border-color 0.2s var(--ease);
}
.gallery .shot:hover { border-color: var(--border-strong); }
.gallery .shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  -webkit-user-drag: none;
}

.gallery-wide .shot { width: min(440px, 82vw); aspect-ratio: 16 / 10; }
.gallery-phone .shot { width: min(216px, 46vw); aspect-ratio: 2 / 3; }

.stack-list { display: flex; flex-wrap: wrap; gap: 8px; }
.stack-list span {
  padding: 7px 13px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  background: var(--card-2);
}

.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-inner);
  background: var(--card-2);
  font-size: 15px;
  transition: transform 0.22s var(--ease), border-color 0.22s var(--ease);
}
.link-row:hover {
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.link-row .arrow { margin-left: auto; color: var(--text-3); }
.link-row svg { width: 15px; height: 15px; }

.cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}
.cta-row:empty { display: none; }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--blue);
  color: #fff;
  font-size: 15.5px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s var(--ease), filter 0.22s var(--ease);
}
.cta:hover { transform: translateY(-1px); filter: brightness(1.06); }
.cta svg { width: 16px; height: 16px; }

/* Official App Store badge */
.badge {
  display: inline-flex;
  align-items: center;
  transition: opacity 0.2s var(--ease);
}
.badge:hover { opacity: 0.82; }
.badge:active { opacity: 0.6; }
.badge img { display: block; height: 44px; width: auto; }
.badge .badge-dark { display: none; }
:root[data-theme='dark'] .badge .badge-light { display: none; }
:root[data-theme='dark'] .badge .badge-dark { display: block; }

.cta-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

/* Footer */
.footer {
  margin-top: 56px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-3);
}
.footer a:hover { color: var(--text); }

/* Entrance animation */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  animation: reveal 0.6s var(--ease) forwards;
}
@keyframes reveal {
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 560px) {
  .wrap { padding: 32px 16px 72px; }
  .panel, .board-card { padding: 18px; }
  .avatar { width: 64px; height: 64px; border-radius: 16px; }
}
