/* Easy Exif — editor */

:root {
    /* The site's dark palette (css/site.css), so the two read as one product. */
    --bg: #171512;
    --surface: #1f1c18;
    --surface-2: #28241f;
    --border: #35302a;
    --border-strong: #4a433a;
    --text: #f0ebe2;
    --muted: #b5ab9b;
    --faint: #837a6b;
    --accent: #4caf6e;
    --accent-light: #8fd3a5; /* green for small text, where --accent reads too dark */
    --accent-ink: #0b1a10;
    --radius: 10px;
}

* {
    box-sizing: border-box;
}

/* Rules like `display: flex` would otherwise override the hidden attribute
   and show things that should be hidden (e.g. the empty preview canvas). */
[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Top bar */

.topbar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 22px;
    background: var(--bg);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
}

.topbar-link {
    margin-left: auto;
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
}

.topbar-link + .topbar-link {
    margin-left: 0;
}

.topbar-link:hover {
    color: var(--text);
}

/* Footer: the way to the about page, as on the site pages */

.site-foot {
    padding: 8px 24px 28px;
    color: var(--muted);
    font-size: 13px;
    text-align: center;
}

.site-foot a {
    color: var(--muted);
}

.site-foot a:hover {
    color: var(--text);
}

/* Layout */

.workspace {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr) 380px;
    grid-template-areas: "left stage right";
    gap: 24px;
    align-items: start;
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px;
}

.panel-left {
    grid-area: left;
    position: sticky;
    top: 24px;
}

.panel-right {
    grid-area: right;
}

/* Preview stage */

.stage {
    grid-area: stage;
    position: sticky;
    top: 24px;
    min-width: 0;
}

