/*
 * Grammar Buffet — modern landing page styles
 * Vanilla CSS: custom properties, flexbox and grid. No framework.
 */

:root {
    --teal: #18bc9c;
    --teal-dark: #0a7d68;      /* accessible link colour on white (>= 4.5:1) */
    --ink: #2c3e50;            /* primary text / dark accent */
    --ink-2: #233140;          /* footer bottom bar */
    --paper: #ffffff;
    --paper-2: #f4f7f8;
    --muted: #52616b;
    --border: #e3e8eb;
    --shadow: 0 6px 24px rgba(44, 62, 80, 0.12);
    --shadow-hover: 0 14px 36px rgba(44, 62, 80, 0.2);
    --radius: 14px;
    --nav-height: 64px;
    --font-heading: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
    --font-body: "Lato", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 16px);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

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

body {
    margin: 0;
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    overflow-x: hidden;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.15;
    text-transform: uppercase;
    color: var(--ink);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--teal-dark);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover,
a:focus {
    color: var(--ink);
}

:focus-visible {
    outline: 3px solid var(--ink);
    outline-offset: 2px;
    border-radius: 3px;
}

/* Skip link for keyboard / screen-reader users */
.skip-link {
    position: absolute;
    left: 8px;
    top: -60px;
    z-index: 2000;
    padding: 10px 16px;
    background: var(--ink);
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 8px;
    color: #fff;
}

.container {
    width: min(1140px, 100% - 2.5rem);
    margin-inline: auto;
}

/* ---------- Navigation ---------- */
.site-nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 1030;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--border);
    transition: height 0.3s ease, box-shadow 0.3s ease;
}

.site-nav.is-scrolled {
    height: 56px;
    box-shadow: 0 2px 14px rgba(44, 62, 80, 0.12);
}

.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(1140px, 100% - 2.5rem);
}

.brand {
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 1.3rem;
    color: var(--ink);
    text-decoration: none;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 1.75rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    font-family: var(--font-heading);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
    color: var(--ink);
    text-decoration: none;
}

.nav-links a:hover,
.nav-links a:focus {
    color: var(--teal-dark);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
}

.nav-toggle .bar {
    display: block;
    width: 22px;
    height: 2px;
    margin-inline: auto;
    background: var(--ink);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

@media (max-width: 767px) {
    .nav-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        flex-direction: column;
        gap: 0;
        background: rgba(255, 255, 255, 0.98);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        transform: scaleY(0);
        transform-origin: top;
        opacity: 0;
        pointer-events: none;
        transition: transform 0.2s ease, opacity 0.2s ease;
    }

    .nav-links.open {
        transform: scaleY(1);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links li {
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        padding: 1rem;
        border-top: 1px solid var(--border);
    }

    .nav-toggle[aria-expanded="true"] .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle[aria-expanded="true"] .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle[aria-expanded="true"] .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }
}

/* ---------- Hero ---------- */
.hero {
    background: var(--teal);
    color: var(--ink);
    text-align: center;
    padding: calc(var(--nav-height) + 5rem) 0 5rem;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2.4rem, 8vw, 5rem);
    letter-spacing: 1px;
}

.hero .tagline {
    display: block;
    margin-top: 0.75rem;
    font-family: var(--font-body);
    font-weight: 400;
    text-transform: none;
    font-size: clamp(1.1rem, 3vw, 1.6rem);
    color: var(--ink);
}

/* ---------- Sections ---------- */
section {
    padding: 5rem 0;
}

.section-title {
    text-align: center;
    margin: 0 0 2.5rem;
    font-size: clamp(1.6rem, 4vw, 2.6rem);
}

/* ---------- Applications ---------- */
.apps {
    display: grid;
    gap: 2rem;
}

.app-card {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 1.75rem;
    align-items: center;
    padding: 1.5rem;
    background: var(--paper);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.app-card:hover,
.app-card:focus-within {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.app-card__media {
    display: block;
    overflow: hidden;
    border-radius: 10px;
    line-height: 0;
}

.app-card__media img {
    width: 100%;
    transition: transform 0.4s ease;
}

.app-card:hover .app-card__media img {
    transform: scale(1.04);
}

.app-card__body h3 {
    margin: 0 0 0.75rem;
    font-size: 1.5rem;
}

.app-card__body h3 a {
    text-decoration: none;
    color: var(--ink);
}

.app-card__body h3 a:hover,
.app-card__body h3 a:focus {
    color: var(--teal-dark);
}

.app-card__meta {
    margin: 0.2rem 0;
    font-size: 1rem;
    color: var(--muted);
}

.app-card__meta strong {
    color: var(--ink);
}

.app-card__desc {
    margin: 0.75rem 0 0;
    font-size: 1rem;
    line-height: 1.6;
}

@media (max-width: 767px) {
    .app-card {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
}

/* ---------- About ---------- */
.about {
    background: var(--teal);
    color: var(--ink);
}

.about .section-title {
    color: var(--ink);
}

.about__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    max-width: 900px;
    margin-inline: auto;
}

.about p {
    margin: 0;
    font-size: 1.05rem;
}

.about a {
    color: var(--ink);
    font-weight: 700;
    text-decoration: underline;
}

.about a:hover,
.about a:focus {
    color: var(--ink-2);
}

/* ---------- Footer ---------- */
.site-footer {
    color: #fff;
    background: var(--ink);
}

.site-footer__top {
    padding: 3.5rem 0 2rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2rem;
    text-align: center;
}

.site-footer h3 {
    color: #fff;
    margin: 0 0 1rem;
    font-size: 1.15rem;
}

.site-footer p {
    margin: 0;
    color: #eaf0f2;
    font-size: 1rem;
}

.site-footer a {
    color: #fff;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border: 2px solid #fff;
    border-radius: 50%;
    color: #fff;
    background: transparent;
    transition: background 0.25s ease, color 0.25s ease;
}

.social-btn:hover,
.social-btn:focus {
    background: #fff;
    color: var(--ink);
}

.social-btn svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.site-footer__bottom {
    padding: 1.25rem 0;
    text-align: center;
    background: var(--ink-2);
}

.site-footer__bottom p {
    margin: 0;
    font-size: 0.9rem;
    color: #d6dee2;
}

/* ---------- Scroll-to-top ---------- */
.scroll-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1040;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    cursor: pointer;
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}

.scroll-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-top:hover,
.scroll-top:focus {
    background: var(--teal-dark);
}

.scroll-top svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* ---------- 404 page ---------- */
.notfound {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    padding: 2rem;
    text-align: center;
    background: var(--teal);
    color: var(--ink);
}

.notfound h1 {
    margin: 0;
    font-size: clamp(2rem, 6vw, 3.5rem);
}

.notfound p {
    margin: 0;
    font-size: 1.2rem;
    color: var(--ink);
}

.notfound a {
    color: var(--ink);
    font-weight: 700;
}
