/* ==========================================================================
   #MakeItReal with Every Drop  —  fit-to-viewport, mobile-first
   ========================================================================== */

@font-face {
    font-family: 'Shell';
    src: url('../fonts/ShellMedium.otf') format('opentype');
    font-weight: 400; font-display: swap;
}
@font-face {
    font-family: 'Shell';
    src: url('../fonts/ShellBold.otf') format('opentype');
    font-weight: 700; font-display: swap;
}
@font-face {
    font-family: 'Shell';
    src: url('../fonts/ShellHeavy.otf') format('opentype');
    font-weight: 900; font-display: swap;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --shell-red: #DD1D21;
    --ink: #383838;
    --ink-soft: #7a7a7a;
    --field-bg: #e3e3e1;
    --field-bg-focus: #eeeeec;
}

html, body { height: 100%; }

body {
    font-family: 'Shell', 'Segoe UI', Arial, sans-serif;
    color: var(--ink);
    background-color: #f4f0e9;
    background-image: url('../images/bg.png');
    background-repeat: no-repeat;
    background-position: center bottom;
    background-size: cover;
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    line-height: 1.3;
    overflow: hidden;                 /* no page scroll */
}

/* Page shell — fills the viewport exactly ------------------------------- */
.page {
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    height: 100dvh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding: clamp(14px, 3.5vh, 26px) clamp(20px, 6vw, 34px);
    overflow: hidden;
}

/* Header / logo ------------------------------------------------------- */
.brand {
    display: flex;
    justify-content: flex-end;
    flex: 0 0 auto;
    margin-bottom: clamp(10px, 2.5vh, 22px);
}
.brand img {
    width: clamp(120px, 34vw, 160px);
    height: auto;
}

/* Form — flex column that fills remaining height --------------------- */
#wishForm {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.form-field { flex: 0 0 auto; margin-bottom: clamp(10px, 2.2vh, 18px); }

.form-field label,
.form-field .field-label {
    display: block;
    font-weight: 700;
    font-size: clamp(16px, 4.6vw, 21px);
    color: var(--ink);
    margin-bottom: clamp(5px, 1.2vh, 10px);
}

