/* Acki responsive layout
   Shared overrides for desktop, tablet, and mobile screens. */

:root {
    --acki-topbar-height: 50px;
    --acki-page-gutter: clamp(14px, 3vw, 42px);
    --acki-content-max: 820px;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
}

img,
svg,
video,
canvas {
    max-width: 100%;
}

button,
input,
textarea,
select {
    font: inherit;
}

/* ---------- Shared top navigation ---------- */
.edge-top {
    min-height: var(--acki-topbar-height);
    height: auto;
    padding: max(0px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
}

.edge-tab {
    gap: clamp(14px, 2vw, 24px);
    padding-right: max(20px, env(safe-area-inset-right));
}

.edge-tab i,
.edge-tab button {
    flex: 0 0 auto;
}

.lang-toggle {
    min-width: 52px;
    min-height: 32px;
    padding: 6px 14px;
}

.settings-menu {
    width: min(220px, calc(100vw - 24px));
    max-height: calc(100vh - 72px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ---------- Community ---------- */
.content {
    width: min(var(--acki-content-max), calc(100% - (var(--acki-page-gutter) * 2)));
    padding-top: calc(var(--acki-topbar-height) + 36px);
    padding-bottom: 100px;
}

.post {
    width: 100%;
    max-width: 100%;
}

.post-header {
    min-width: 0;
}

.post-header>div:not(.post-menu) {
    min-width: 0;
}

.post-name,
.post-time {
    overflow-wrap: anywhere;
}

.post-body {
    padding-inline: clamp(22px, 7vw, 67px);
}

.post-active {
    left: clamp(12px, 4vw, 30px);
    right: clamp(12px, 4vw, 30px);
    gap: 0;
    justify-content: space-evenly;
}

.post-active button {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 8px;
}

.create-post {
    width: min(780px, calc(100vw - 32px));
    max-height: calc(100dvh - 74px);
    overflow-y: auto;
    overscroll-behavior: contain;
}

.create-post-tab {
    white-space: nowrap;
}

.comment-panel {
    width: min(360px, calc(100vw - 40px));
    max-width: 100%;
}

.comment-input input {
    min-width: 0;
}

.share-box {
    position: fixed !important;
    width: min(360px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
}

.share-link {
    min-width: 0;
}

.server-offline {
    padding: calc(var(--acki-topbar-height) + 30px) var(--acki-page-gutter) 30px;
}

.server-offline h2 {
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.2;
}

.server-offline p {
    font-size: clamp(15px, 2.4vw, 20px);
}

.scene-front {
    height: clamp(190px, 28vh, 300px);
}

.scene-sky-object {
    width: clamp(62px, 8vw, 100px);
    height: clamp(62px, 8vw, 100px);
}

/* ---------- About ---------- */
.about-page {
    width: min(1400px, 100%);
    margin: 0 auto;
    padding: calc(var(--acki-topbar-height) + 38px) var(--acki-page-gutter) 70px;
}

.about-hero {
    margin-bottom: clamp(34px, 6vw, 60px);
}

.about-hero h1 {
    font-size: clamp(42px, 6vw, 68px);
}

.about-hero p {
    width: fit-content;
    max-width: min(520px, 100%);
    height: auto;
    margin: 0 auto;
    padding: 7px 22px;
}

.about-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.about-box {
    min-width: 0;
}

/* ---------- Contact ---------- */
.contact-page {
    padding: calc(var(--acki-topbar-height) + 38px) var(--acki-page-gutter) 60px;
}

.contact-card {
    width: min(680px, 100%);
}

/* ---------- Home ---------- */
.frame {
    width: min(1400px, calc(100% - 48px));
    margin: 30px auto;
}

.align-center {
    min-width: 0;
}

.intro-text {
    flex: 1 1 auto;
}

.box1 {
    flex-wrap: wrap;
}

/* ---------- Wide desktop ---------- */
@media (min-width: 1600px) {
    :root {
        --acki-content-max: 900px;
    }

    .content {
        padding-top: calc(var(--acki-topbar-height) + 44px);
    }

    .post-body {
        font-size: 17px;
    }

    .about-grid {
        gap: 30px;
    }
}

/* ---------- Tablet ---------- */
@media (max-width: 900px) {
    :root {
        --acki-page-gutter: 20px;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    .about-box {
        padding: 26px;
    }

    .comment-panel {
        top: auto;
        right: 12px;
        left: 12px;
        bottom: 12px;
        width: auto;
        height: min(62dvh, 560px);
        border-radius: 20px;
        transform: translateY(40px);
    }

    .comment-panel.show {
        transform: translateY(0);
    }
}

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
    :root {
        --acki-topbar-height: 50px;
        --acki-page-gutter: 12px;
    }

    .edge-top {
        min-height: 46px !important;
        height: 46px !important;
    }

    .edge-tab {
        justify-content: space-between;
        gap: 0px;
        height: 45px !important;
        min-height: 45px !important;
        padding-left: max(90px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }

    .edge-tab i {
        width: 34px;
        height: 34px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 19px;
    }

    .nav-icon-wrap {
        width: 38px;
        justify-content: center;
    }

    .lang-toggle {
        min-width: 46px;
        min-height: 30px;
        padding: 5px 10px;
        font-size: 12px;
    }

    .settings-menu {
        position: fixed;
        top: calc(var(--acki-topbar-height) + 8px);
        right: 6px;
        width: min(180px, calc(100vw - 18px));
        padding: 6px;
    }

    .settings-menu button {
        padding: 8px 9px;
        font-size: 12.5px;
    }

    .setting-state {
        font-size: 11px;
    }

    .content {
        width: calc(100% - 20px);
        padding-top: calc(var(--acki-topbar-height) + 38px);
        padding-bottom: 80px;
    }

    .post {
        margin-bottom: 82px;
        border-radius: 14px;
    }

    .post-header {
        gap: 5px;
        margin: 7px 9px;
        padding-right: 30px;
    }

    .post-avatar {
        width: 40px !important;
        height: 40px !important;
        margin: 8px 5px !important;
    }

    .post-name {
        font-size: 13px;
    }

    .post-time {
        font-size: 10px;
    }

    .post-menu-btn {
        right: 0;
        top: 0;
        width: 0px;
        height: 25px;
        padding: 0;
    }

    .post-body {
        padding: 2px 18px 15px;
        font-size: 13.5px;
        line-height: 1.7;
    }

    .post-active {
        left: 20px;
        right: 20px;
        bottom: -35px;
        height: 35px;
        border-radius: 0 0 16px 16px;
        z-index: 1;
    }

    .post-active button {
        min-width: 35px;
        min-height: 35px;
        font-size: 20px;
        padding: 0 5px;
    }

    .like-count,
    .comment-count,
    .share-count {
        font-size: 11px;
    }

    .create-post-tab {
        top: 38px;
        padding: 10px 15px 5px;
        min-height: 25px;
        min-width: 30px;
        transition: background-color 0.15s ease;
    }

    /* Disable hover effect on mobile/touch devices */
    .create-post-tab:hover,
    .create-post-tab:active {
        background: #2f2f2f;
        transform: translateX(-50%);
    }

    body.theme-dark .create-post-tab:hover,
    body.theme-dark .create-post-tab:active {
        background: #ffffff;
        transform: translateX(-50%);
    }

    .create-post {
        top: var(--acki-topbar-height);
        width: calc(100% - 0px);
        max-width: 100%;
        padding: 20px 20px 20px;
        max-height: calc(100dvh - var(--acki-topbar-height) - 10px);
        border-radius: 0 0 18px 18px;
    }

    .create-text {
        min-height: 130px;
        max-height: 42dvh;
    }

    .create-btn {
        width: 100%;
        max-width: 100%;
    }

    .comment-panel {
        right: 0;
        left: 0;
        bottom: 0;
        width: 100%;
        height: min(68dvh, 600px);
        border-radius: 22px 22px 0 0;
        padding: 18px 14px max(14px, env(safe-area-inset-bottom));
    }

    .comment-input {
        gap: 7px;
    }

    .btn-send {
        padding-inline: 13px;
    }

    .share-box {
        width: calc(100vw - 20px);
        max-width: calc(100vw - 20px);
        padding: 16px;
    }

    .share-box h3 {
        margin-top: 2px;
    }

    .notification-mini,
    .notification-full {
        right: 0px;
        width: min(88vw, 250px);
        max-width: min(88vw, 250px);
    }

    .notification-mini {
        position: fixed;
        top: 60px;
        right: 55px;
        width: 220px;
        height: 400px;
        background: #ffffff;
        border-radius: 14px;
        padding: 14px 14px 12px;
        z-index: 1010;
        box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: .25s;
    }

    .notification-full {
        top: var(--acki-topbar-height);
        height: calc(1000dvh - var(--acki-topbar-height));
        transform: translateX(100%);
        transition: transform .3s ease;
        top: 45px;
    }

    .notification-full.show {
        transform: translateX(0);
    }

    .notification-item-mini,
    .notification-item-full {
        padding: 10px 20px 5px;
        border-radius: 10px;
        background: #ececec;
        margin-bottom: 10px;
        line-height: 1.25;
        cursor: pointer;
    }

    .coming-soon-box {
        width: calc(100vw - 28px);
        padding: 24px 18px;
    }

    .scene-front {
        left: -25%;
        right: -25%;
        bottom: -72px;
        height: 230px;
    }

    .walking-tree {
        transform: scale(.82);
        transform-origin: bottom center;
    }

    /* About */
    .about-page {
        padding: calc(var(--acki-topbar-height) + 28px) 14px 45px;
    }

    .about-hero {
        margin-bottom: 30px;
    }

    .about-hero h1 {
        font-size: 44px;
        margin-top: 10px;
    }

    .about-hero p {
        font-size: 15px;
        padding: 7px 16px;
    }

    .about-grid {
        gap: 16px;
    }

    .about-box {
        padding: 22px 18px;
        border-radius: 15px;
    }

    .about-box h2 {
        font-size: 22px;
    }

    /* Contact */
    .contact-page {
        padding: calc(var(--acki-topbar-height) + 28px) 12px 36px;
    }

    .contact-card {
        width: 100%;
        padding: 24px 18px;
    }

    .contact-title1 {
        font-size: 34px;
    }

    .contact-card textarea {
        min-height: 145px;
    }

    .contact-card>button:not(.back-btn) {
        width: 100%;
    }

    /* Home */
    .frame {
        width: calc(100% - 16px);
        margin: 8px auto;
        padding: 24px 14px 38px;
    }

    .frame>.lang-toggle {
        position: absolute;
        top: 14px;
        right: 14px;
    }

    .align-center {
        margin-top: 48px;
    }

    .modal-box {
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
    }

    /* Profile */
    .profile-page {
        width: calc(100% - 24px);
        padding-top: calc(var(--acki-topbar-height) + 48px);
    }

    .profile-header {
        padding: 18px 0;
    }

    .profile-header-top,
    .profile-main {
        min-width: 0;
    }

    .profile-info {
        min-width: 0;
    }

    .profile-info h1,
    .profile-username,
    .profile-joined {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .profile-tabs {
        overflow-x: auto;
        scrollbar-width: none;
    }

    .profile-tabs::-webkit-scrollbar {
        display: none;
    }

    .profile-tab {
        min-width: 92px;
        padding: 12px 8px;
        font-size: 14px;
    }

    .profile-bio-section {
        padding: 12px 0 0;
    }

    .profile-tab-content {
        min-height: 220px;
        padding: 20px 0 56px;
    }

    .profile-post-grid {
        gap: 12px;
    }

    .profile-post-card {
        min-height: 230px;
        padding: 14px;
    }

    /* Profile post cards: middle.css also styles this avatar.  Lock every
       dimension together so it stays round in Posts, Likes, and Saved. */
    .profile-card-avatar {
        width: 36px;
        height: 36px;
        flex: 0 0 36px;
        aspect-ratio: 1 / 1;
        border-radius: 50%;
        overflow: hidden;
    }

    .profile-card-avatar img {
        width: 100%;
        height: 100%;
        border-radius: inherit;
        object-fit: cover;
    }

    .profile-create-post-button {
        top: calc(var(--acki-topbar-height) + 8px);
        padding: 8px 14px;
        font-size: 14px;
    }

    .profile-composer {
        top: var(--acki-topbar-height);
    }

    .profile-composer-inner {
        width: calc(100% - 20px);
        max-height: calc(100dvh - var(--acki-topbar-height) - 10px);
        overflow-y: auto;
        padding: 16px;
    }

    .profile-composer textarea {
        min-height: 130px;
        max-height: 42dvh;
    }

    .profile-edit-modal,
    .profile-delete-modal {
        width: calc(100% - 24px);
        max-height: calc(100dvh - 24px);
        overflow-y: auto;
        padding: 18px;
    }

    .profile-avatar-preview {
        width: 90px;
        height: 90px;
    }

    .profile-delete-actions {
        flex-wrap: wrap;
    }

    .profile-delete-actions button {
        flex: 1 1 120px;
        min-height: 42px;
    }
}

/* Very narrow phones */
@media (max-width: 380px) {

    .edge-tab i,
    .nav-icon-wrap {
        width: 34px;
    }

    .edge-tab i {
        font-size: 20px;
    }

    .lang-toggle {
        min-width: 42px;
        padding-inline: 8px;
    }

    .post-body {
        padding-inline: 14px;
    }

    .post-active button {
        min-width: 36px;
        font-size: 20px;
    }
}

/* Short landscape screens */
@media (max-height: 540px) and (orientation: landscape) {
    .create-post {
        max-height: calc(100dvh - var(--acki-topbar-height));
        padding-top: 38px;
    }

    .create-text {
        min-height: 100px;
        max-height: 30dvh;
    }

    .comment-panel {
        height: calc(100dvh - var(--acki-topbar-height));
        top: var(--acki-topbar-height);
        bottom: auto;
        border-radius: 0;
    }
}

/* Touch devices: do not depend on hover feedback. */
@media (hover: none) {

    .edge-tab i:hover,
    .post-active button:hover,
    .back-link:hover,
    .back-btn:hover {
        transform: none;
    }

    .create-post-tab:hover,
    .create-post-tab:active {
        background: #2f2f2f;
        transform: translateX(-50%);
    }

    body.theme-dark .create-post-tab:hover,
    body.theme-dark .create-post-tab:active {
        background: #ffffff;
        transform: translateX(-50%);
    }
}

/* Respect accessibility preferences. */
@media (prefers-reduced-motion: reduce) {

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

html,
body {
    width: 100vw;
    max-width: 100vw;
    min-width: 100vw;
    margin: 0;
    padding: 0;
    overflow-x: hidden !important;
    overscroll-behavior-x: none;
}

* {
    box-sizing: border-box;
}

.acki-scene,
#weatherEvents,
.content,
.edge-tab,
.edge-top {
    max-width: 100%;
}

/* ---------- Mobile browser cleanup ----------
   Keep vertical scrolling, but hide the bright native scrollbar track
   that appears at the right edge on some Android browsers / DevTools. */
html,
body {
    min-width: 0;
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* Legacy Edge */
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

/* Keep full-screen visual layers attached to the viewport itself. */
.acki-scene,
#weatherEvents {
    position: fixed;
    inset: 0;
    width: auto;
    max-width: none;
}

@media (max-width: 640px) {

    /* Keep the disabled-notification slash centred on the bell. */
    .nav-icon-wrap .notification-disabled {
        width: 38px;
        height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .nav-icon-wrap .notification-disabled::after {
        left: 50%;
        top: 50%;
        width: 21px;
        height: 2px;
        transform: translate(-50%, -50%) rotate(-38deg);
    }
}