/* swoopswift.com — light. Content sits on a floating rounded card over a soft
   grey canvas; the page is the card, not the window. */

:root {
  color-scheme: light;
  --canvas: #e7e9eb;
  --card: #fbfbfc;
  --paper: #ffffff;
  --ink: #0d0e10;
  --ink-2: #3c4147;
  --dim: #6d737b;
  --dimmer: #9aa0a7;
  --line: #e6e8ea;
  --line-2: #d8dbde;
  --orange: #f05138;
  --orange-soft: #fff1ed;
  --shell: 26px;
  --radius: 18px;
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--canvas); }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
p a, .prose a { color: var(--orange); }
p a:hover, .prose a:hover { text-decoration: underline; }

/* ---- The shell ---------------------------------------------------------- */

.shell {
  background: var(--card);
  border-radius: var(--shell);
  margin: 18px;
  overflow: clip;
  box-shadow: 0 1px 2px rgba(16, 20, 26, .04), 0 24px 60px -30px rgba(16, 20, 26, .28);
}
@media (max-width: 700px) { .shell { margin: 8px; border-radius: 20px; } }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 34px; }
.narrow { max-width: 720px; }
@media (max-width: 700px) { .wrap { padding: 0 20px; } }

/* ---- Header ------------------------------------------------------------- */

