:root {
    --bg: #eef2f4;
    --bg-deep: #dfe6ea;
    --ink: #152028;
    --muted: #5b6b75;
    --line: #c9d3da;
    --card: #ffffff;
    --accent: #0f6e56;
    --accent-hover: #0b5744;
    --danger: #9b2c2c;
    --shadow: 0 14px 40px rgba(21, 32, 40, 0.08);
    --radius: 18px;
    --font: "DM Sans", sans-serif;
    --display: "Fraunces", Georgia, serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(15, 110, 86, 0.10), transparent 30%),
        linear-gradient(180deg, #f5f8fa 0%, var(--bg) 42%, #e4ebef 100%);
    min-height: 100vh;
    line-height: 1.5;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

.wrap {
    width: min(1120px, calc(100% - 2rem));
    margin-inline: auto;
}

.narrow {
    width: min(640px, calc(100% - 2rem));
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    backdrop-filter: blur(12px);
    background: rgba(238, 242, 244, 0.88);
    border-bottom: 1px solid rgba(201, 211, 218, 0.8);
}

.header-inner,
.footer-inner,
.admin-bar,
.prompt-toolbar,
.search {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.header-inner {
    padding: 1rem 0;
}

.brand {
    font-family: var(--display);
    font-size: 1.7rem;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.nav {
    display: flex;
    gap: 1rem;
}

.nav a {
    color: var(--muted);
    font-weight: 500;
}

.nav a:hover {
    color: var(--ink);
}

.site-main {
    padding-bottom: 4rem;
}

.hero {
    padding: 3.5rem 0 2rem;
}

.hero-inner {
    animation: rise 0.7s ease both;
}

.eyebrow {
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

.hero h1,
.detail-side h1,
.admin-bar h1,
.narrow h1 {
    font-family: var(--display);
    font-weight: 400;
    letter-spacing: -0.03em;
    line-height: 1.05;
    margin: 0;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 5.5rem);
}

.lede {
    max-width: 32rem;
    color: var(--muted);
    font-size: 1.1rem;
    margin: 1rem 0 0;
}

.search {
    margin: 0 0 1.75rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.35rem 0.35rem 0.35rem 1rem;
    box-shadow: var(--shadow);
}

.search input {
    flex: 1;
    border: 0;
    background: transparent;
    font: inherit;
    color: var(--ink);
    outline: none;
}

.search button,
.btn {
    border: 0;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    padding: 0.75rem 1.2rem;
    cursor: pointer;
}

.search button:hover,
.btn:hover {
    background: var(--accent-hover);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
}

.card {
    display: block;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    animation: rise 0.6s ease both;
}

.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 44px rgba(28, 25, 20, 0.12);
    color: inherit;
}

.card-media {
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: var(--bg-deep);
}

.card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.45s ease;
}

.card:hover .card-media img {
    transform: scale(1.04);
}

.card-body {
    padding: 1rem 1.1rem 1.2rem;
}

.card-body h2 {
    margin: 0;
    font-size: 1.15rem;
    font-family: var(--display);
    font-weight: 400;
}

.tags {
    margin: 0.4rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.detail {
    padding-top: 1.5rem;
}

.back {
    display: inline-block;
    margin-bottom: 1.25rem;
    color: var(--muted);
}

.detail-layout {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2rem;
    align-items: start;
}

.detail-visual {
    animation: rise 0.65s ease both;
}

.detail-media {
    margin: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.detail-media img {
    width: 100%;
    height: auto;
}

.ba {
    --ba-pos: 50%;
    position: relative;
    overflow: hidden;
    border-radius: 24px;
    border: 1px solid var(--line);
    background: #101820;
    box-shadow: var(--shadow);
    user-select: none;
    touch-action: none;
    cursor: ew-resize;
    width: 100%;
    aspect-ratio: 4 / 5;
}

.ba.is-ready {
    aspect-ratio: auto;
}

.ba-after,
.ba-before {
    display: block;
    pointer-events: none;
    -webkit-user-drag: none;
}

.ba-after {
    position: relative;
    z-index: 1;
    width: 100%;
    height: auto;
    vertical-align: top;
}

.ba-before-wrap {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 2;
    width: var(--ba-pos);
    overflow: hidden;
    border-right: 2px solid rgba(255, 255, 255, 0.95);
}

.ba-before {
    position: absolute;
    top: 0;
    left: 0;
    width: var(--ba-full-width, 100%);
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
}

.ba-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--ba-pos);
    width: 0;
    transform: translateX(-50%);
    z-index: 3;
    pointer-events: none;
}

.ba-handle-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.95);
}

