/* ==========================================================================
   COMPONENTS: buttons, cards, badges, carousels
   ========================================================================== */

/* Buttons
   Solid, Apple-style pill buttons. The base is the primary (blue) button; the
   variants below only change colour. Icons inherit the text colour via
   currentColor, so variants never need their own svg rule. */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--ios-blue);
    color: #fff;
    padding: 12px 26px;
    border-radius: 99px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    font-family: inherit;
    line-height: 1;
    margin-top: 15px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(0, 122, 255, 0.30);
}

.btn:hover {
    background: var(--ios-blue-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.40);
}

.btn:active { transform: translateY(0) scale(0.98); }
.btn svg { width: 18px; height: 18px; fill: currentColor; }

/* Size modifier: the in-card App Store buttons */
.btn-appstore { align-self: center; font-size: 0.9rem; padding: 10px 22px; }

/* Full-width modifier: e.g. the contact form submit */
.btn-block { width: 100%; padding-top: 16px; padding-bottom: 16px; font-size: 1rem; }

/* Light/secondary button (used on dark surfaces like the hero feature card) */
.btn-light {
    background: #fff;
    color: #1d1d1f;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}
.btn-light:hover {
    background: #f1f1f4;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.24);
}

/* Dark button (GitHub, App Store developer page) */
.btn-dark {
    background: #1d1d1f;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.btn-dark:hover {
    background: #2c2c2e;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.32);
}

/* LinkedIn brand button */
.btn-linkedin {
    background: #0a66c2;
    color: #fff;
    box-shadow: 0 4px 14px rgba(10, 102, 194, 0.30);
}
.btn-linkedin:hover {
    background: #004182;
    box-shadow: 0 6px 20px rgba(10, 102, 194, 0.40);
}

/* Outline/secondary button (ring, no fill) */
.btn-outline {
    background: transparent;
    color: var(--link-blue);
    box-shadow: inset 0 0 0 2px var(--link-blue);
}
.btn-outline:hover {
    background: rgba(0, 122, 255, 0.08);
    box-shadow: inset 0 0 0 2px var(--link-blue);
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.social-link:hover { color: var(--link-blue); }

/* Glass Cards */
.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 24px;
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02), 0 12px 24px -4px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow: 0 20px 40px rgba(0,0,0,0.12);
}

/* Tilt-enabled cards (layout.js initTilt) track the cursor with an inline
   transform, so their transform transition must be short: the default 0.4s
   float would trail the pointer like rubber. */
.glass-card[data-tilt] { transition: transform 0.18s ease-out, box-shadow 0.4s ease; }

.card-content { padding: 35px; }

/* Assets & Badges */
.app-icon {
    width: 85px;
    height: 85px;
    border-radius: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-card:hover .app-icon { transform: scale(1.08) rotate(-3deg); }

.tech-badge {
    display: inline-block;
    background: #e5e5ea;
    color: #5d5d62; /* 4.5:1+ on the #e5e5ea chip */
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 100px;
    margin-right: 6px;
    margin-top: 6px;
}

/* Wrapping row of tech badges (resume skills) */
.badge-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

/* Hero Feature Card */
.hero-card {
    background-color: #1c1c1e;
    color: #f5f5f7;
    border-radius: 30px;
    padding: 50px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.4);
    margin-bottom: 60px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.hero-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.05), transparent 70%);
    pointer-events: none;
}

