:root {
    color-scheme: dark;
    --ink: #24150c;
    --focus: #ffe8a3;
}

* { box-sizing: border-box; }

html {
    min-width: 320px;
    background: #080504;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    background:
        linear-gradient(rgba(5, 3, 2, .18), rgba(5, 3, 2, .64)),
        url("guild-hall-background.webp") center top / cover fixed no-repeat,
        #080504;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: radial-gradient(circle at 50% 15%, transparent 0 30%, rgba(0, 0, 0, .18) 68%, rgba(0, 0, 0, .62) 100%);
}

.guild-banner {
    position: absolute;
    z-index: 1;
    top: 0;
    left: max(8px, calc(50vw - 910px));
    width: clamp(110px, 11vw, 190px);
    height: auto;
    pointer-events: none;
    filter: drop-shadow(0 12px 14px rgba(0, 0, 0, .9));
    animation: banner-sway 7s ease-in-out infinite;
    transform-origin: 50% 0;
}

.landing-shell {
    position: relative;
    z-index: 2;
    width: min(1500px, calc(100% - 42px));
    margin: 0 auto;
    padding: clamp(20px, 2.8vw, 44px) 0 68px;
}

.link-section {
    display: grid;
    gap: clamp(12px, 1.5vw, 22px);
}

.title-scroll {
    position: relative;
    width: min(880px, calc(100vw - 50px));
    height: clamp(190px, 24vw, 252px);
    margin: 0 auto;
    padding: clamp(48px, 5vw, 68px) clamp(48px, 7vw, 104px) clamp(30px, 3vw, 38px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: url("frame-title.webp") center / 100% 100% no-repeat;
    filter: drop-shadow(0 18px 22px rgba(0, 0, 0, .72));
    animation: title-arrival 720ms cubic-bezier(.2,.72,.2,1) both;
}

.guild-crest {
    position: absolute;
    z-index: 2;
    top: clamp(-33px, -2vw, -20px);
    width: clamp(32px, 2.5vw, 45px);
    height: clamp(72px, 6vw, 102px);
    object-fit: contain;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,.56));
}

.title-scroll h1 {
    flex: 0 0 auto;
    margin: 0 0 4px;
    font-family: "Palatino Linotype", Palatino, Georgia, serif;
    font-size: clamp(2rem, 4vw, 4rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: .015em;
    text-transform: uppercase;
    white-space: nowrap;
    color: #241209;
    text-shadow: 0 2px 0 rgba(255,235,184,.48), 0 4px 5px rgba(50,24,8,.25);
}

.title-scroll p {
    flex: 0 0 auto;
    max-width: 720px;
    margin: 6px 0 0;
    font-size: clamp(.7rem, 1.08vw, .98rem);
    line-height: 1.28;
    font-weight: 700;
}

.title-rule {
    display: block;
    flex: 0 0 2px;
    width: min(210px, 44%);
    height: 2px;
    margin: 2px auto 0;
    background: linear-gradient(90deg, transparent 0%, #765024 18%, #38200e 50%, #765024 82%, transparent 100%);
    box-shadow: 0 1px 0 rgba(255, 231, 174, .46);
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: clamp(8px, 1vw, 15px);
}

.portal-card {
    position: relative;
    isolation: isolate;
    aspect-ratio: 1 / 1;
    min-width: 0;
    padding: 16% 14% 14%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4%;
    color: var(--ink);
    text-decoration: none;
    text-align: center;
    background: url("frame-button.webp") center / 100% 100% no-repeat;
    filter: drop-shadow(0 10px 10px rgba(0,0,0,.78));
    transition: transform 180ms ease, filter 180ms ease;
    animation: card-arrival 560ms cubic-bezier(.2,.72,.2,1) both;
}

.portal-card::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    opacity: 0;
    background: url("frame-button-hover.webp") center / 100% 100% no-repeat;
    transition: opacity 180ms ease;
}

.portal-card:hover,
.portal-card:focus-visible {
    z-index: 3;
    transform: translateY(-7px) scale(1.035);
    filter: drop-shadow(0 16px 16px rgba(0,0,0,.85)) brightness(1.04);
}

.portal-card:hover::before,
.portal-card:focus-visible::before { opacity: 1; }

.portal-card:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 4px;
}

