/*
Theme Name: Gatekeeper Tattoo
Author: Nic Masters
Version: 1.0.0
Requires at least: 6.7.0
Text Domain: gatekeeper
*/

/* ─────────────────────────────────────────────────────────────────────
   This file contains ONLY what cannot be expressed in theme.json:
   - Fixed/sticky positioning
   - CSS transitions & animations (JS-driven)
   - CSS transforms & filters
   - object-fit / clamp() on images
   - Hover effects using filter/opacity
   - Per-page-type link colour overrides (conditional, not global)

   All colours, typography defaults, spacing, and block defaults live
   in theme.json. Custom block styles live in their block's style.scss.
───────────────────────────────────────────────────────────────────── */

/* ──────────────────────────────
   Base resets
────────────────────────────── */

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

/* Opt in to native browser-driven view transitions between pages (e.g. artist
   archive → single artist), so the featured image can morph in place. */
@view-transition {
    navigation: auto;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    margin: 0;
}

img {
    max-width: 100%;
}

a {
    text-underline-offset: 3px;
    transition: opacity 0.15s ease, color 0.15s ease;
}

/* ──────────────────────────────
   Keyboard focus
   Dark outline on light backgrounds, gold on dark sections.
────────────────────────────── */

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--wp--preset--color--near-black);
    outline-offset: 3px;
}

:where(.site-header, .hero, .is-style-card, .site-footer) :where(a, button, [tabindex]):focus-visible {
    outline-color: var(--wp--preset--color--gold-light);
}

/* ──────────────────────────────
   Colour & typography → theme.json styles.blocks.core/navigation
────────────────────────────── */

.site-header {
    --gk-header-pad-y: 20px;
    --gk-header-pad-x: 32px;
    position: relative;
    z-index: 10;
    padding: var(--gk-header-pad-y) var(--gk-header-pad-x);
    background: var(--wp--preset--color--black);
}

/* Only the front page has a full-height hero to overlay; everywhere else the
   header must sit in normal flow so it doesn't cover the page title. */
.home .site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: transparent;
    background-image: linear-gradient(180deg, rgba(10, 10, 11, 0.85), rgba(10, 10, 11, 0));
    transition: background-color 0.35s ease;
}

/* Past the hero the fade would sit over light sections and wash out the menu toggle. */
.home .site-header.is-past-hero {
    background-color: var(--wp--preset--color--black);
}

/* WP core's default root block gap otherwise leaves a visible band above the
   hero, since the fixed header no longer occupies flow space to hide it. */
.home .site-main {
    margin-block-start: 0;
}

/* Keep anchor targets and focused elements clear of the fixed header. */
html:has(body.home) {
    scroll-padding-top: 80px;
}