.stage-canvas {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        linear-gradient(45deg, #1b1915 25%, transparent 25%) -10px 0 / 20px 20px,
        linear-gradient(-45deg, #1b1915 25%, transparent 25%) -10px 0 / 20px 20px,
        linear-gradient(45deg, transparent 75%, #1b1915 75%) / 20px 20px,
        linear-gradient(-45deg, transparent 75%, #1b1915 75%) / 20px 20px,
        var(--surface);
    transition: border-color 0.15s, background-color 0.15s;
}

.stage-canvas.is-dragging {
    border-color: var(--accent);
    background-color: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

#preview {
    display: block;
    max-width: 100%;
    max-height: 76vh;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

/* Empty state */

.dropzone {
    padding: 48px 24px;
    color: var(--muted);
    text-align: center;
    cursor: pointer;
}

.dropzone svg {
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    color: var(--accent);
}

.dropzone h2 {
    margin: 0 0 6px;
    color: var(--text);
    font-size: 19px;
}

.dropzone p {
    margin: 0;
    font-size: 14px;
}

.dropzone .hint {
    margin-top: 14px;
    color: var(--accent-light);
    font-size: 13px;
}

/* Loading progress, between the preview and the filmstrip */

.loading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.loading-bar {
    flex: 1 1 auto;
    height: 6px;
    border-radius: 999px;
    background: var(--surface-2);
    overflow: hidden;
}

.loading-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.2s ease;
}

.loading-text {
    flex: none;
    color: var(--muted);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* Thumbnails */

.filmstrip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    margin-top: 12px;
    padding-bottom: 4px;
}

.thumb {
    flex: 0 0 auto;
    width: 72px;
    height: 72px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    background: none;
    cursor: pointer;
    overflow: hidden;
}

.thumb.is-active {
    border-color: var(--accent);
}

.thumb-add {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed var(--border);
    color: var(--muted);
    transition: border-color 0.15s, color 0.15s;
}

.thumb-add:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.thumb-add svg {
    width: 26px;
    height: 26px;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Control panel */

.panel {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

/* Photo controls wait for a photo; `inert` blocks input, this shows it. */
.panel.is-locked {
    opacity: 0.4;
    filter: grayscale(1);
    user-select: none;
}

.field-block {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

.field-block h3 {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.block-head h3 {
    margin-bottom: 12px;
}

.exif-flag {
    margin-bottom: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--accent-light);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* Style picker */

.styles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.style-btn {
    flex: 1 1 auto;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--muted);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: 0.15s;
}

.style-btn:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.style-btn.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

/* Fields */

.fields,
.appearance {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.field.wide {
    grid-column: 1 / -1;
}

.field > span,
.field > label {
    color: var(--muted);
    font-size: 12px;
}

.field em {
    color: var(--text);
    font-style: normal;
}

input[type="text"],
select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

input[type="text"]:focus,
select:focus {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
    border-color: transparent;
}

input::placeholder {
    color: var(--faint);
}

/* Color picker */

.cp {
    position: relative;
}

.cp-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
}

.cp-trigger:hover,
.cp-trigger[aria-expanded="true"] {
    border-color: var(--border-strong);
}

.cp-trigger:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -1px;
}

.cp-swatch {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.cp-pop {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 224px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.5);
}

.cp-pop[hidden] {
    display: none;
}

.cp-sv {
    position: relative;
    height: 140px;
    border-radius: 6px;
    background:
        linear-gradient(to top, #000, transparent),
        linear-gradient(to right, #fff, var(--hue, red));
    cursor: crosshair;
    touch-action: none;
}

.cp-thumb {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 1px 4px rgba(0, 0, 0, 0.4);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.cp-hue {
    height: 12px;
    margin: 0;
    border-radius: 6px;
    background: linear-gradient(to right, #f00, #ff0, #0f0, #0ff, #00f, #f0f, #f00);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.cp-hue::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
    -webkit-appearance: none;
}

.cp-hue::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.cp-hex {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 13px;
    text-transform: uppercase;
}

.cp-presets {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}

.cp-preset {
    aspect-ratio: 1;
    padding: 0;
    border: 0;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
    cursor: pointer;
}

.cp-preset:hover {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

/* Credits */

.input-icon {
    position: relative;
    display: block;
}

.input-icon svg {
    position: absolute;
    top: 50%;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--muted);
    transform: translateY(-50%);
    pointer-events: none;
}

.input-icon input {
    padding-left: 32px;
}

.socials {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.socials:not(:empty) {
    margin-top: 12px;
}

.social-row {
    display: grid;
    grid-template-columns: 28px 20px 96px minmax(0, 1fr) 26px;
    align-items: center;
    gap: 6px;
}

.credit-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
}

.icon-btn.eye-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
}

.icon-btn.eye-btn[aria-pressed="true"] {
    color: var(--muted);
}

.icon-btn.eye-btn svg {
    width: 16px;
    height: 16px;
    color: inherit;
}

/* Hidden credits stay editable, just visibly switched off. */
.is-hidden > span,
.is-hidden > select,
.is-hidden > input {
    opacity: 0.45;
}

.social-row svg {
    width: 20px;
    height: 20px;
    color: var(--muted);
}

.icon-btn {
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 7px;
    background: none;
    color: var(--muted);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.icon-btn:hover {
    border-color: var(--border);
    color: var(--text);
}

.socials-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
}

.socials-foot .btn {
    padding: 7px 12px;
    font-size: 13px;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 13px;
    cursor: pointer;
}

.consent .toggle {
    color: var(--text);
    font-weight: 600;
}

.toggle input {
    accent-color: var(--accent);
}

/* Buttons */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

h3 + .actions {
    margin-top: 0;
}

.btn {
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: 0.15s;
}

.btn:hover:not(:disabled) {
    border-color: var(--border-strong);
}

.btn:disabled {
    opacity: 0.55;
    cursor: default;
}

.btn-primary {
    flex: 1 1 auto;
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 600;
}

.btn-ghost {
    width: 100%;
    margin-top: 12px;
    background: none;
    color: var(--muted);
    font-size: 13px;
}

.btn-ghost:hover {
    color: var(--text);
}

.note {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 12px;
}

/* Medium screens: credits drop under the preview */

@media (max-width: 1280px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr) 380px;
        grid-template-areas:
            "stage right"
            "left right";
    }

    .stage,
    .panel-left {
        position: static;
    }
}

/* Narrow screens */

@media (max-width: 1000px) {
    .workspace {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "stage"
            "left"
            "right";
        padding: 16px;
    }

    .stage {
        position: static;
    }

    #preview {
        max-height: 55vh;
    }
}
