/* Freeform place-on-page items — per tab, full viewport */
.fg-freeform-stage {
    position: fixed;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}
.fg-freeform-stage.is-editable {
    pointer-events: auto;
    cursor: crosshair;
    z-index: 35;
}
.fg-freeform-item {
    position: absolute;
    box-sizing: border-box;
    pointer-events: auto;
    cursor: grab;
    touch-action: none;
    overflow: hidden;
}
.fg-freeform-item.fg-freeform-bg {
    z-index: 1;
}
.fg-freeform-item:not(.fg-freeform-bg) {
    z-index: 3;
}
.fg-freeform-stage.is-editable .fg-freeform-item.is-selected {
    outline: 2px solid #3dffa8;
    outline-offset: 1px;
    z-index: 5;
}
.fg-freeform-bg-fill {
    width: 100%;
    height: 100%;
    min-height: 2rem;
}
.fg-freeform-text {
    width: 100%;
    height: 100%;
    padding: 0.45rem 0.55rem;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.45rem;
    color: #1a1a1a;
    font-size: 0.95rem;
    line-height: 1.35;
    overflow: auto;
}
.fg-freeform-heading {
    font-size: 1.15rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    line-height: 1.2;
}
.fg-freeform-card-grid {
    display: grid;
    grid-template-columns: repeat(var(--fg-grid-cols, 3), minmax(0, 1fr));
    gap: 0.35rem;
    width: 100%;
    height: 100%;
    padding: 0.25rem;
    box-sizing: border-box;
}
.fg-freeform-grid-cell {
    border: 1px dashed rgba(120, 120, 128, 0.45);
    border-radius: 0.35rem;
    min-height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    opacity: 0.75;
}
.fg-pattern-stagger .fg-freeform-grid-cell:nth-child(odd) {
    transform: translateY(3px);
}
.fg-freeform-text.is-transparent {
    background: transparent !important;
    border-color: rgba(120, 120, 128, 0.35);
    color: inherit;
}
body.is-paper-edit .fg-freeform-text.is-transparent {
    border-style: dashed;
}
body:not(.is-freeform-edit) .fg-freeform-text.is-transparent {
    border: none;
    box-shadow: none;
}
.fg-item-apply {
    font-weight: 700;
    color: #2d8a4e;
}
.fg-freeform-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0.35rem 0.6rem;
    background: rgba(16, 24, 34, 0.88);
    color: #f4f7fb;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}
.fg-freeform-post-card {
    width: 100%;
    height: 100%;
    padding: 0.55rem 0.65rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 0.55rem;
    color: #1a1a1a;
    overflow: auto;
}
.fg-freeform-post-card strong {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 1rem;
}
.fg-freeform-post-card p {
    margin: 0;
    font-size: 0.85rem;
    line-height: 1.35;
}
.fg-freeform-card-media {
    width: 100%;
    max-height: 45%;
    overflow: hidden;
    border-radius: 0.4rem;
    margin-bottom: 0.4rem;
}
.fg-freeform-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fg-freeform-card-link {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    word-break: break-all;
    opacity: 0.85;
}
.fg-freeform-area {
    width: 100%;
    height: 100%;
    overflow: auto;
    padding: 0.55rem;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.14);
    border-radius: 0.75rem;
}
.fg-feed-grid {
    display: grid;
    gap: 0.55rem;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.fg-feed-grid-posts {
    grid-template-columns: 1fr;
}
.fg-feed-card {
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.55rem;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    color: #1a1a1a;
}
.fg-feed-media {
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}
.fg-feed-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fg-feed-body {
    padding: 0.45rem 0.55rem 0.6rem;
}
.fg-feed-body strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.2rem;
}
.fg-feed-body p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
}
.fg-feed-empty {
    min-height: 4rem;
    display: grid;
    place-items: center;
    opacity: 0.7;
    font-size: 0.9rem;
}
.fg-freeform-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: rgba(0, 0, 0, 0.2);
}
.fg-freeform-handle {
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    background: #3dffa8;
    border: 1px solid #0a1220;
    display: none;
    z-index: 6;
    touch-action: none;
}
.fg-freeform-handle-se { right: -7px; bottom: -7px; cursor: nwse-resize; }
.fg-freeform-handle-ne { right: -7px; top: -7px; cursor: nesw-resize; }
.fg-freeform-handle-sw { left: -7px; bottom: -7px; cursor: nesw-resize; }
.fg-freeform-handle-nw { left: -7px; top: -7px; cursor: nwse-resize; }
.fg-freeform-stage.is-editable .fg-freeform-item.is-selected .fg-freeform-handle {
    display: block;
}