.site-header .wp-block-navigation a {
    opacity: 0.85;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.site-header .wp-block-navigation a:hover {
    opacity: 1;
    color: var(--wp--preset--color--gold-light);
}

/* Enlarge the mobile menu toggles to a 44px touch target. */
.wp-block-navigation__responsive-container-open,
.wp-block-navigation__responsive-container-close {
    box-sizing: content-box;
    padding: 10px;
}

.wp-block-navigation__responsive-container-open {
    margin: -10px;
}

.wp-block-navigation__responsive-container-close:hover {
    color: var(--wp--preset--color--gold-light);
}

/* Mobile overlay menu — core defaults to white; match the dark header instead.
   Padding puts the close icon exactly where the open icon sits in the header. */
.site-header .wp-block-navigation:not(.has-background) .wp-block-navigation__responsive-container.is-menu-open:not(.disable-default-overlay) {
    --navigation-layout-justification-setting: center;
    padding: var(--gk-header-pad-y) var(--gk-header-pad-x);
    background-color: var(--wp--preset--color--black);
    color: var(--wp--preset--color--body-text);
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-close,
.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-dialog {
    display: flex;
    flex: 1;
    flex-direction: column;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content {
    flex: 1;
    justify-content: center;
    padding-block: calc(24px + 2rem);
    text-align: center;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
    /* The list carries its own .items-justified-right, which re-sets this variable. */
    --navigation-layout-justification-setting: center;
    justify-content: center;
    gap: 1.75rem;
    animation: gk-menu-in 0.4s ease-out both;
}

.site-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
    font-family: var(--wp--preset--font-family--cinzel);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@keyframes gk-menu-in {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

/* JS-driven logo reveal */
.nav-logo {
    width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.9);
    pointer-events: none;
    /* Delay visibility so the fade-out finishes before the link leaves the tab order. */
    transition: opacity 0.35s ease, transform 0.35s ease, filter 0.2s ease, visibility 0s linear 0.35s;
}

.nav-logo.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
    transition: opacity 0.35s ease, transform 0.35s ease, filter 0.2s ease, visibility 0s;
}

.nav-logo:hover {
    filter: drop-shadow(0 0 10px rgba(201, 162, 75, 0.5));
    transform: scale(1.03);
}

/* ──────────────────────────────
   Studio photo pattern
   object-fit and clamp() cannot be expressed in theme.json
────────────────────────────── */

.studio-photo {
    width: 100%;
    line-height: 0;
}

.studio-photo img {
    width: 100%;
    height: clamp(280px, 55vw, 620px);
    object-fit: cover;
    display: block;
}

/* ──────────────────────────────
   About pattern
   Background & text colour → block attrs in functions.php pattern
   Layout & image transforms cannot go in theme.json
────────────────────────────── */

.about-grid {
    max-width: 1000px;
    margin: 0 auto;
    align-items: center;
}

/* The copy slides in from 40px right; don't let it widen the page before it's revealed. */
.about {
    overflow-x: clip;
}

.about-devil img {
    width: 100%;
    transform: scaleX(-1);
    filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.5));
}

.about-copy h2 {
    margin: 0 0 20px;
}

/* ──────────────────────────────
   Footer
   Background, colour, padding → footer.html block attrs
────────────────────────────── */

.site-footer .footer-logo img {
    width: 220px;
    max-width: 60vw;
    margin-bottom: 18px;
    opacity: 0.9;
}

.site-footer p {
    margin: 4px 0;
    font-size: 0.85rem;
}

.site-footer .copyright {
    margin-top: 14px;
    opacity: 0.7;
}

/* ──────────────────────────────
   Scroll reveal (JS-driven)
────────────────────────────── */