.site-header { position: sticky; top: 0; z-index: 40;
  background: rgba(251, 251, 252, .82);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); }
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 9px; }
.brand svg { width: 22px; height: 22px; color: var(--orange); display: block; }
.brand span { font-size: 16.5px; font-weight: 700; letter-spacing: -.025em; }
.site-header nav { margin-left: auto; display: flex; align-items: center; gap: 26px; }
.site-header nav a { color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.site-header nav a:hover { color: var(--ink); }
.site-header .pill { background: var(--ink); color: #fff; padding: 8px 16px;
  border-radius: 999px; font-size: 13px; font-weight: 600; }
.site-header .pill:hover { background: #24262a; }
@media (max-width: 760px) {
  .site-header nav { gap: 16px; }
  .site-header nav a:not(.pill) { display: none; }
}

/* ---- Footer ------------------------------------------------------------- */

.site-footer { border-top: 1px solid var(--line); margin-top: 90px; padding: 34px 0 44px;
  color: var(--dim); font-size: 13px; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 26px; align-items: center; }
.site-footer nav { margin-left: auto; display: flex; gap: 24px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--ink); }

/* ---- Type --------------------------------------------------------------- */

h1 { font-size: clamp(38px, 5.6vw, 62px); line-height: 1.05; letter-spacing: -.042em;
     font-weight: 800; margin: 0 0 20px; }
h1 em { font-style: normal; color: var(--orange); }
h2.title { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.12; letter-spacing: -.035em;
           font-weight: 800; margin: 0 0 14px; }
.lede { font-size: 16.5px; color: var(--dim); max-width: 46ch; margin: 0 0 30px; line-height: 1.6; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
           color: var(--dimmer); margin: 0 0 14px; }
.section-label { font-size: 11px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
                 color: var(--dimmer); margin: 0 0 20px; }

/* ---- Buttons ------------------------------------------------------------ */

.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 22px;
       border-radius: 999px; font-size: 14px; font-weight: 650; transition: .18s ease; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #24262a; transform: translateY(-1px); }
.btn-ghost { background: #eef0f2; color: var(--ink); }
.btn-ghost:hover { background: #e5e8ea; }
.sub { color: var(--dimmer); font-size: 12.5px; margin: 16px 0 0; }

/* ---- Scroll-revealed headline ------------------------------------------- */
/* Words start light and darken as the line crosses the middle of the screen. */

.reveal { font-size: clamp(30px, 5vw, 58px); line-height: 1.18; letter-spacing: -.04em;
          font-weight: 800; text-align: center; margin: 0 auto; max-width: 20ch; }
.reveal span { color: #cdd1d5; transition: color .45s ease; }
.reveal span.on { color: var(--ink); }
.reveal span.accent.on { color: var(--orange); }

/* ---- Component tiles ---------------------------------------------------- */
/* Each tile runs a component the player actually supports. Nothing here is a
   picture of a component. */

.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent,
           #000 9%, #000 91%, transparent);
           mask-image: linear-gradient(90deg, transparent, #000 9%, #000 91%, transparent); }
.marquee + .marquee { margin-top: 18px; }
.track { display: flex; gap: 18px; width: max-content; will-change: transform; }
.track-shift { transform: translateX(var(--shove, 0px)); transition: transform .12s linear; }
.track.l { animation: drift-l 54s linear infinite; }
.track.r { animation: drift-r 62s linear infinite; }
@keyframes drift-l { to { transform: translateX(-50%); } }
@keyframes drift-r { from { transform: translateX(-50%); } to { transform: translateX(0); } }
.marquee:hover .track { animation-play-state: paused; }

.tile { flex: none; width: 104px; height: 104px; border-radius: 24px;
        background: var(--paper); border: 1px solid var(--line);
        display: grid; place-items: center; position: relative; overflow: hidden;
        box-shadow: 0 1px 2px rgba(16,20,26,.03), 0 10px 24px -16px rgba(16,20,26,.3); }
.tile.lift { transform: translateY(-14px); }
.tile.drop { transform: translateY(12px); }
.tile .name { position: absolute; bottom: 0; left: 0; right: 0; padding: 5px 4px 6px;
              text-align: center; font: 500 9.5px/1 var(--mono); color: var(--dim);
              letter-spacing: -.02em; background: linear-gradient(transparent, #fff 40%);
              opacity: 0; transition: opacity .2s ease; }
.tile:hover .name { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .track { animation: none; }
  .tile * { animation: none !important; }
}

/* ---- Fanned deck (hero) -------------------------------------------------- */
/* An arc, not a row: seven tiles rotated a few degrees each and dropped along a
   curve, so the deck reads as a hand of cards. */

.deck { display: flex; justify-content: center; align-items: center; gap: 0;
        padding: 30px 0 44px; height: 210px; }
.deck .tile { width: 116px; height: 116px; margin-inline: -11px;
              transition: transform .3s cubic-bezier(.34,1.3,.64,1); }
.deck .tile:nth-child(1) { transform: rotate(-15deg) translateY(26px); z-index: 1; }
.deck .tile:nth-child(2) { transform: rotate(-10deg) translateY(11px); z-index: 2; }
.deck .tile:nth-child(3) { transform: rotate(-5deg)  translateY(2px);  z-index: 3; }
.deck .tile:nth-child(4) { transform: rotate(0deg)   translateY(-2px); z-index: 4; }
.deck .tile:nth-child(5) { transform: rotate(5deg)   translateY(2px);  z-index: 3; }
.deck .tile:nth-child(6) { transform: rotate(10deg)  translateY(11px); z-index: 2; }
.deck .tile:nth-child(7) { transform: rotate(15deg)  translateY(26px); z-index: 1; }
.deck .tile:hover { transform: translateY(-14px) rotate(0deg) scale(1.05); z-index: 9; }
@media (max-width: 700px) {
  .deck { height: 168px; }
  .deck .tile { width: 88px; height: 88px; margin-inline: -8px; }
  .deck .tile:nth-child(1), .deck .tile:nth-child(7) { display: none; }
}

/* ---- Cards -------------------------------------------------------------- */

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
        padding: 22px; }
.card h3 { margin: 0 0 7px; font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.card p { margin: 0; color: var(--dim); font-size: 13.5px; }
a.card { display: block; transition: .18s ease; }
a.card:hover { border-color: var(--line-2); transform: translateY(-2px);
               box-shadow: 0 14px 30px -20px rgba(16,20,26,.35); }
code { font-family: var(--mono); font-size: .88em; background: #f1f3f5;
       border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; color: var(--ink-2); }

section { margin: 96px 0; }
@media (max-width: 760px) { section { margin: 68px 0; } }

/* ---- Code --------------------------------------------------------------- */

.editor { border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
          background: var(--paper); }
.editor header { display: flex; align-items: center; gap: 8px; padding: 11px 16px;
                 border-bottom: 1px solid var(--line); background: #f7f8f9;
                 font: 600 12px/1 var(--mono); color: var(--dim); }
.editor header .dot { width: 8px; height: 8px; border-radius: 50%; background: #dfe2e5; }
.editor header .name { margin-left: 5px; color: var(--ink); }
.editor header .tag { margin-left: auto; color: var(--dimmer); font-weight: 500; }
pre { margin: 0; padding: 18px 20px 22px; overflow-x: auto;
      font: 12.5px/1.7 var(--mono); color: #24292f; background: var(--paper); }
pre code { background: none; border: 0; padding: 0; font-size: inherit; }
/* Xcode light. */
.k { color: #ad3da4; } .t { color: #0b4f79; } .f { color: #326d74; }
.s { color: #c41a16; } .n { color: #1c00cf; } .c { color: #5d6c79; }

/* A live component sitting beside its own source. */
.demo { display: grid; grid-template-columns: 1fr 210px; gap: 0;
        border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
        background: var(--paper); }
.demo .editor { border: 0; border-radius: 0; border-right: 1px solid var(--line); }
.demo .run { display: grid; place-items: center; background:
             repeating-conic-gradient(#f7f8f9 0 25%, #fff 0 50%) 50%/16px 16px; }
@media (max-width: 760px) {
  .demo { grid-template-columns: 1fr; }
  .demo .editor { border-right: 0; border-bottom: 1px solid var(--line); }
  .demo .run { height: 170px; }
}

/* ---- Prose -------------------------------------------------------------- */

.page-header { padding: 54px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.page-header h1 { font-size: clamp(30px, 4.6vw, 44px); margin-bottom: 12px; }
.page-header .meta { color: var(--dimmer); font-size: 13px; margin: 0 0 28px; }

.prose { padding-bottom: 20px; font-size: 15.5px; }
.prose h2 { font-size: 21px; font-weight: 750; letter-spacing: -.026em; margin: 44px 0 12px; }
.prose h3 { font-size: 16px; font-weight: 700; margin: 30px 0 8px; letter-spacing: -.018em; }
.prose p, .prose li { color: var(--ink-2); }
.prose p { margin: 0 0 16px; }
.prose ul, .prose ol { margin: 0 0 16px; padding-left: 22px; }
.prose li { margin-bottom: 8px; }
.prose li::marker { color: var(--dimmer); }
.prose strong { color: var(--ink); font-weight: 700; }
.prose .demo, .prose .editor { margin: 0 0 22px; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14px; }
.prose th, .prose td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line);
                       vertical-align: top; }
.prose th { color: var(--dim); font-weight: 700; font-size: 11px; letter-spacing: .09em;
            text-transform: uppercase; }
.prose .scroll { overflow-x: auto; }
.callout { background: var(--orange-soft); border: 1px solid #ffd9cf; border-radius: 14px;
           padding: 18px 20px; margin: 0 0 26px; }
.callout p:last-child { margin-bottom: 0; }

/* ---- Blog --------------------------------------------------------------- */

.posts { display: grid; gap: 14px; }
.post-row { display: grid; grid-template-columns: 104px 1fr; gap: 22px; align-items: center;
            background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
            padding: 18px 22px; transition: .18s ease; }
.post-row:hover { border-color: var(--line-2); transform: translateY(-2px);
                  box-shadow: 0 14px 30px -20px rgba(16,20,26,.35); }
.post-row .thumb { width: 104px; height: 104px; border-radius: 20px; background: var(--paper);
                   border: 1px solid var(--line); display: grid; place-items: center; }
.post-row h3 { margin: 0 0 6px; font-size: 17px; font-weight: 750; letter-spacing: -.025em; }
.post-row p { margin: 0; color: var(--dim); font-size: 13.5px; }
.post-row .when { display: block; margin-top: 8px; font: 500 11px/1 var(--mono); color: var(--dimmer); }
@media (max-width: 620px) {
  .post-row { grid-template-columns: 1fr; gap: 14px; }
  .post-row .thumb { display: none; }
}

/* ---- Home --------------------------------------------------------------- */

.hero-center { text-align: center; padding: 70px 0 0; margin: 0; }
.hero-center h1 { max-width: 19ch; margin-inline: auto; }
.lede.centered { margin-inline: auto; text-align: center; margin-bottom: 26px; }
.actions { display: flex; justify-content: center; gap: 10px; margin: 0; flex-wrap: wrap; }
.hero-center .sub { text-align: center; }
@media (max-width: 760px) { .hero-center { padding-top: 40px; } }

/* Tile rows run edge to edge; the wrap's padding would cut the mask short. */
.bleed { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.bleed .reveal { padding: 0 24px; margin-bottom: 46px; }
.rows { padding: 26px 0 34px; }

/* Code is wider than prose. A 720px measure is right for sentences and too
   narrow for a line of SwiftUI, so demos break out of the column. */
@media (min-width: 1040px) {
  .prose .demo, .prose .editor { margin-inline: -110px; }
}
@media (min-width: 860px) and (max-width: 1039px) {
  .prose .demo, .prose .editor { margin-inline: -46px; }
}
