/* Feudo Estrazione — frontend
   Allineato all'estetica editoriale di feudostagnone.it */

/* Hide theme sidebars on the extraction page and make the content full-width */
body.feudo-estrazione-page .sidebar.widget_area,
body.feudo-estrazione-page aside.widget-area,
body.feudo-estrazione-page #secondary { display: none !important; }
body.feudo-estrazione-page .content_wrap,
body.feudo-estrazione-page .content_wrap > .content,
body.feudo-estrazione-page .content { width: 100% !important; max-width: 100% !important; padding-right: 0 !important; }
body.feudo-estrazione-page .post_content,
body.feudo-estrazione-page article.post_item { width: 100% !important; }

.feudo-est {
    --fs-bg: #FFF8EE;
    --fs-bg-alt: #FFF3E3;
    --fs-text: #2B2626;
    --fs-text-soft: #5A5A67;
    --fs-line: rgba(43, 38, 38, 0.12);
    --fs-accent: #6B1F2A;
    --fs-accent-dark: #4A1620;
    --fs-gold: #C9A961;
    --fs-gold-soft: #E8D6A4;
    --fs-font-serif: alga, "DM Serif Display", "Cormorant Garamond", Georgia, serif;
    --fs-font-sans: "DM Sans", system-ui, -apple-system, sans-serif;
    --fs-font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;

    background: var(--fs-bg);
    color: var(--fs-text);
    font-family: var(--fs-font-sans);
    padding: clamp(1rem, 3vw, 2.5rem) clamp(1rem, 4vw, 3rem) clamp(3rem, 8vw, 6rem);
    min-height: 80vh;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
}

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

/* Decorative wine glass line drawing — subtle, only on desktop */
.feudo-est::before {
    content: "";
    position: absolute;
    bottom: -40px;
    right: -60px;
    width: 320px;
    height: 320px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 280' fill='none' stroke='%232B2626' stroke-width='0.8' opacity='0.18'><path d='M40 20 Q100 60 160 20 Q160 110 100 130 Q40 110 40 20 Z'/><path d='M100 130 L100 240'/><path d='M55 250 Q100 240 145 250'/></svg>");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.feudo-est__inner {
    max-width: 560px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.feudo-est__kicker {
    font-family: var(--fs-font-serif);
    font-size: 0.85rem;
    letter-spacing: 1.9px;
    text-transform: uppercase;
    color: var(--fs-text);
    text-align: center;
    margin: 0 0 1rem;
    font-weight: 500;
}

.feudo-est__headline {
    font-family: var(--fs-font-serif);
    font-size: clamp(2.4rem, 8vw, 3.4rem);
    line-height: 1.05;
    color: var(--fs-text);
    text-align: center;
    margin: 0 0 1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.feudo-est__sub {
    color: var(--fs-text-soft);
    font-size: 1rem;
    line-height: 1.55;
    text-align: center;
    max-width: 36ch;
    margin: 0 auto 2.5rem;
}

/* Steps */
.feudo-step { display: none; animation: feudo-fade .45s ease both; }
.feudo-step.is-active { display: block; }

@keyframes feudo-fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Form */
.feudo-form-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feudo-field {
    display: flex;
    flex-direction: column;
}

.feudo-field label {
    font-size: 0.78rem;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--fs-text-soft);
    margin-bottom: 0.5rem;
    font-family: var(--fs-font-sans);
}

.feudo-field input[type="text"],
.feudo-field input[type="email"] {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--fs-line);
    padding: 0.6rem 0;
    font-family: var(--fs-font-serif);
    font-size: 1.15rem;
    color: var(--fs-text);
    transition: border-color .2s ease;
    width: 100%;
    border-radius: 0;
    -webkit-appearance: none;
            appearance: none;
}

.feudo-field input:focus {
    outline: none;
    border-bottom-color: var(--fs-accent);
}

/* Honeypot — visually hidden but accessible to bots */
.feudo-honeypot {
    position: absolute !important;
    left: -9999px;
    top: -9999px;
    opacity: 0;
    pointer-events: none;
}

.feudo-privacy {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    font-size: 0.85rem;
    color: var(--fs-text-soft);
    line-height: 1.45;
}

.feudo-privacy input { margin-top: 0.2rem; flex-shrink: 0; }
.feudo-privacy a { color: var(--fs-accent); text-decoration: underline; }

/* Buttons — high specificity to override theme styles */
.feudo-est .feudo-btn,
.feudo-est button.feudo-btn,
.feudo-est a.feudo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #2B2626 !important;
    color: #FFF8EE !important;
    font-family: var(--fs-font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 1.05rem 2rem;
    border: 1px solid #2B2626 !important;
    border-radius: 6px;
    cursor: pointer;
    transition: all .2s ease;
    width: 100%;
    text-decoration: none;
    box-shadow: none !important;
    text-shadow: none !important;
}

.feudo-est .feudo-btn:hover,
.feudo-est button.feudo-btn:hover {
    background: #6B1F2A !important;
    border-color: #6B1F2A !important;
    color: #FFF8EE !important;
}
.feudo-est .feudo-btn:active { transform: translateY(1px); }
.feudo-est .feudo-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.feudo-est .feudo-btn--gold {
    background: #C9A961 !important;
    color: #2B2626 !important;
    border-color: #C9A961 !important;
}
.feudo-est .feudo-btn--gold:hover { background: #b9994f !important; border-color: #b9994f !important; }

.feudo-form__submit { margin-top: 2.75rem; }

.feudo-error {
    background: #fdecea;
    border: 1px solid #e7a8a0;
    color: #6e1d12;
    padding: 0.9rem 1rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-top: 1rem;
    display: none;
}
.feudo-error.is-active { display: block; }

/* Wheel */
.feudo-wheel-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    margin-top: 1rem;
}