.reveal {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.reveal.reveal-left {
    transform: translateX(-40px);
}

.reveal.reveal-right {
    transform: translateX(40px);
}

.reveal:not(.reveal-left):not(.reveal-right) {
    transform: translateY(30px);
}

.reveal.is-visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* ──────────────────────────────
   Artist pages
   Title & content colour → theme.json styles.blocks.core/post-title
   and core/post-content. Only the link override stays here because
   theme.json link colours are global and this is page-type conditional.
────────────────────────────── */

.artist-single .wp-block-post-content a {
    color: var(--wp--preset--color--near-black);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.artist-single .wp-block-post-content a:hover {
    color: var(--wp--preset--color--gold);
}

.artist-single .artist-archive-back-link {
    color: var(--wp--preset--color--near-black);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.artist-single .artist-archive-back-link:hover {
    color: var(--wp--preset--color--gold);
}

/* Slow the default cross-fade slightly so the featured image morph (set via
   view-transition-name in functions.php) reads clearly between pages. */
::view-transition-group(*) {
    animation-duration: 0.4s;
}

/* ──────────────────────────────
   Booking form (Contact Form 7)
   theme.json has no form-control styling, so it all lives here.
────────────────────────────── */

.gk-form {
    --gk-field-bg: #fdfcfa;
    --gk-field-border: rgba(19, 19, 21, 0.18);
    --gk-divider: rgba(19, 19, 21, 0.1);
    /* Theme "muted" is too light for small text on white; this passes WCAG AA. */
    --gk-muted: #6b675f;
    --gk-error: var(--wp--preset--color--devil-red);

    padding: clamp(28px, 5vw, 56px);
    background: #fff;
    color: var(--wp--preset--color--near-black);
    border: 1px solid var(--gk-divider);
    border-top: 3px solid var(--wp--preset--color--gold);
    border-radius: 6px;
    box-shadow: 0 12px 32px rgba(19, 19, 21, 0.06);
}

.gk-form p {
    margin: 0;
}

.gk-form__intro {
    padding-bottom: 32px;
    border-bottom: 1px solid var(--gk-divider);
    font-size: 1.02rem;
    font-weight: 300;
}

.gk-form__section {
    padding: 32px 0;
    border-bottom: 1px solid var(--gk-divider);
}

.gk-form .gk-form__heading {
    margin: 0 0 20px;
    color: var(--wp--preset--color--near-black);
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gk-form__note {
    margin-bottom: 20px !important;
    color: var(--gk-muted);
    font-size: 0.88rem;
}

.gk-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px 24px;
}

.gk-field--full {
    grid-column: 1 / -1;
}

.gk-field label,
.gk-field fieldset {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.gk-field fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

.gk-field__label {
    padding: 0;
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gk-field__req {
    color: var(--gk-muted);
    font-weight: 400;
    letter-spacing: 0.02em;
    text-transform: none;
}

.gk-field__hint {
    margin-top: -2px;
    color: var(--gk-muted);
    font-size: 0.8rem;
}

.gk-form .wpcf7-form-control-wrap {
    display: block;
}

.gk-form input:is([type="text"], [type="email"], [type="tel"], [type="date"]),
.gk-form select,
.gk-form textarea {
    width: 100%;
    padding: 12px 14px;
    background: var(--gk-field-bg);
    color: var(--wp--preset--color--near-black);
    border: 1px solid var(--gk-field-border);
    border-radius: 2px;
    font: inherit;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gk-form textarea {
    min-height: 140px;
    resize: vertical;
}

.gk-form select {
    appearance: none;
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c9a24b' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

.gk-form ::placeholder {
    color: var(--gk-muted);
    opacity: 0.8;
}

.gk-form input:hover,
.gk-form select:hover,
.gk-form textarea:hover {
    border-color: rgba(19, 19, 21, 0.35);
}

.gk-form input:focus-visible,
.gk-form select:focus-visible,
.gk-form textarea:focus-visible {
    outline: none;
    border-color: var(--wp--preset--color--gold);
    box-shadow: 0 0 0 3px rgba(201, 162, 75, 0.3);
}

.gk-form .wpcf7-not-valid {
    border-color: var(--gk-error) !important;
}

.gk-form .wpcf7-not-valid-tip {
    margin-top: 6px;
    color: var(--gk-error);
    font-size: 0.8rem;
}

/* Drag & drop uploads (Drag and Drop Multiple File Upload for CF7 plugin) */
.gk-form .codedropz-upload-handler {
    margin: 4px 0 0;
    background: var(--gk-field-bg);
    border: 1px dashed rgba(19, 19, 21, 0.3);
    border-radius: 2px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.gk-form .codedropz-upload-handler:hover,
.gk-form .codedropz-dragover {
    border-color: var(--wp--preset--color--gold);
    background: rgba(201, 162, 75, 0.08);
}

.gk-form .codedropz-upload-container {
    padding: 32px 20px 36px;
}

.gk-form .codedropz-upload-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.gk-form .codedropz-upload-inner> :first-child {
    margin: 0;
    font-size: 0.95rem;
}

.gk-form .codedropz-upload-inner>span:nth-child(2) {
    color: var(--gk-muted);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.gk-form .codedropz-btn-wrap a.cd-upload-btn {
    display: inline-block;
    text-decoration: none;
    padding: 8px 18px;
    color: var(--wp--preset--color--near-black);
    border: 1px solid var(--wp--preset--color--gold);
    border-radius: 2px;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.gk-form .codedropz-btn-wrap a.cd-upload-btn:hover,
.gk-form .codedropz-btn-wrap a.cd-upload-btn:focus-visible {
    background: var(--wp--preset--color--gold);
    color: var(--wp--preset--color--near-black);
}

.gk-form .dnd-upload-counter {
    right: 12px;
    bottom: 8px;
    color: var(--gk-muted);
    font-size: 0.72rem;
}

.gk-form .dnd-upload-status {
    gap: 12px;
    margin-top: 8px;
    padding: 10px 14px;
    background: var(--gk-field-bg);
    border: 1px solid var(--gk-divider);
    border-radius: 2px;
}

.gk-form .dnd-upload-status .dnd-upload-image {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-color: var(--gk-field-border);
}

.gk-form .dnd-upload-status .dnd-upload-details {
    flex: 1;
    width: auto;
    min-width: 0;
    padding-left: 0;
}

.gk-form .dnd-upload-status .dnd-upload-details .name {
    gap: 6px;
    color: var(--wp--preset--color--near-black);
    font-size: 0.85rem;
}

.gk-form .dnd-upload-status .dnd-upload-details .name em {
    color: var(--gk-muted);
    font-style: normal;
    font-weight: 400;
}

.gk-form .dnd-upload-status .dnd-upload-details .remove-file {
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
}

.gk-form .dnd-upload-status .dnd-upload-details .dnd-progress-bar {
    height: 4px;
    margin-top: 4px;
    background: rgba(19, 19, 21, 0.08);
    border-radius: 2px;
}

.gk-form .dnd-upload-status .dnd-upload-details .dnd-progress-bar span {
    background: var(--wp--preset--color--gold);
    font-size: 0;
}

.gk-form .dnd-icon-remove.deleting {
    color: var(--gk-muted);
}

.gk-form .dnd-upload-status .dnd-upload-details span.has-error,
.gk-form .codedropz-upload-wrapper span.has-error-msg {
    color: var(--gk-error);
    font-size: 0.8rem;
    font-style: normal;
}

/* Age confirmation + submit */
.gk-form__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding-top: 32px;
}

.gk-field--check .wpcf7-list-item {
    margin: 0;
}

.gk-field--check label {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    font-size: 0.92rem;
    cursor: pointer;
}

.gk-field--check input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--wp--preset--color--gold);
    cursor: pointer;
}

.gk-form .wpcf7-submit {
    border: 0;
    font-family: inherit;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease;
}

.gk-form .wpcf7-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.gk-form .wpcf7-submit:focus-visible {
    outline: 2px solid var(--wp--preset--color--near-black);
    outline-offset: 3px;
}

.gk-form .wpcf7-spinner {
    margin: 0 0 0 12px;
    background-color: var(--wp--preset--color--gold);
}

.gk-form__outro {
    margin-top: 28px !important;
    color: var(--gk-muted);
    font-size: 0.82rem;
    text-align: center;
}

.wpcf7 form .wpcf7-response-output {
    margin: 20px 0 0;
    padding: 14px 18px;
    border: 1px solid var(--wp--preset--color--gold);
    border-radius: 2px;
    background: #fff;
    color: var(--wp--preset--color--near-black);
    font-size: 0.9rem;
}

.wpcf7 form.invalid .wpcf7-response-output,
.wpcf7 form.unaccepted .wpcf7-response-output,
.wpcf7 form.failed .wpcf7-response-output,
.wpcf7 form.aborted .wpcf7-response-output,
.wpcf7 form.spam .wpcf7-response-output {
    border-color: var(--wp--preset--color--devil-red);
}

/* ──────────────────────────────
   Responsive
────────────────────────────── */

@media (max-width: 760px) {
    .about-grid {
        grid-template-columns: 1fr !important;
        text-align: center;
        gap: 32px;
    }

    .about-devil {
        width: 140px;
        margin: 0 auto;
    }

    /* Visit Us cards are a fixed 3-column grid in the page content. */
    #hours .is-layout-grid {
        grid-template-columns: 1fr;
    }

    .gk-form__grid {
        grid-template-columns: 1fr;
    }

    .gk-form__footer {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 480px) {
    .site-header {
        --gk-header-pad-y: 14px;
        --gk-header-pad-x: 16px;
    }

    .nav-logo {
        width: 130px;
    }
}

/* ──────────────────────────────
   Reduced motion
────────────────────────────── */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .reveal {
        opacity: 1 !important;
        transform: none !important;
    }

    ::view-transition-group(*),
    ::view-transition-old(*),
    ::view-transition-new(*) {
        animation: none !important;
    }
}