/* ==========================================================================
   scottgross.works -- the ONE stylesheet for index.html
   Dark "phone wallpaper" theme (VSCode Dark palette + SGW gold)
   Sections:  tokens | base | header | grid + tiles | results + TCS posts | footer
   ========================================================================== */


/* ---------- FONTS (self-hosted, Latin subset, from Google Fonts) ---------- */
@font-face {
    font-family: "Montserrat";
    font-style: normal;
    font-weight: 100 900;          /* one variable file covers every weight */
    font-display: swap;
    src: url("/fonts/montserrat-latin.woff2") format("woff2");
}
@font-face {
    font-family: "Syncopate";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/syncopate-700-latin.woff2") format("woff2");
}


/* ---------- TOKENS ---------- */
:root {
    --bg:        #1e1e1e;   /* page            (VSCode editor)  */
    --bg-bar:    #181818;   /* header / footer (VSCode title bar) */
    --bg-raise:  #2b2b30;   /* pills, placeholders               */
    --border:    #2e2e32;
    --text:      #cccccc;
    --muted:     #9a9a9a;
    --gold:      #fcd404;   /* the SGW logo gold */

    --card:      #f4f4f2;   /* TCS posts = light cards on the dark page */
    --card-text: #222222;

    --font:      "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mark: "Syncopate", var(--font);

    --radius-tile: 22%;     /* phone app-icon corners */
    --radius-card: 18px;
}


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

html { background: var(--bg); scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--text);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
    /* soft glow at the top, like a wallpaper */
    background: radial-gradient(900px 520px at 50% -120px, #2c2c31 0%, var(--bg) 70%) no-repeat;
}

main { flex: 1; }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
}


/* ---------- HEADER STRIP ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 16px;
    background: rgba(24, 24, 24, 0.85);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--border);
}

.wordmark {
    color: var(--gold);
    text-decoration: none;
    font-family: var(--font-mark);
    font-weight: 700;
    font-size: clamp(10px, 2.8vw, 15px);
    letter-spacing: 0.3em;
    white-space: nowrap;
}

.social { display: flex; gap: 6px; }

.social a {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.social a:hover, .social a:focus-visible { background: var(--bg-raise); }

/* SVG icons tinted by CSS (mask), so they match the theme */
.icon {
    display: block;
    width: 20px;
    height: 20px;
    background: var(--text);
    -webkit-mask: var(--src) center / contain no-repeat;
    mask: var(--src) center / contain no-repeat;
}
.social a:hover .icon { background: var(--gold); }

.icon-github { --src: url("/img_sgw/gitHub_icon.svg"); }
.icon-ig     { --src: url("/img_sgw/IG_logo.svg"); }
.icon-email  { --src: url("/img_sgw/email.svg"); }


/* ---------- GRID + TILES ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);              /* phones: 3 across, roomy like a home screen */
    gap: 30px 34px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 26px 40px;
}

@media (min-width: 700px) {
    .grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));   /* 4-6 across */
        gap: 30px 26px;
        padding-top: 40px;
    }
}

.tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.tile img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-tile);
    background: var(--bg-raise);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.06);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tile:hover img,
.tile:focus-visible img {
    transform: scale(1.05);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.55), 0 0 0 2px var(--gold);
}

.tile:focus-visible { outline: none; }

.tile:active img { transform: scale(0.97); }

/* the tile whose results are showing */
.tile.active img { box-shadow: 0 0 0 3px var(--gold), 0 8px 22px rgba(0, 0, 0, 0.5); }
.tile.active span { color: var(--gold); }

.tile span {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: center;
    line-height: 1.2;
}

/* scroll-in "enlarge" animation -- only when JS is running (html.js) */
.js .tile {
    opacity: 0;
    transform: scale(0.82) translateY(14px);
    transition: opacity 0.45s ease var(--delay, 0ms),
                transform 0.6s cubic-bezier(0.2, 0.9, 0.25, 1.15) var(--delay, 0ms);
}
.js .tile.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
    .js .tile { opacity: 1; transform: none; transition: none; }
}


/* ---------- RESULTS ---------- */
#results {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 56px;
    scroll-margin-top: 64px;          /* land below the sticky header */
    border-top: 1px solid var(--border);
    padding-top: 32px;
}

/* loading placeholders while TagCloudSearch.php answers */
.skeleton {
    height: 240px;
    margin: 0 0 22px;
    border-radius: var(--radius-card);
    background: linear-gradient(90deg, #2a2a2d 25%, #35353a 37%, #2a2a2d 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
}
.skeleton:nth-child(2) { height: 180px; opacity: 0.7; }
.skeleton:nth-child(3) { height: 140px; opacity: 0.45; }

@keyframes shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* "nothing found" / "server is slow" message */
.notice {
    margin: 0 0 22px;
    padding: 22px;
    border-radius: var(--radius-card);
    border: 1px dashed #44444a;
    color: var(--muted);
    text-align: center;
    font-size: 14px;
}
.notice button {
    margin-top: 12px;
    padding: 8px 18px;
    border: 0;
    border-radius: 999px;
    background: var(--gold);
    color: #111;
    font: 600 13px var(--font);
    cursor: pointer;
}

body.searchWaiting { cursor: progress; }


/* ---------- TCS POSTS (HTML comes from /TCS_POSTS/*.html) ---------- */
.TCS_blogPost {
    margin: 0 0 22px;
    padding: 18px 18px 6px;
    border-radius: var(--radius-card);
    background: var(--card);
    color: var(--card-text);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    font-size: 15px;
    line-height: 1.55;
    overflow: hidden;
    animation: rise 0.35s ease both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .TCS_blogPost, .skeleton { animation: none; }
}

.TCS_blogPost img,
.TCS_blogPost video,
.TCS_blogPost iframe { max-width: 100%; height: auto; }

.TCS_blogPost a { color: #0b57d0; }

.TCS_date {
    width: fit-content;
    margin: 0 0 6px auto;
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--bg-raise);
    color: var(--gold);
    font-size: 12px;
    letter-spacing: 0.1em;
}

.TCS_postUrl {
    display: block;
    margin: 12px auto 0;
    border-radius: 12px;
}
img.TCS_postUrl { width: 100%; }

.TCS_caption {
    display: block;
    margin: 14px 0 0;
    overflow-x: hidden;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.TCS_table { display: table !important; width: 100%; margin: 12px 0 0; }
.TCS_table table { width: 100%; text-align: center; }
.TCS_table td { width: 50%; padding: 4px; }
.TCS_table td img { width: 100%; border-radius: 8px; }
.TCS_table .TCS_postUrl { width: 100% !important; padding: 0 !important; }

.TCS_galleryButton {
    display: block;
    width: max-content;
    margin: 0 auto;
    padding: 12px 18px;
    border-radius: 999px;
    background: #1a8f3c;
    color: #fff;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.TCS_galleryButton:hover { background: #20a648; }
.TCS_galleryButton a { color: #fff; text-decoration: none; }

/* tags at the bottom of a post -- tap one to search it */
.TCS_blogPost .TCS_bricks {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 14px 0 12px;
    padding: 0;
    list-style: none;
}
.TCS_blogPost .TCS_bricks li {
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--bg-raise);
    color: var(--gold);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.TCS_blogPost .TCS_bricks li:hover { background: #111; }

.TCS_hidden  { display: none !important; }


/* ---------- FOOTER ---------- */
.footer {
    padding: 22px 16px;
    border-top: 1px solid var(--border);
    background: var(--bg-bar);
    color: #8a8a8a;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}
