/* ==========================================================================
   Adam Goss CNC Woodcraft — adamgosscncwoodcraft.web.app, as a section.

   Copied from AdamGossCNCWoodcraft/css/styles.css (hero, name, engraving,
   buttons) — just the top of his site, with every class prefixed cnc- so nothing here touches
   the rest of the page. On his site the wood grain is behind the whole page;
   here it's behind this section (cnc.js).

   White with brown wood grain, like a freshly planed board: walnut-brown
   text, oak/amber accents, red only for the logo and the laser.
   ========================================================================== */

.cnc {
    --cnc-ink: #1f150e;
    --cnc-ink-dim: rgba(31, 21, 14, .72);
    --cnc-ink-faint: rgba(31, 21, 14, .6);
    --cnc-line: rgba(90, 53, 25, .14);
    --cnc-line-strong: rgba(90, 53, 25, .28);
    --cnc-glass: rgba(120, 72, 36, .05);
    --cnc-glass-hi: rgba(120, 72, 36, .11);
    --cnc-accent: #c8894a;
    --cnc-accent-hot: #9a5b26;
    --cnc-glow: rgba(200, 120, 58, .55);
    --cnc-walnut: #2e1c10;
    --cnc-surface: #f3ece4;

    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: #fff;
    color: var(--cnc-ink);
    font-family: var(--joe);
}

.cnc ::selection {
    background: var(--cnc-accent);
    color: #1a0f08;
}

/* the wood grain, and the laser above everything while it engraves */
.cnc-board,
.cnc-laser {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.cnc-board {
    z-index: -1;
}

.cnc-laser {
    z-index: 30;
}

/* ------------------------------------------------------------------ hero */

.cnc-hero {
    position: relative;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 90px 16px 60px;
    text-align: center;
    /* a soft white halo, so the grain never runs right up against the letters */
    text-shadow: 0 0 8px #fff, 0 0 3px #fff;
}

/* a soft white wash behind the name, so it reads cleanly over the grain */
.cnc-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 45% at 50% 52%, rgba(255, 255, 255, .6), transparent 75%);
}

/* the logo, unchanged, in a white disc */
.cnc-badge {
    display: inline-block;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    animation: bob 5s ease-in-out infinite;
}

.cnc-badge img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    border: 2px solid rgba(90, 53, 25, .12);
    box-shadow: 0 0 0 6px rgba(90, 53, 25, .05), 0 0 60px rgba(200, 137, 74, .3), 0 18px 40px -10px rgba(60, 35, 15, .3);
    transition: transform .45s var(--ease), box-shadow .3s;
}

.cnc-badge:hover img {
    transform: scale(1.08) rotate(-6deg);
    box-shadow: 0 0 0 6px rgba(90, 53, 25, .08), 0 0 80px rgba(200, 137, 74, .5), 0 18px 40px -10px rgba(60, 35, 15, .3);
}

/* "Adam Goss" over "CNC Wood Craft", sized so the longer line always fits */
.cnc-name {
    margin-top: 22px;
    font-size: clamp(2.4rem, 11.5vw, 9rem);
    font-weight: 500;
    line-height: .92;
    letter-spacing: -.045em;
    user-select: none;
    -webkit-user-select: none;
    text-shadow: none;
}

.cnc-line {
    display: block;
    white-space: nowrap;
}

.cnc-word {
    display: inline-block;
    white-space: nowrap;
}

/* Each letter swells under the cursor (the router bit), and as it does a
   photo of a finished piece shows through it. --h is how "hot" the letter
   is; --f is the same, but stays 0 until a photo has loaded. */
.cnc-ch {
    --h: 0;
    --f: 0;
    display: inline-block;
    font-variation-settings: "wght" 500, "wdth" 100;
    color: var(--cnc-ink);
    background: var(--img, none) center / cover no-repeat;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: rgb(31 21 14 / calc(1 - var(--f)));
    filter:
        drop-shadow(0 0 1.5px rgb(255 255 255 / calc(var(--h) * .9)))
        drop-shadow(0 8px 22px rgb(60 35 15 / .16))
        brightness(calc(1 + var(--h) * .12));
    transform: translateY(calc(var(--h) * -.06em));
}

/* The line the laser burns into the board. cnc.js draws it on a canvas laid
   over the line; the real text stays underneath, invisible, for screen
   readers, search and copying. */
.cnc-engrave {
    position: relative;
    width: fit-content;
    margin: clamp(16px, 2.6vh, 26px) auto 0;
    font-size: clamp(1.05rem, .6rem + 2.4vw, 2.3rem);
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -.015em;
    white-space: nowrap;
    color: #4a230c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .9), 0 -1px 0 rgba(60, 25, 5, .14);
}

.js .cnc-engrave-text {
    color: transparent;
    text-shadow: none;
}

/* no canvas (or reduced motion): the line is simply there */
.js .cnc-engrave:not(.has-canvas) .cnc-engrave-text {
    color: #4a230c;
    text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
}

.cnc-engrave-canvas {
    position: absolute;
    left: -14px;    /* PAD in cnc.js: room for the laser's glow */
    top: -14px;
    width: calc(100% + 28px);
    height: calc(100% + 28px);
    pointer-events: none;
}

.cnc-actions {
    margin-top: clamp(30px, 6vh, 48px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    text-shadow: none;
}

.cnc-btn {
    background: var(--cnc-walnut);
    color: #fff8ef;
    box-shadow: 0 12px 44px -12px var(--cnc-glow);
}

.cnc-btn:hover {
    background: #4a2e1a;
    box-shadow: 0 16px 60px -8px var(--cnc-glow);
}

.cnc-btn-ghost {
    background: var(--cnc-glass);
    border: 1px solid var(--cnc-line-strong);
    color: var(--cnc-ink);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.cnc-btn-ghost:hover {
    background: var(--cnc-glass-hi);
    border-color: rgba(90, 53, 25, .42);
}

/* the shared round socials, in brown on white */
.cnc-socials {
    text-shadow: none;
}

.cnc .social {
    color: var(--cnc-ink);
    background: rgba(255, 255, 255, .7);
    border-color: var(--cnc-line-strong);
}

.cnc .social:hover,
.cnc .social:focus-visible {
    color: #fff;
}

.cnc a:focus-visible {
    outline-color: var(--cnc-ink);
}

@media (max-width: 600px) {
    .cnc-badge {
        width: 74px;
        height: 74px;
    }
}
