/* Code7G site styles. One file shared by every page, so the browser caches it once.
   Light is the base; dark comes from the system setting or the toggle (data-theme). */

:root {
    color-scheme: light;
    /* Brand colours, sampled from the Code7G logo (assets/img/code7g/logo-source.png): aqua at the
       top-left to purple at the bottom-right. The aqua is too pale to carry white text or to sit as
       text on the light background, so the two logo colours are only used where nothing has to be read
       on them (logo mark, favicon, glows, borders, button glow). Fills with white text and gradient
       text use deeper shades of the same two hues that keep WCAG AA contrast. */
    --logo-aqua: #1ff2cb;
    --logo-purple: #b260ee;
    --grad-start: #08826b; /* white text 4.8:1 */
    --grad-end: #a23fea;   /* white text 4.7:1 */
    --text-grad-start: #077c66; /* on --bg 4.8:1 */
    --text-grad-end: #9d35e9;   /* on --bg 4.7:1 */
    --bg: #f5f6fa;
    --bg-card: #ffffff;
    --bg-soft: #eceef5;
    --text: #14181f;
    --muted: #4b5565;
    --strong: #05070c;
    --accent: #8918dd; /* deeper logo purple, 6.0:1 on --bg */
    --accent-soft: rgba(137, 24, 221, 0.10);
    --border: rgba(9, 14, 30, 0.10);
    --border-strong: rgba(9, 14, 30, 0.18);
    --glow-1: rgba(178, 96, 238, 0.14);
    --glow-2: rgba(31, 242, 203, 0.14);
    --shadow: 0 1px 2px rgba(9, 14, 30, 0.04), 0 8px 24px rgba(9, 14, 30, 0.06);
    --shadow-hover: 0 2px 4px rgba(9, 14, 30, 0.05), 0 18px 40px rgba(9, 14, 30, 0.10);
    --ok: #0f7b3f;
    --ok-soft: rgba(15, 123, 63, 0.10);
    --soon: #8a5a00;
    --soon-soft: rgba(196, 132, 0, 0.13);
    --radius: 18px;
    --radius-sm: 10px;
    --font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
    --wrap: 1120px;
    --gutter: clamp(18px, 5vw, 32px);
}

/* The dark values are written twice (system preference and forced toggle) instead of using
   light-dark(), so older Android WebViews still get them. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --bg: #080b12;
        --bg-card: #0f141f;
        --bg-soft: #141a27;
        --text: #e6e9f2;
        --muted: #a2abc2;
        --strong: #ffffff;
        --accent: #1ff2cb; /* logo aqua, 13.7:1 on --bg */
        --accent-soft: rgba(31, 242, 203, 0.12);
        --text-grad-start: #1ff2cb; /* logo aqua on --bg 13.7:1 */
        --text-grad-end: #b260ee;   /* logo purple on --bg 5.4:1 */
        --border: rgba(255, 255, 255, 0.09);
        --border-strong: rgba(255, 255, 255, 0.18);
        --glow-1: rgba(178, 96, 238, 0.30);
        --glow-2: rgba(31, 242, 203, 0.16);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-hover: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 44px rgba(0, 0, 0, 0.45);
        --ok: #5fd28f;
        --ok-soft: rgba(95, 210, 143, 0.12);
        --soon: #f2c25c;
        --soon-soft: rgba(242, 194, 92, 0.12);
    }
}
:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #080b12;
    --bg-card: #0f141f;
    --bg-soft: #141a27;
    --text: #e6e9f2;
    --muted: #a2abc2;
    --strong: #ffffff;
    --accent: #1ff2cb;
    --accent-soft: rgba(31, 242, 203, 0.12);
    --text-grad-start: #1ff2cb;
    --text-grad-end: #b260ee;
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);
    --glow-1: rgba(178, 96, 238, 0.30);
    --glow-2: rgba(31, 242, 203, 0.16);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 1px 2px rgba(0, 0, 0, 0.4), 0 20px 44px rgba(0, 0, 0, 0.45);
    --ok: #5fd28f;
    --ok-soft: rgba(95, 210, 143, 0.12);
    --soon: #f2c25c;
    --soon-soft: rgba(242, 194, 92, 0.12);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.6;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