.portal-card:nth-child(1) { animation-delay: 80ms; }
.portal-card:nth-child(2) { animation-delay: 130ms; }
.portal-card:nth-child(3) { animation-delay: 180ms; }
.portal-card:nth-child(4) { animation-delay: 230ms; }
.portal-card:nth-child(5) { animation-delay: 280ms; }
.portal-card:nth-child(6) { animation-delay: 330ms; }
.portal-card:nth-child(7) { animation-delay: 380ms; }

.portal-icon {
    display: block;
    width: min(64%, 110px);
    height: 58%;
    object-fit: contain;
    filter: drop-shadow(0 3px 2px rgba(63,34,12,.28));
}

.portal-label {
    width: 112%;
    margin-inline: -6%;
    font-size: clamp(.67rem, .92vw, .96rem);
    font-weight: 700;
    line-height: 1.16;
    overflow-wrap: anywhere;
}

.ornament-divider {
    width: 58%;
    max-height: 46px;
    margin: -4px auto -10px;
    display: block;
    object-fit: cover;
    object-position: center;
    filter: sepia(.15) drop-shadow(0 4px 5px rgba(0,0,0,.85));
}

.calendar-section {
    margin-top: 0;
    animation: calendar-arrival 720ms cubic-bezier(.2,.72,.2,1) 410ms both;
}

.calendar-frame {
    position: relative;
    aspect-ratio: 1707 / 953;
    padding: 6.3% 4.5% 5.2%;
    display: flex;
    background: url("frame-calendar.webp") center / 100% 100% no-repeat;
    filter: drop-shadow(0 18px 24px rgba(0,0,0,.86));
    overflow: hidden;
}

.calendar-frame iframe {
    display: block;
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    background: #f4ead3;
    filter: sepia(.08) saturate(.86) contrast(.98);
}

@media (max-width: 1120px) {
    .guild-banner { opacity: .8; }
    .portal-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .portal-card:last-child { grid-column: auto; }
    .title-scroll { width: min(820px, 86vw); }
}

@media (max-width: 680px) {
    body {
        background-attachment: scroll;
        background-position: 68% top;
    }

    .guild-banner { display: none; }

    .landing-shell {
        width: min(100% - 20px, 1500px);
        padding-top: 10px;
    }

    .title-scroll {
        width: 100%;
        height: clamp(174px, 50vw, 205px);
        padding: 43px 34px 28px;
    }

    .guild-crest {
        top: -20px;
        width: 30px;
        height: 68px;
    }
    .title-scroll h1 {
        max-width: 100%;
        font-size: clamp(1.25rem, 6.3vw, 2.25rem);
        line-height: 1;
        letter-spacing: .005em;
    }

    .title-scroll p {
        display: block;
        max-width: 92%;
        margin-top: 5px;
        font-size: clamp(.49rem, 2.15vw, .68rem);
        line-height: 1.2;
    }

    .title-scroll p br { display: none; }

    .portal-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .portal-card:last-child {
        grid-column: auto;
        width: auto;
        justify-self: stretch;
    }
    .portal-label { font-size: .72rem; }
    .ornament-divider { width: 82%; }

    .calendar-frame {
        aspect-ratio: auto;
        height: min(680px, 78vh);
        min-height: 520px;
        padding: 46px 22px 34px;
        background-size: 100% 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .guild-banner,
    .title-scroll,
    .portal-card,
    .calendar-section { animation: none; }
    .portal-card { transition: none; }
}

@keyframes title-arrival {
    from { opacity: 0; transform: translateY(-18px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes card-arrival {
    from { opacity: 0; translate: 0 18px; }
    to { opacity: 1; translate: 0 0; }
}

@keyframes calendar-arrival {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes banner-sway {
    0%, 100% { rotate: -.35deg; }
    50% { rotate: .45deg; }
}