.fg-tab-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    max-width: min(100%, 42rem);
}
.fg-tab-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(201, 162, 39, 0.45);
    color: #e4c76a;
    text-decoration: none;
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.35);
}
.fg-tab-chip.is-active {
    background: linear-gradient(135deg, rgba(61, 200, 160, 0.35), rgba(91, 140, 255, 0.35));
    border-color: rgba(61, 255, 168, 0.55);
    color: #fff;
}
.fg-tab-new {
    font-size: 0.78rem !important;
    padding: 0.28rem 0.7rem !important;
}

.fg-design-tabbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    padding: 0.55rem 0.75rem;
    margin: 0 auto 0.75rem;
    max-width: 840px;
    border-radius: 14px;
    background: rgba(12, 16, 22, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.fg-design-tabbar .fg-tab-chip {
    font-size: 0.82rem;
}

.fg-item-del {
    background: rgba(220, 70, 70, 0.92) !important;
    color: #fff !important;
    font-weight: 700;
    line-height: 1;
}

.fg-workshop-actions .btn:disabled {
    opacity: 0.35;
    pointer-events: none;
}

.fg-freeform-bar {
    position: fixed;
    top: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.65rem;
    border-radius: 999px;
    background: rgba(16, 24, 34, 0.94);
    color: #f4f7fb;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.fg-freeform-bar.is-saved {
    outline: 2px solid #3dffa8;
}
.fg-freeform-tab {
    font-size: 0.8rem;
    margin-right: 0.25rem;
    opacity: 0.9;
}
/* Design mode: page stays normal size; stage overlays for placed items */
body.is-admin-work.is-freeform-edit .look-page-canvas {
    display: block !important;
}
body.is-freeform-edit .site-header {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    z-index: 45;
}
body.is-freeform-edit .main {
    opacity: 1;
    pointer-events: auto;
    position: relative;
    z-index: 5;
}
/* Hide produce chrome in Utforming — page should look like audience + zone ✎ */
body.is-freeform-edit .admin-work-toolbar,
body.is-freeform-edit .home-cat-actions,
body.is-freeform-edit .fg-freeform-addbar,
body.is-freeform-edit .fg-slot-badge,
body.is-freeform-edit .nav-edit-go,
body.is-freeform-edit .site-header .nav-edit-toggle,
body.is-freeform-edit .site-header a[href="/admin/looks"],
body.is-freeform-edit .site-header a[href="/admin"],
body.is-freeform-edit .site-header form[action="/logout"] {
    display: none !important;
}
.fg-freeform-bar .btn:disabled {
    opacity: 0.45;
    cursor: default;
}
.fg-freeform-exit {
    text-decoration: none;
}

.fg-freeform-addbar {
    position: fixed;
    left: 0.75rem;
    bottom: 0.75rem;
    z-index: 60;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    max-width: min(96vw, 42rem);
    padding: 0.45rem 0.55rem;
    border-radius: 1rem;
    background: rgba(16, 24, 34, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
    color: #f4f7fb;
}
.fg-freeform-addbar-label {
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.75;
    margin-right: 0.15rem;
}
.fg-plus-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    border: 1px solid rgba(61, 255, 168, 0.45);
    background: #1a2433;
    color: #f4f7fb;
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    cursor: pointer;
}
.fg-plus-btn span {
    font-weight: 700;
    color: #3dffa8;
}
.fg-plus-btn:hover {
    background: #3dffa8;
    color: #0a1220;
}
.fg-plus-btn:hover span { color: inherit; }

.fg-item-tools,
.fg-native-tools {
    position: absolute;
    top: 0.2rem;
    right: 0.2rem;
    z-index: 40;
    display: flex;
    gap: 0.3rem;
    pointer-events: auto;
}
.fg-item-edit,
.fg-item-plus,
.fg-slot-badge {
    width: 2.15rem;
    height: 2.15rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.22);
    background: #fff;
    color: #111;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
    padding: 0;
    line-height: 1;
}
.fg-item-plus {
    color: #0a7a4a;
    border-color: rgba(10, 122, 74, 0.45);
}
.fg-item-edit {
    color: #0b3d66;
    border-color: rgba(11, 61, 102, 0.35);
}
.fg-slot-badge {
    position: fixed;
    top: 4.5rem;
    left: 0.75rem;
    z-index: 55;
    width: auto;
    height: auto;
    min-height: 2.1rem;
    padding: 0.3rem 0.65rem;
    gap: 0.35rem;
    font-size: 0.8rem;
}
.fg-slot-plus { color: #0a7a4a; font-weight: 800; }
.fg-slot-edit { opacity: 0.85; }
.fg-native-editable {
    position: relative;
}
.fg-native-editable .fg-native-tools {
    opacity: 0.95;
}

/* Overview workspace — not stretched across the whole monitor */
.fg-design-viewport {
    position: fixed;
    inset: 0;
    z-index: 25;
    overflow: auto;
    overscroll-behavior: contain;
    padding: 4.5rem 1.25rem 5.5rem;
    background: #e8e2d6;
}
.fg-design-slot {
    margin: 0 auto 2rem;
    /* width/height set by JS = artboard × zoom (no layout shift) */
}
.fg-design-scale {
    transform-origin: top left;
    width: 1100px;
    will-change: transform;
}
.fg-design-frame {
    position: relative;
    width: 1100px;
    min-height: 1200px;
    background: #f4f1ea;
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 0.35rem;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}
/* Real edit affordance — never a red placeholder square */
.fg-zone-btn { display: none !important; }
.fg-design-zone.is-zone-selected {
    outline: 2px solid #3dffa8;
    outline-offset: 2px;
    z-index: 20;
}
.fg-design-zone.is-zone-selected .fg-zone-handle {
    display: block;
}
body.is-freeform-edit .fg-design-frame .creator-name,
body.is-freeform-edit .fg-design-frame .creator-bio,
body.is-freeform-edit .fg-design-frame .brand,
body.is-freeform-edit .fg-design-frame .tagline,
body.is-freeform-edit .fg-design-frame h1,
body.is-freeform-edit .fg-design-frame h2,
body.is-freeform-edit .fg-design-frame .home-cat-title,
body.is-freeform-edit .fg-design-frame .blog-card-title {
    position: relative;
    z-index: 30;
}
.fg-add-menu {
    position: relative;
}
.fg-add-menu > summary {
    list-style: none;
    cursor: pointer;
}
.fg-add-menu > summary::-webkit-details-marker { display: none; }
.fg-add-menu-panel {
    position: absolute;
    top: calc(100% + 0.35rem);
    left: 0;
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 9rem;
    padding: 0.4rem;
    border-radius: 0.65rem;
    background: rgba(16, 24, 34, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.fg-add-menu-panel button {
    text-align: left;
    border: 0;
    background: transparent;
    color: #f4f7fb;
    padding: 0.4rem 0.55rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.85rem;
}
.fg-add-menu-panel button:hover {
    background: rgba(255, 255, 255, 0.1);
}
body.is-freeform-edit .fg-design-frame .look-page-canvas,
body.is-freeform-edit .fg-design-frame .fg-freeform-stage {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
}
body.is-freeform-edit .fg-design-frame .fg-freeform-stage.is-editable {
    z-index: 6;
    cursor: default;
}
body.is-freeform-edit .fg-design-frame .site-header,
body.is-freeform-edit .fg-design-frame .shell,
body.is-freeform-edit .fg-design-frame .main {
    position: relative;
    z-index: 4;
    opacity: 1 !important;
    pointer-events: auto !important;
}
body.is-freeform-edit .fg-design-frame .shell,
body.is-freeform-edit .fg-design-frame .main {
    max-width: 720px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}
body.is-freeform-edit .fg-design-frame .blog-card,
body.is-freeform-edit .fg-design-frame .content-card,
body.is-freeform-edit .fg-design-frame .media-card,
body.is-freeform-edit .fg-design-frame .feed-card {
    max-width: 16.5rem;
}
body.is-freeform-edit .fg-design-frame .fg-freeform-text,
body.is-freeform-edit .fg-design-frame .fg-freeform-post-card {
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* —— Ark-modus: bygg på ekte siden (100 %), ikke skalert mini-forhåndsvisning —— */
body.is-paper-edit {
    overflow-x: hidden;
}

body.is-paper-edit .fg-paper-wrap {
    position: relative;
    margin-left: 15.5rem;
    min-height: 100vh;
    max-width: none;
}

body.is-paper-edit .fg-paper-wrap .look-page-canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

body.is-paper-edit .fg-freeform-stage.is-on-paper {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    z-index: 15;
    overflow: visible;
    pointer-events: none;
}

body.is-paper-edit .fg-freeform-stage.is-on-paper.is-editable {
    pointer-events: auto;
    cursor: default;
}

body.is-paper-edit .fg-paper-wrap .shell {
    position: relative;
    z-index: 8;
    max-width: 840px;
    margin-left: auto;
    margin-right: auto;
}

body.is-paper-edit .fg-freeform-item {
    pointer-events: auto;
}

.fg-workshop-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 15.5rem;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding: 0.85rem 0.75rem 1rem;
    background: rgba(12, 14, 18, 0.97);
    border-right: 1px solid rgba(201, 162, 39, 0.35);
    color: #f4f7fb;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.fg-workshop-head {
    display: grid;
    gap: 0.15rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.fg-workshop-head strong {
    color: #e4c76a;
    font-size: 1rem;
}

.fg-workshop-tab {
    font-size: 0.78rem;
    opacity: 0.8;
}

.fg-workshop-section {
    display: grid;
    gap: 0.45rem;
}

.fg-workshop-label {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.7;
}

.fg-workshop-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.fg-workshop-tabs .fg-tab-chip {
    font-size: 0.72rem;
    padding: 0.22rem 0.5rem;
}

.fg-workshop-insert {
    display: grid;
    gap: 0.3rem;
}

.fg-workshop-insert button {
    text-align: left;
    border: 1px solid rgba(201, 162, 39, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: #f4f7fb;
    border-radius: 0.45rem;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
    cursor: pointer;
}

.fg-workshop-insert button:hover {
    background: rgba(61, 255, 168, 0.15);
    border-color: rgba(61, 255, 168, 0.45);
}

.fg-workshop-props {
    display: grid;
    gap: 0.4rem;
    padding: 0.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fg-workshop-props label {
    display: grid;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.fg-workshop-props input,
.fg-workshop-props textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.45);
    color: #f4f7fb;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
}

.fg-workshop-props-title {
    margin: 0;
    font-size: 0.72rem;
    opacity: 0.75;
}

.fg-workshop-actions {
    display: grid;
    gap: 0.35rem;
    margin-top: auto;
}

.fg-workshop-actions .btn {
    width: 100%;
    justify-content: center;
}

@media (max-width: 900px) {
    body.is-paper-edit .fg-paper-wrap {
        margin-left: 0;
        padding-bottom: 5rem;
    }
    .fg-workshop-rail {
        top: auto;
        right: 0;
        width: 100%;
        height: auto;
        max-height: 42vh;
        border-right: 0;
        border-top: 1px solid rgba(201, 162, 39, 0.35);
    }
    .fg-workshop-actions {
        margin-top: 0;
    }
}
    font-size: 0.9rem;
    max-width: 100%;
}
.fg-zoom-group {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    margin: 0 0.15rem;
}
.fg-zoom-btn {
    min-width: 2.1rem;
    padding-left: 0.45rem !important;
    padding-right: 0.45rem !important;
}
.fg-slot-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 12;
}