main { flex: 1; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; border-radius: 3px; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:where(a, button, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { background: var(--accent-soft); color: var(--strong); }
h1, h2, h3 { color: var(--strong); line-height: 1.2; letter-spacing: -0.02em; }
p { max-width: 68ch; text-wrap: pretty; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--bg-card); padding: 8px 14px; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }

/* Soft glow behind the top of each page, pinned so it never stretches with page height.
   Radial gradients fade out smoothly; blurred shapes left a visible edge and cost more on phones. */
.atmosphere {
    position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 45% -10%, var(--glow-1), transparent 75%),
        radial-gradient(ellipse 50% 45% at 100% -5%, var(--glow-2), transparent 75%);
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .site-header { background: var(--bg); }
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--strong); letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark {
    display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
    background: linear-gradient(135deg, var(--logo-aqua), var(--logo-purple));
    color: #fff; font-size: 0.8rem; font-weight: 800; letter-spacing: -0.04em;
    /* White on the pale aqua end is faint at this size; a soft shadow keeps "7G" readable. */
    text-shadow: 0 1px 2px rgba(20, 30, 60, 0.28);
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a { color: var(--muted); padding: 8px 12px; border-radius: 999px; font-size: 0.95rem; font-weight: 500; }
.nav a:hover { color: var(--strong); background: var(--accent-soft); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--strong); background: var(--accent-soft); }
.theme-toggle {
    display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; margin-left: 4px;
    border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card);
    color: var(--muted); cursor: pointer;
}
.theme-toggle:hover { color: var(--strong); border-color: var(--border-strong); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
html:not(.js) .theme-toggle { display: none; }
@media (max-width: 520px) {
    .brand-name { display: none; }
    .nav a { padding: 8px 9px; font-size: 0.92rem; }
}

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 10vw, 104px) 0 clamp(8px, 3vw, 24px); }
.eyebrow {
    display: inline-block; padding: 6px 14px; margin-bottom: 22px;
    font-family: var(--mono); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase;
    background: linear-gradient(135deg, var(--grad-start), var(--grad-end)); color: #fff; border-radius: 999px;
}
.hero h1 { font-size: clamp(2.6rem, 8vw, 4.75rem); line-height: 1.02; letter-spacing: -0.045em; margin: 0 0 22px; }
/* The gradient is twice the text's width and runs aqua, purple, aqua, so sliding it slowly
   gives a soft shimmer that loops without a jump. */