.feudo-wheel {
    position: relative;
    width: min(86vw, 380px);
    aspect-ratio: 1 / 1;
}

.feudo-wheel__pointer {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 36px;
    z-index: 3;
    filter: drop-shadow(0 2px 4px rgba(43, 38, 38, 0.25));
}

.feudo-wheel__canvas {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow:
        0 18px 50px -20px rgba(43, 38, 38, 0.4),
        0 0 0 6px var(--fs-bg),
        0 0 0 7px var(--fs-line);
}

.feudo-wheel__hub {
    position: absolute;
    top: 50%; left: 50%;
    width: 56px; height: 56px;
    background: var(--fs-bg);
    border: 1px solid var(--fs-line);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.feudo-wheel__hub::before {
    content: "";
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--fs-gold);
    box-shadow: inset 0 -3px 0 rgba(0,0,0,0.1);
}

/* Result */
.feudo-result {
    text-align: center;
    padding-top: 1rem;
}

.feudo-result__title {
    font-family: var(--fs-font-serif);
    font-size: clamp(2rem, 7vw, 2.6rem);
    line-height: 1.1;
    margin: 0 0 0.75rem;
    color: var(--fs-text);
    font-weight: 500;
}

.feudo-result__subtitle {
    color: var(--fs-text-soft);
    margin: 0 0 2rem;
    font-size: 1rem;
    line-height: 1.55;
}

.feudo-result__prize {
    font-family: var(--fs-font-serif);
    font-size: 1.6rem;
    color: var(--fs-accent);
    margin: 0 0 1.5rem;
    font-style: italic;
}

.feudo-ticket {
    background: var(--fs-bg-alt);
    border: 1px dashed var(--fs-text);
    border-radius: 10px;
    padding: 1.5rem 1rem;
    margin: 0 auto 1.5rem;
    max-width: 320px;
    position: relative;
}

.feudo-ticket::before,
.feudo-ticket::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 18px; height: 18px;
    background: var(--fs-bg);
    border: 1px solid var(--fs-text);
    border-radius: 50%;
    transform: translateY(-50%);
}
.feudo-ticket::before { left: -10px; border-right-color: transparent; }
.feudo-ticket::after  { right: -10px; border-left-color: transparent; }

.feudo-ticket__label {
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--fs-text-soft);
    margin-bottom: 0.6rem;
}

.feudo-ticket__code {
    font-family: var(--fs-font-mono);
    font-size: clamp(1.6rem, 6vw, 2.1rem);
    font-weight: 700;
    color: var(--fs-text);
    letter-spacing: 2px;
}

.feudo-result__instructions {
    color: var(--fs-text-soft);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 auto 1.5rem;
    max-width: 38ch;
}

/* Confetti — soft gold dots animation */
.feudo-confetti {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 9999;
}

.feudo-confetti i {
    position: absolute;
    top: -10px;
    width: 6px; height: 10px;
    background: var(--fs-gold);
    opacity: 0.85;
    animation: feudo-fall linear forwards;
    border-radius: 1px;
}

@keyframes feudo-fall {
    0%   { transform: translate3d(0,0,0) rotate(0deg); opacity: 1; }
    100% { transform: translate3d(var(--fx, 50px), 110vh, 0) rotate(720deg); opacity: 0; }
}

/* Loading overlay during spin */
.feudo-loading {
    text-align: center;
    color: var(--fs-text-soft);
    font-size: 0.9rem;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    margin-top: 1rem;
    min-height: 1.2em;
}

/* Closed state */
.feudo-closed {
    text-align: center;
    padding: 3rem 1rem;
}

/* Staff validation page */
.feudo-staff .feudo-staff-step {
    max-width: 460px;
    margin: 0 auto;
}

.feudo-staff input[type="password"],
.feudo-staff input#feudo-staff-code {
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--fs-line);
    padding: 0.8rem 0;
    font-family: var(--fs-font-mono);
    font-size: 1.6rem;
    color: var(--fs-text);
    text-align: center;
    letter-spacing: 6px;
    width: 100%;
    border-radius: 0;
    -webkit-appearance: none;
            appearance: none;
}

.feudo-staff input[type="password"]:focus,
.feudo-staff input#feudo-staff-code:focus {
    outline: none;
    border-bottom-color: var(--fs-accent);
}

.feudo-staff-result-card {
    background: var(--fs-bg-alt);
    border-left: 6px solid var(--fs-accent);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.feudo-staff-result-card.is-success { border-left-color: #1f6e1f; }
.feudo-staff-result-card.is-warning { border-left-color: #C9A961; }

.feudo-staff-result-card h2 {
    font-family: var(--fs-font-serif);
    font-size: 1.6rem;
    margin: 0 0 1rem;
    color: var(--fs-text);
    font-weight: 500;
}

.feudo-staff-result-card dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 0.5rem 1rem;
    margin: 1rem 0 0;
    font-size: 0.95rem;
}
.feudo-staff-result-card dt { font-weight: 600; color: var(--fs-text-soft); text-transform: uppercase; font-size: 0.75rem; letter-spacing: 1px; padding-top: 0.15rem; }
.feudo-staff-result-card dd { margin: 0; color: var(--fs-text); word-break: break-word; }
.feudo-staff-result-card code { background: rgba(43,38,38,0.06); padding: 2px 6px; border-radius: 4px; font-family: var(--fs-font-mono); }

@media (min-width: 720px) {
    .feudo-est__inner { max-width: 600px; }
    .feudo-wheel { width: 420px; }
}

@media (prefers-reduced-motion: reduce) {
    .feudo-step { animation: none; }
    .feudo-confetti i { animation-duration: 0.001s; }
}