.form-field input[type="text"],
.form-field textarea {
    width: 100%;
    border: 0; outline: 0;
    border-radius: 14px;
    background: var(--field-bg);
    color: var(--ink);
    font-family: inherit;
    font-size: clamp(15px, 4vw, 17px);
    padding: clamp(11px, 2vh, 15px) 16px;
    transition: background .15s ease, box-shadow .15s ease;
}
.form-field input:focus,
.form-field textarea:focus {
    background: var(--field-bg-focus);
    box-shadow: 0 0 0 2px rgba(221, 29, 33, .35);
}
.form-field input::placeholder,
.form-field textarea::placeholder { color: #9a9a97; }

/* the wishes field grows to absorb leftover space */
.form-field--grow {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: clamp(8px, 1.8vh, 14px);
}
.form-field--grow textarea {
    flex: 1 1 auto;
    min-height: 70px;
    resize: none;
}

.char-count {
    text-align: right;
    font-size: 12px;
    color: var(--ink-soft);
    margin-top: 4px;
}

.field-error {
    display: none;
    color: var(--shell-red);
    font-size: 12px;
    font-weight: 700;
    margin-top: 4px;
}
.form-field.has-error input,
.form-field.has-error textarea { box-shadow: 0 0 0 2px var(--shell-red); }
.form-field.has-error .field-error { display: block; }

/* Submit ----------------------------------------------------------- */
.submit-btn {
    flex: 0 0 auto;
    align-self: flex-start;
    margin-top: clamp(4px, 1.5vh, 12px);
    border: 0; cursor: pointer;
    background: var(--shell-red);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: clamp(18px, 4.8vw, 22px);
    letter-spacing: 2px;
    padding: clamp(11px, 1.9vh, 15px) clamp(34px, 12vw, 46px);
    border-radius: 12px;
    box-shadow: 0 6px 14px rgba(221, 29, 33, .28);
    transition: transform .1s ease, box-shadow .15s ease, opacity .15s ease;
}
.submit-btn:hover { box-shadow: 0 8px 20px rgba(221, 29, 33, .38); }
.submit-btn:active { transform: translateY(1px); }
.submit-btn[disabled] { opacity: .6; cursor: not-allowed; }

/* Modal --------------------------------------------------------- */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(40, 30, 20, .55);
    backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease;
    z-index: 50;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal {
    width: 100%; max-width: 340px;
    background: #fffdf8;
    border-radius: 22px;
    padding: 30px 26px 26px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .3);
    transform: translateY(12px) scale(.96);
    transition: transform .22s cubic-bezier(.2, .8, .3, 1.1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal .drop { width: 54px; height: auto; margin: 0 auto 12px; display: block; }
.modal h2 {
    font-weight: 900; font-size: 23px;
    color: var(--shell-red); margin-bottom: 8px; line-height: 1.2;
}
.modal p { font-size: 14px; color: var(--ink-soft); margin-bottom: 20px; }
.modal .continue-btn {
    border: 0; cursor: pointer;
    background: var(--shell-red); color: #fff;
    font-family: inherit; font-weight: 700; font-size: 16px;
    letter-spacing: 1.5px; padding: 12px 38px; border-radius: 11px;
    box-shadow: 0 6px 14px rgba(221, 29, 33, .28);
}
.modal .continue-btn:active { transform: translateY(1px); }

/* ================= Result page ================= */
.result-wrap {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    text-align: center;
}
.result-wrap--center { justify-content: center; }
.result-wrap--center .link-btn { margin-top: clamp(6px, 3vh, 26px); }

/* Result page: logo floats top-right so the message block centres on the whole viewport */
.page--result { position: relative; justify-content: center; }
.page--result .brand {
    position: absolute;
    top: clamp(14px, 3.5vh, 26px);
    right: clamp(20px, 6vw, 34px);
    margin: 0;
    z-index: 2;
}
.page--result .result-wrap { flex: 0 1 auto; }
.result-wrap h1 {
    flex: 0 0 auto;
    font-weight: 900;
    font-size: clamp(24px, 7vw, 34px);
    color: var(--shell-red);
    line-height: 1.12;
    margin-bottom: 4px;
}
.result-wrap .subtitle {
    flex: 0 0 auto;
    font-size: clamp(13px, 3.6vw, 16px);
    color: var(--ink);
    margin-bottom: clamp(10px, 2vh, 18px);
}

.wish-card {
    flex: 0 0 auto;
    background: rgba(255, 255, 255, .82);
    border: 1px solid rgba(221, 29, 33, .18);
    border-radius: 16px;
    padding: clamp(14px, 2.5vh, 20px) 18px;
    margin-bottom: clamp(12px, 2.5vh, 22px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .08);
}
.wish-card .quote {
    font-weight: 700;
    font-size: clamp(16px, 4.6vw, 20px);
    color: #2f2f2f;
    margin-bottom: 10px;
}
.wish-card .who { font-size: 13px; color: var(--ink-soft); }
.wish-card .who strong { color: var(--shell-red); }

.wall-title {
    flex: 0 0 auto;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--ink-soft);
    margin-bottom: 10px;
}

/* the wall scrolls INSIDE its own box — page itself never scrolls */
.wall {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: grid;
    gap: 10px;
    text-align: left;
    padding: 2px;
    margin-bottom: clamp(10px, 2vh, 18px);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.wall .wall-item {
    background: rgba(255, 255, 255, .78);
    border-radius: 13px;
    padding: 11px 14px;
    font-size: 13.5px;
}
.wall .wall-item .msg { color: #333; }
.wall .wall-item .nm {
    color: var(--shell-red); font-weight: 700; font-size: 12px; margin-top: 3px;
}

.link-btn {
    flex: 0 0 auto;
    align-self: center;
    text-decoration: none;
    background: var(--shell-red);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 1.5px;
    padding: 12px 36px;
    border-radius: 11px;
    box-shadow: 0 6px 14px rgba(221, 29, 33, .28);
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%) translateY(20px);
    background: #333; color: #fff;
    font-size: 13px; padding: 11px 18px; border-radius: 10px;
    opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Desktop ------------------------------------------------------- */
@media (min-width: 768px) {
    .page { max-width: 520px; padding: clamp(24px, 4vh, 44px) 44px; }
}

/* Very short screens: allow the page to scroll as a last resort */
@media (max-height: 560px) {
    body { overflow: auto; }
    .page { height: auto; min-height: 100dvh; }
}