.hero h1 .grad {
    background: linear-gradient(110deg, var(--text-grad-start), var(--text-grad-end) 50%, var(--text-grad-start));
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
    animation: shimmer 9s ease-in-out infinite alternate;
}
@keyframes shimmer { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.lead { font-size: clamp(1.08rem, 2.3vw, 1.28rem); color: var(--muted); max-width: 52ch; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 999px;
    font-weight: 600; font-size: 0.97rem; border: 1px solid var(--border-strong); color: var(--strong); background: var(--bg-card);
}
.btn { transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease; }
.btn:hover { text-decoration: none; border-color: var(--accent); transform: translateY(-1px); }
.btn-primary { background: linear-gradient(135deg, var(--grad-start), var(--grad-end)); color: #fff; border-color: transparent; }
/* No brightness filter on hover: it would lift the fill and push white-text contrast below AA. */
.btn-primary:hover { box-shadow: 0 8px 24px rgba(178, 96, 238, 0.24), 0 4px 14px rgba(31, 242, 203, 0.22); }
.btn svg { width: 18px; height: 18px; }

/* ---------- Sections ---------- */
.section { padding: clamp(28px, 6vw, 64px) 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.section-tight { padding-top: 8px; padding-bottom: 8px; }
.section h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 0; }
.section-head a { font-weight: 600; }
.page-title { margin: 0; font-size: clamp(2rem, 6vw, 3rem); letter-spacing: -0.035em; }
.section p { color: var(--muted); }

/* ---------- App cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.card {
    position: relative; display: flex; flex-direction: column; gap: 14px; padding: 24px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
/* On hover the border turns into the logo gradient: the card colour fills the padding box and the
   gradient shows only through the 1px transparent border. */
a.card:hover {
    text-decoration: none; transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: transparent;
    background: linear-gradient(var(--bg-card), var(--bg-card)) padding-box,
                linear-gradient(135deg, var(--logo-aqua), var(--logo-purple)) border-box;
}
.card .app-icon { transition: transform 0.25s ease; }
a.card:hover .app-icon { transform: scale(1.06) rotate(-2deg); }
.card-top { display: flex; align-items: center; gap: 14px; }
.app-icon { width: 60px; height: 60px; border-radius: 15px; flex: none; background: var(--bg-soft); box-shadow: 0 0 0 1px var(--border); }

/* Home hero: app icons beside the text on wide screens, so the right half isn't empty. */
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 40px; align-items: center; }
.hero-art { display: none; }
@media (min-width: 900px) {
    .hero-grid { grid-template-columns: 1.4fr 1fr; }
    /* Three columns, middle one shifted down, so six icons read as a loose cluster, not a table. */
    .hero-art { display: grid; grid-template-columns: repeat(3, 108px); gap: 20px; justify-content: center; }
    .hero-art a { display: block; border-radius: 26px; transition: transform 0.2s ease; }
    .hero-art a:nth-child(3n+2) { transform: translateY(22px); }
    .hero-art a:hover { transform: translateY(-4px); }
    .hero-art a:nth-child(3n+2):hover { transform: translateY(18px); }
    .hero-art img { width: 108px; height: 108px; border-radius: 26px; background: var(--bg-soft); box-shadow: var(--shadow-hover), 0 0 0 1px var(--border); }
    /* Gentle float on the img (the link already carries the offset transform), each icon out of step. */
    .hero-art img { animation: float 6s ease-in-out infinite; }
    .hero-art a:nth-child(2) img { animation-delay: -1s; }
    .hero-art a:nth-child(3) img { animation-delay: -2s; }
    .hero-art a:nth-child(4) img { animation-delay: -3s; }
    .hero-art a:nth-child(5) img { animation-delay: -4s; }
    .hero-art a:nth-child(6) img { animation-delay: -5s; }
}
.app-icon-text {
    display: grid; place-items: center; font-family: var(--mono); font-weight: 700; font-size: 1.05rem;
    color: #fff; background: linear-gradient(135deg, #1b2333, #2b3a55);
}
.card h3 { margin: 0; font-size: 1.15rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.96rem; }
.card .more { margin-top: auto; font-weight: 600; color: var(--accent); font-size: 0.93rem; }

.status {
    display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: 999px;
    font-size: 0.74rem; font-weight: 600; letter-spacing: 0.02em;
}
.status-live { color: var(--ok); background: var(--ok-soft); }
.status-soon { color: var(--soon); background: var(--soon-soft); }
.status-android { color: var(--accent); background: var(--accent-soft); }

/* ---------- Feature list (home) ---------- */
.points { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.point { padding: 22px 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); }
.point h3 { margin: 0 0 8px; font-size: 1.05rem; }
.point p { margin: 0; font-size: 0.96rem; }

/* ---------- App page ---------- */
.app-hero { padding: clamp(40px, 8vw, 80px) 0 clamp(24px, 4vw, 40px); }
.app-hero .crumbs { font-size: 0.9rem; margin-bottom: 22px; color: var(--muted); }
.app-hero-row { display: flex; gap: clamp(18px, 4vw, 28px); align-items: center; }
.app-hero .app-icon { width: clamp(80px, 16vw, 112px); height: clamp(80px, 16vw, 112px); border-radius: 24%; box-shadow: var(--shadow); }
.app-hero h1 { font-size: clamp(2rem, 6vw, 3.2rem); margin: 0 0 6px; letter-spacing: -0.035em; }
.app-hero .app-icon-text { font-size: clamp(1.4rem, 4vw, 2rem); }
.app-hero .tagline { margin: 0; color: var(--muted); font-size: clamp(1.02rem, 2.2vw, 1.2rem); }
.note { font-size: 0.9rem; color: var(--muted); margin-top: 14px; }
/* Phones: icon above the name, so long names like "Motivational Alarm" get the full width. */
@media (max-width: 560px) {
    .app-hero-row { flex-direction: column; align-items: flex-start; gap: 16px; }
    .app-hero .app-icon { width: 80px; height: 80px; }
    .app-hero .actions .btn { flex: 1 1 auto; justify-content: center; }
}

.feature-graphic { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.feature-graphic img { width: 100%; }

/* Screenshot strip: scrolls sideways with snap points; images load lazily. */
.shots {
    display: grid; grid-auto-flow: column; grid-auto-columns: clamp(170px, 42vw, 240px);
    gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 4px 18px;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
.shots img {
    scroll-snap-align: start; width: 100%; aspect-ratio: 9 / 16; object-fit: cover;
    border-radius: 16px; border: 1px solid var(--border); background: var(--bg-soft);
}
/* Landscape screenshots (AGTA's terminal captures, 1200 x 600). */
.shots-wide { grid-auto-columns: clamp(260px, 84vw, 600px); }
.shots-wide img { aspect-ratio: 2 / 1; }
.shots::-webkit-scrollbar { height: 8px; }
.shots::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }

.prose h2 { font-size: clamp(1.35rem, 3vw, 1.7rem); margin: 2.2em 0 0.6em; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { font-size: 1.1rem; margin: 1.8em 0 0.4em; }
.prose p, .prose li { color: var(--muted); max-width: 72ch; }
.prose ul { padding-left: 1.2em; max-width: 72ch; }
.prose li { margin: 0.35em 0; }
.prose strong { color: var(--text); }
/* Long URLs in the policies would otherwise run off a 320 px screen (body hides x overflow). */
.prose a { overflow-wrap: anywhere; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.feature { padding: 22px 24px; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border); }
.feature h3 { margin: 0 0 10px; font-size: 1.05rem; }
.feature ul { margin: 0; padding-left: 1.1em; color: var(--muted); font-size: 0.96rem; }
.feature li { margin: 0.3em 0; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 0; }
.facts div { padding: 16px 18px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); }
.facts dt { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.facts dd { margin: 4px 0 0; font-weight: 600; color: var(--strong); }

/* ---------- Policy pages ---------- */
.policy { padding: clamp(40px, 7vw, 72px) 0; }
.policy h1 { font-size: clamp(1.8rem, 5vw, 2.6rem); margin: 0 0 8px; }
.policy .updated { color: var(--muted); margin: 0 0 32px; }
.policy-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; max-width: 640px; }
.policy-list a {
    display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border); color: var(--strong); font-weight: 600;
}
.policy-list a:hover { border-color: var(--accent); text-decoration: none; }
.policy-list img { width: 40px; height: 40px; border-radius: 10px; }

/* ---------- Contact ---------- */
.contact-box {
    display: inline-flex; flex-direction: column; gap: 6px; padding: 20px 24px;
    border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-card);
}
.contact-box a { font-family: var(--mono); font-size: 1rem; word-break: break-all; }

/* ---------- Footer ---------- */
.site-footer { margin-top: 48px; border-top: 1px solid var(--border); padding: 32px 0 40px; font-size: 0.9rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px 28px; justify-content: space-between; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 20px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--strong); }

@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* ---------- Scroll reveal ----------
   site.js adds .reveal only when IntersectionObserver exists and reduced motion is off, so without
   JS everything is simply visible. It removes both classes after the fade so hover transitions work
   normally again. */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.55s ease, transform 0.55s ease; transition-delay: var(--reveal-delay, 0ms); }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