.hero-header { display: flex; align-items: center; gap: 30px; margin-bottom: 30px; flex-wrap: wrap; }
.hero-icon-large { width: 110px; height: 110px; border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.hero-title h1,
.hero-title h3 { font-size: 2.8rem; margin: 0 0 5px 0; color: white; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 1rem; color: #98989d; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.hero-badges { margin-top: 12px; }
.hero-lead { font-size: 1.1rem; line-height: 1.6; max-width: 800px; color: #e5e5e5; margin-bottom: 30px; }
.hero-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; margin: 35px 0; }
.hero-card .tech-badge { background: rgba(255, 255, 255, 0.2); color: #fff; border: 1px solid rgba(255, 255, 255, 0.1); }

.feature-item {
    background: rgba(255,255,255,0.08);
    padding: 20px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}

.feature-item:hover { background: rgba(255,255,255,0.12); }
.feature-item strong { color: #5ac8fa; display: block; margin-bottom: 8px; font-size: 1rem; }
.feature-item p { color: #d1d1d6; font-size: 0.95rem; margin: 0; line-height: 1.6; }

/* Bento Grid */
.bento-grid {
    display: grid;
    /* 400px min (not 320): at main's 1200px width a 320px min would fit a
       third column, which turns the About page's 2-up + full-width-span
       layout into a grid with a hole. 400 keeps every page at 2-up. */
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.grid-span-2 { grid-column: span 2; }

.product-card {
    position: relative; /* containing block for .card-link--overlay's stretched hit area */
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card .card-content { display: flex; flex-direction: column; height: 100%; }
.product-card h3 { margin-top: 0; margin-bottom: 6px; }
/* min-height reserves two lines regardless of how much a given app's
   description actually wraps, so cards with a one-line blurb don't end
   up shorter than a neighbor whose blurb wraps to two. */
.product-card p { margin: 0; color: var(--text-muted); font-size: 0.95rem; min-height: 2.85rem; }

/* "View on App Store / View Source" inline link on product cards.
   margin-top:auto pins the link to the bottom of the flex column so the
   icon + title + meta stay grouped at the top (instead of the description
   stretching and pushing the rating down), and the link never crowds the
   chips above it. */
.card-link {
    color: var(--link-blue);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none; /* .card-link is sometimes a real <a>, not a span */
    margin-top: auto;
    padding-top: 18px;
}
.product-card:hover .card-link { color: var(--ios-blue); }

/* Stretched-link variant: when a product card holds a second control (the
   featured video button), the card itself is a <div> and this real <a>
   covers it via ::after. Controls that must stay clickable stack above the
   overlay with their own z-index (see .card-video-wrap). */
.card-link--overlay::after { content: ""; position: absolute; inset: 0; }

/* Centered call-to-action under a section (e.g. "View All Projects") */
.section-cta { text-align: center; margin: 40px 0; }

/* Full App Catalog section: centered title with a pause control pinned right */
.catalog-section { margin-top: 80px; padding-bottom: 40px; }
.catalog-header { display: flex; align-items: center; }
.catalog-header h2 { margin: 0; flex: 0 0 auto; }
.catalog-header .spacer { flex: 1; }
.catalog-header .catalog-actions { flex: 1; display: flex; justify-content: flex-end; }

/* Circular icon buttons for the carousel controls (catalog pause +
   screenshot prev/next). One shared frosted skin built from theme tokens so
   both controls match each other and adapt to light/dark with no per-theme
   overrides. Hover mirrors the main .btn language: scale up + grow shadow. */
.carousel-pause-btn,
.screenshot-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    color: var(--text-color);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    box-shadow: 0 4px 14px var(--shadow-medium);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.carousel-pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

/* App Carousel */
.carousel-container {
    overflow: hidden;
    padding: 40px 0;
    white-space: nowrap;
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.carousel-track { display: inline-flex; animation: scroll 50s linear infinite; }
.carousel-track:hover { animation-play-state: paused; }

.carousel-card {
    width: 280px;
    margin-right: 30px; /* each card owns its trailing gap so the -50% loop lands cleanly */
    background: var(--card-bg);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    border: 1px solid var(--card-border);
    white-space: normal;
    flex-shrink: 0;
    text-align: left;
    transition: transform 0.3s ease;
}

.carousel-card:hover { transform: translateY(-8px); }
.carousel-card h3 { font-size: 1.2rem; }
.carousel-card p { font-size: 0.9rem; }

/* Screenshot Carousel (projects page) */
.screenshot-carousel {
    position: relative;
    margin: 20px -35px 0;
    overflow: hidden;
}

.screenshot-track {
    display: flex;
    gap: 10px;
    padding: 8px 35px;
    overflow-x: hidden;
    scrollbar-width: none;
}

.screenshot-track::-webkit-scrollbar { display: none; }

.screenshot-track img {
    flex: 0 0 calc((100% - 20px) / 3);
    min-width: 0;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    background: #f0f0f5;
    display: block;
}

/* Position-only: the arrows ride on top of the screenshot track, vertically
   centred. translateY(-50%) is preserved in the hover transform below. */
.screenshot-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    z-index: 2;
}

.screenshot-arrow:hover {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 20px var(--shadow-medium);
}

.screenshot-arrow-prev { left: 10px; }
.screenshot-arrow-next { right: 10px; }

/* Shipped-product cards use the same stretched-height layout as any other
   product card (see .product-card .card-content above) so every card in
   a row matches height regardless of description length or whether an
   app has a downloads figure. */

/* "Deep Dive into the Code" GitHub call-to-action card */
.code-cta { max-width: 500px; margin: 80px auto 40px; text-align: center; }
.code-cta p { color: var(--text-muted); margin-bottom: 25px; line-height: 1.5; }

/* App Store metrics on project cards: star rating, downloads, platforms.
   Real numbers from App Store Connect; downloads shown only where strong. */
.app-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.app-rating { display: inline-flex; align-items: center; gap: 8px; }
.app-rating .rating-num { color: var(--text-color); font-weight: 700; font-size: 0.9rem; }
.app-downloads { color: var(--text-muted); font-size: 0.85rem; }
/* Reserves the same line height as a real rating/downloads row without
   showing or announcing anything, so cards for apps without a public
   rating or a downloads figure still match the height of cards that
   have one. */
.is-placeholder { visibility: hidden; }
/* Platform chips reuse .tech-badge for visual parity with the resume skills.
   The chip rows space themselves with gap, so the legacy per-badge margins
   on .tech-badge are zeroed here (and in .badge-wrap) to avoid double gaps. */
.app-platforms { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* When platforms are the only meta row (e.g. KanaCard, no rating above),
   drop the extra top margin so they sit where the rating sits elsewhere. */
.app-meta > .app-platforms:first-child { margin-top: 0; }
.app-platforms .tech-badge,
.badge-wrap .tech-badge { margin: 0; }

/* Star bar: a grey row of stars with a gold overlay clipped to the rating.
   --fill is rating/5 as a percentage (4.3 -> 86%, 5.0 -> 100%). */
.stars {
    --fill: 100%;
    position: relative;
    display: inline-block;
    color: #d2d2d7;
    font-size: 1rem;
    line-height: 1;
    letter-spacing: 2px;
}
.stars::before { content: "\2605\2605\2605\2605\2605"; }
.stars::after {
    content: "\2605\2605\2605\2605\2605";
    position: absolute;
    left: 0;
    top: 0;
    width: var(--fill);
    overflow: hidden;
    color: #ff9f0a;
    text-shadow: 0 1px 3px rgba(255, 159, 10, 0.35);
}
.stars--5   { --fill: 100%; }

/* Full-video lightbox (see layout.js openVideoModal). A fixed overlay,
   so opening it never affects the grid/card it was launched from. */
.video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    background: rgba(0, 0, 0, 0.85);
}
.video-modal.is-open { display: flex; }

.video-modal-video {
    display: block;
    width: auto;
    height: auto;
    max-width: min(420px, 90vw);
    max-height: 90vh;
    border-radius: 24px;
    background: #000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.video-modal-close:hover { background: rgba(255, 255, 255, 0.25); }

/* Lock background scroll while the lightbox is open */
body.video-modal-open { overflow: hidden; }
