html {
  font-size: 14px;
  color-scheme: light;
  background: #fff;
  /* Kills the grey box mobile browsers flash over a tapped link.
     Inherited, so it covers every element on the page. */
  -webkit-tap-highlight-color: transparent;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
    margin: 0;
    padding: 0;
    border: 0;
    background: #fff;
    font-size: 100%;
    vertical-align: baseline;
    /* Pinned explicitly: the serif look used to rely on `font: inherit`
       falling through to the browser default, which is sans on some
       Android browsers. */
    font-family: "Times New Roman", Times, serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Behind the content, and never allowed to push the layout down. */
#blood-rain {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

body > header,
body > .container,
body > footer {
    position: relative;
    z-index: 1;
}

body > .container {
    flex: 1 0 auto;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

footer {
    margin-top: auto;
    position: relative;
    z-index: 1;
    color: #000;
    opacity: 0.55;
    background: transparent;
    padding: 12px 0 20px;
}

a,
a:visited,
a:hover,
a:active,
a.nav-link,
a.nav-link:visited,
a.nav-link:hover {
    color: black;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 32px;
    margin-top: 40px;
}

.work-item img {
    width: 100%;
    display: block;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.work-item:hover img {
    filter: grayscale(0%);
}

.work-caption {
    margin-top: 10px;
    font-size: 14px;
    opacity: 0.7;
}

/* Used to be a flat 543px, which overflowed the 1fr grid track and gave
   the page a horizontal scrollbar. Spanning two tracks keeps it wider
   than its neighbours without escaping the grid. */
@media (min-width: 901px) {
    .work-item-wide {
        width: auto;
        max-width: 100%;
        grid-column: span 2;
    }
}

a {
    display: inline-block;
    transition: transform 0.2s ease;
}

@media (hover: hover) {
    a:not(.newpoke-link):not(.nav-link):hover {
        transform: translateX(6px);
    }
}

/* ===== DESKTOP: main page ===== */
.home-page .page .text-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.home-page .page p {
    margin: 0.1em 0;
    width: fit-content;
}

.home-page .page a:not(.nav-link) {
    padding: 0.15em 0.4em;
    transform-origin: center center;
    font-size: 1.15rem;
}

.home-page .page .display-4,
.home-page .page h1 {
    font-size: clamp(2rem, 6vw, 3.5rem);
    margin: 0.4em 0 0.5em;
}

@media (hover: hover) {
    .home-page .page a:not(.nav-link):hover {
        transform: scale(1.35);
        text-decoration: none;
    }
}

.site-header {
    position: absolute;
    top: 0;
    right: 20px;
    width: 250px;
    z-index: 9999999;
    isolation: isolate;
    pointer-events: none;
    display: block;
}

.newpoke-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 32px;
    margin: 40px 0;
}

.newpoke-item {
    position: relative;
    z-index: 1;
    filter: blur(0);
    opacity: 1;
    transition: filter 0.4s ease, opacity 0.4s ease;
}

.newpoke-link {
    display: block;
    position: relative;
    transform: none;
    transition: transform 0.45s ease;
    color: black;
    text-decoration: none;
}

@media (hover: hover) {
    .newpoke-link:hover {
        transform: scale(1.35) translateY(-18px);
        text-decoration: none;
        color: black;
    }

    /* Keyed off the link rather than the grid, so the gaps between the
       tiles are dead space: the blur only starts once the cursor is
       actually over an image. */
    .newpoke-grid:has(.newpoke-link:hover) .newpoke-item {
        filter: blur(4px);
        opacity: 0.3;
    }

    .newpoke-grid .newpoke-item:has(.newpoke-link:hover) {
        filter: blur(0);
        opacity: 1;
    }
}

.newpoke-item img {
    width: 100%;
    display: block;
}

.newpoke-caption-overlay {
    margin-top: 10px;
    font-size: 13px;
    letter-spacing: 0.15em;
    color: black;
    opacity: 0.7;
    text-align: center;
    transition: opacity 0.3s ease;
}

@media (hover: hover) {
    .newpoke-item:hover {
        z-index: 10;
    }

    .newpoke-item:hover .newpoke-caption-overlay {
        opacity: 1;
    }
}

.newpoke-page {
    overflow-x: hidden;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        margin-top: 12px;
    }
    to {
        opacity: 1;
        margin-top: 0;
    }
}

/* ===== MOBILE (phones / narrow screens / touch) ===== */
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
    }

    body {
        justify-content: flex-start !important;
        align-items: stretch !important;
    }

    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        margin: 0;
        padding: 0 12px;
        text-align: center;
    }

    header .nav-link {
        align-self: flex-start;
    }

    header .nav-link,
    a.nav-link {
        color: #000 !important;
        text-decoration: none !important;
        font-size: 1rem;
    }

    /* No hover on touch, so an underline on :hover would only ever show
       up as a stuck state after a tap. */
    a,
    a:link,
    a:visited,
    a:hover,
    a:active {
        color: #000 !important;
        text-decoration: none !important;
    }

    .site-header {
        position: static !important;
        top: auto !important;
        right: auto !important;
        width: min(88vw, 300px) !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 auto 2px !important;
        display: block !important;
    }

    body > .container {
        flex: 1 1 auto !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 16px 12px !important;
        box-sizing: border-box !important;
    }

    .home-page > .container {
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: flex-start !important;
        padding-top: 2vh !important;
    }

    main {
        width: 100%;
        padding-bottom: 0 !important;
    }

    .home-page .page {
        width: 100%;
        padding-top: 0;
    }

    .home-page .page .text-center {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: 100% !important;
        text-align: center !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .home-page .page h1,
    .home-page .page .display-4 {
        font-size: 1.9rem !important;
        margin: 0.1em 0 0.25em !important;
        text-align: center !important;
        width: 100% !important;
    }

    .home-page .page p {
        margin: 0.05em 0 !important;
        width: 100% !important;
        text-align: center !important;
    }

    .home-page .page a,
    .home-page .page a:visited,
    .home-page .page a:hover,
    .home-page .page a:active {
        color: #000 !important;
        text-decoration: none !important;
        display: inline-block !important;
        font-size: 1.15rem !important;
        padding: 0.4em 0.75em !important;
        transform: none !important;
        text-align: center !important;
    }

    h1 {
        font-size: 1.75rem;
        line-height: 1.25;
        text-align: center;
    }

    main {
        text-align: center;
    }

    main h1,
    main p {
        text-align: center;
        margin-left: auto;
        margin-right: auto;
    }

    .newpoke-page,
    .page {
        overflow-x: hidden;
        text-align: center;
    }

    .newpoke-grid,
    .works-grid {
        grid-template-columns: 1fr !important;
        gap: 36px;
        margin: 28px auto;
        justify-items: center;
    }

    .work-item,
    .newpoke-item {
        width: min(78vw, 320px);
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 0;
        text-align: center;
    }

    .work-item img,
    .newpoke-item img {
        width: 100%;
        height: auto;
        display: block;
        margin: 0 auto;
    }

    .work-caption {
        margin-top: 10px;
        font-size: 14px;
        letter-spacing: normal;
        opacity: 0.7;
        text-align: center;
        display: block;
        width: 100%;
        color: #000;
    }

    .newpoke-caption-overlay {
        margin-top: 10px;
        font-size: 13px;
        letter-spacing: 0.15em;
        opacity: 0.7;
        text-align: center;
        display: block;
        width: 100%;
        color: #000;
    }

    .newpoke-link,
    .newpoke-link:visited,
    .newpoke-link:hover {
        transform: none !important;
        color: #000 !important;
        text-decoration: none !important;
        display: block;
        text-align: center;
    }

    .work-item-wide {
        width: min(78vw, 320px) !important;
        max-width: 100%;
        margin-left: auto;
        margin-right: auto;
    }

    footer {
        margin-top: auto;
        padding: 8px 16px 16px;
    }
}