.ba-handle-knob {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.96);
    border: 2px solid rgba(19, 32, 40, 0.12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}

.ba-handle-knob::before,
.ba-handle-knob::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 0;
    height: 0;
    border-style: solid;
    transform: translateY(-50%);
}

.ba-handle-knob::before {
    left: 11px;
    border-width: 6px 7px 6px 0;
    border-color: transparent #152028 transparent transparent;
}

.ba-handle-knob::after {
    right: 11px;
    border-width: 6px 0 6px 7px;
    border-color: transparent transparent transparent #152028;
}

.ba-label {
    position: absolute;
    top: 0.85rem;
    z-index: 4;
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    background: rgba(16, 24, 32, 0.72);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    pointer-events: none;
}

.ba-label--before { left: 0.85rem; }
.ba-label--after { right: 0.85rem; }

.form-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-pair .preview {
    margin-top: 0.6rem;
}

.detail-side {
    animation: rise 0.75s ease both;
}

.detail-side h1 {
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    margin-bottom: 0.5rem;
}

.prompt-box {
    margin-top: 1.5rem;
    background: #132028;
    color: #eef5f2;
    border-radius: 20px;
    overflow: hidden;
}

.prompt-toolbar {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(238, 245, 242, 0.7);
    font-size: 0.9rem;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.btn-copy:hover,
.btn-copy.is-copied {
    background: var(--accent);
}

.prompt-box pre {
    margin: 0;
    padding: 1.1rem 1.15rem 1.3rem;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.55;
}

.notes {
    margin-top: 1.5rem;
    padding: 1.1rem 1.2rem;
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.notes h2 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
}

.notes p {
    margin: 0;
    color: var(--muted);
}

.admin-actions {
    margin-top: 1.5rem;
}

.danger {
    color: var(--danger);
}

.form {
    display: grid;
    gap: 0.7rem;
    margin-top: 1.25rem;
}

.form label {
    font-weight: 600;
    font-size: 0.95rem;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="file"],
.form textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--card);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    font: inherit;
    color: var(--ink);
}

.form textarea {
    resize: vertical;
}

.preview,
.thumb {
    border-radius: 12px;
    border: 1px solid var(--line);
}

.preview {
    max-height: 220px;
    width: auto;
}

.thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
}

.admin-bar {
    margin: 1.5rem 0;
}

.admin-table-wrap {
    overflow-x: auto;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}

.admin-table th {
    font-size: 0.85rem;
    color: var(--muted);
    font-weight: 600;
}

.admin-table tr:last-child td {
    border-bottom: 0;
}

.actions {
    display: flex;
    gap: 0.85rem;
    white-space: nowrap;
}

.empty,
.flash {
    padding: 1rem 1.15rem;
    border-radius: 14px;
    margin: 1rem 0;
}

.empty {
    background: rgba(255, 255, 255, 0.75);
    border: 1px dashed var(--line);
    text-align: center;
}

.flash--success {
    background: #e4f4ee;
    color: #0b5744;
}

.flash--error {
    background: #f8e6e6;
    color: var(--danger);
}

.site-footer {
    border-top: 1px solid var(--line);
    padding: 1.5rem 0 2rem;
    color: var(--muted);
    font-size: 0.95rem;
}

.footer-note {
    margin: 0;
}

.ad-slot {
    width: min(1120px, calc(100% - 2rem));
    margin: 1.25rem auto;
    min-height: 90px;
    display: grid;
    place-items: center;
    border: 1px dashed var(--line);
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.85rem;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 800px) {
    .detail-layout {
        grid-template-columns: 1fr;
    }

    .form-pair {
        grid-template-columns: 1fr;
    }

    .header-inner,
    .admin-bar,
    .footer-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .search {
        flex-direction: column;
        border-radius: 18px;
        padding: 0.75rem;
    }

    .search button,
    .btn {
        width: 100%;
    }
}
