/* Image Holder landing: continuity of the 2017 design, light default + dark toggle, no build step. */

@font-face {
    font-family: "PT Sans";
    src: url("/fonts/ptsans.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "PT Sans";
    src: url("/fonts/ptsans-bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Fira Code";
    src: url("/fonts/firacode.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}

:root {
    --bg: #eceff4;
    --bg-raised: #ffffff;
    --bg-input: #ffffff;
    --line: #cad3df;
    --text: #3d4d65;
    --text-dim: #8493a8;
    --accent: #0082d5;
    --accent-hover: #0073bd;
    --accent-ink: #ffffff;
    --shadow: 0 2px 10px rgb(61 77 101 / 0.08);
    --radius: 8px;
    --mono: "Fira Code", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --sans: "PT Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --maxw: 1160px;
}

[data-theme="dark"] {
    --bg: #171a21;
    --bg-raised: #20242e;
    --bg-input: #262b37;
    --line: #333a48;
    --text: #dfe4ec;
    --text-dim: #8b96a8;
    --accent: #3399e8;
    --accent-hover: #55aaee;
    --accent-ink: #0c1220;
    --shadow: 0 2px 10px rgb(0 0 0 / 0.35);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    transition: background 0.25s ease, color 0.25s ease;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

code, pre { font-family: var(--mono); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

.visually-hidden {
    position: absolute; width: 1px; height: 1px;
    clip: rect(0 0 0 0); overflow: hidden; white-space: nowrap;
}

/* ---------- header ---------- */

.site-header { border-bottom: 1px solid var(--line); background: var(--bg-raised); }

.header-in {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
    flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }

.logo { display: inline-flex; }
.logo img { display: block; height: 36px; width: auto; }

.brand__text { display: flex; flex-direction: column; line-height: 1.3; }
.brand__text strong { font-size: 18px; letter-spacing: 0.01em; }
.brand__text span { color: var(--text-dim); font-size: 13px; }

.nav { display: flex; align-items: center; gap: 22px; }

.nav a {
    color: var(--text);
    text-decoration: none;
    font-size: 15px;
    border-bottom: 2px solid transparent;
    padding-bottom: 2px;
}
.nav a:hover, .nav a:focus-visible { color: var(--accent); border-bottom-color: var(--accent); }

.theme-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg-raised);
    color: var(--text);
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-toggle:hover, .theme-toggle:focus-visible { transform: scale(1.1); border-color: var(--accent); outline: none; color: var(--accent); }

[data-theme="dark"] .theme-toggle__icon--sun { display: none; }
html:not([data-theme="dark"]) .theme-toggle__icon--moon { display: none; }
.theme-toggle__icon { display: block; }
.theme-toggle__icon--sun circle { fill: currentColor; }
.theme-toggle__icon--sun g { stroke: currentColor; }
.theme-toggle__icon--moon path { fill: currentColor; }

.tip {
    margin: 0;
    padding: 0 0 14px;
    color: var(--text-dim);
    font-size: 14px;
}

.sublime-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.sublime-link img { vertical-align: -2px; }

/* ---------- sections ---------- */

.section { padding: clamp(28px, 5vh, 56px) 0; }

.section__title { font-size: 26px; margin: 0 0 8px; }

.section__sub { color: var(--text-dim); max-width: 68ch; margin: 0 0 20px; }

/* ---------- studio ---------- */

.studio {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: clamp(18px, 2.5vw, 32px);
    align-items: start;
}

.studio__out { position: sticky; top: 20px; }

.preview {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: repeating-conic-gradient(#d7dde6 0% 25%, #eef1f6 0% 50%) 0 0 / 20px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 420px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

@media (max-width: 1200px) { .preview { height: 380px; } }
@media (max-width: 880px)  { .preview { height: 300px; } }
@media (max-width: 520px)  { .preview { height: 220px; } }

.preview img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}
.preview img.is-loading { opacity: 0.35; }

.preview__meta {
    position: absolute;
    right: 10px;
    bottom: 8px;
    font-family: var(--mono);
    font-size: 11.5px;
    color: var(--text-dim);
    background: color-mix(in srgb, var(--bg-raised) 85%, transparent);
    padding: 2px 8px;
    border-radius: 6px;
}

.preview__error {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--bg-raised) 90%, transparent);
    color: #d2335c;
    font-size: 14px;
    text-align: center;
    padding: 20px;
    border-radius: var(--radius);
    z-index: 1;
}
.preview__error[hidden] { display: none; }
.preview__error:not([hidden]) { display: flex; }

.urlbox {
    margin-top: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
    padding: 10px 14px;
}

.urlbox__url {
    display: block;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.55;
    word-break: break-all;
    color: var(--accent);
    text-decoration: none;
}
.urlbox__url:hover { text-decoration: underline; }

.copies { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* form */

.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 12px; }

.field { margin-bottom: 14px; min-width: 0; }

.field label {
    display: block;
    font-size: 13px;
    color: var(--text-dim);
    margin-bottom: 5px;
}

.field input[type="text"],
.field input[type="number"],
.field select {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg-input);
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
}

.field input:focus-visible,
.field select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: transparent;
}

.field__hint { font-size: 12.5px; color: var(--text-dim); margin: 5px 0 0; line-height: 1.5; }

.colorfield { display: flex; gap: 8px; align-items: center; }

.colorfield__picker {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-input);
    cursor: pointer;
}
.colorfield__picker::-webkit-color-swatch-wrapper { padding: 0; }
.colorfield__picker::-webkit-color-swatch { border: none; border-radius: 4px; }
.colorfield__picker::-moz-color-swatch { border: none; border-radius: 4px; }

.swatches { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.swatches button {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--sw);
    cursor: pointer;
    padding: 0;
    transition: transform 0.15s ease;
}
.swatches button:hover, .swatches button:focus-visible { transform: scale(1.18); }
.swatches button[style*="transparent"] {
    background: repeating-conic-gradient(#c3ccd9 0% 25%, #eef1f6 0% 50%) 0 0 / 10px 10px;
}
[data-theme="dark"] .swatches button[style*="transparent"] {
    background: repeating-conic-gradient(#3a4152 0% 25%, #22272f 0% 50%) 0 0 / 10px 10px;
}

.check {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 14px;
    color: var(--text-dim);
    cursor: pointer;
    margin-bottom: 16px;
}
.check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* presets */

.presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.presets__label { color: var(--text-dim); font-size: 13px; }

.presets button {
    height: 30px;
    padding: 0 11px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg-raised);
    color: var(--text);
    font-family: var(--mono);
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease;
}
.presets button:hover, .presets button:focus-visible { border-color: var(--accent); }
.presets button:active { transform: translateY(1px); }

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    padding: 0 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn:active { transform: translateY(1px); }

.btn--small {
    height: 34px;
    padding: 0 13px;
    font-size: 13px;
    font-weight: 400;
    background: var(--bg-raised);
    color: var(--text);
    border-color: var(--line);
    font-family: var(--mono);
}
.btn--small:hover, .btn--small:focus-visible { border-color: var(--accent); }
.btn--small[data-copied="1"] { border-color: var(--accent); color: var(--accent); }

/* ---------- font gallery ---------- */

.fontgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 10px;
}

.fontgrid button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
    padding: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.15s ease;
}
.fontgrid button:hover, .fontgrid button:focus-visible { border-color: var(--accent); }
.fontgrid button:active { transform: translateY(1px); }

.fontgrid img {
    display: block;
    width: 100%;
    height: auto;
}

[data-theme="dark"] .fontgrid img { filter: invert(0.88); }

/* ---------- api ---------- */

.mask, .snippets, .docs {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg-raised);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.mask h3, .examples h3, .snippets h3, .docs h3 { font-size: 19px; margin: 0 0 12px; }
.paramgroup h4 { font-size: 13px; font-family: var(--mono); color: var(--text-dim); margin: 0 0 10px; font-weight: 400; }

.mask__line { font-size: 15px; }
.mask__line code, .mask__line b { font-size: 14px; }
.mask__line b { color: var(--text-dim); font-weight: 400; }
.mask__example {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 10px 14px;
    word-break: break-all;
}
.mask__example a { font-family: var(--mono); font-size: 13px; }

.examples { margin-bottom: 20px; }

.examples__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px 14px;
}

.example {
    display: block;
    text-decoration: none;
    transition: transform 0.15s ease;
}
.example:hover, .example:focus-visible { transform: translateY(-2px); }

.example__frame {
    display: block;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        repeating-conic-gradient(#d7dde6 0% 25%, #eef1f6 0% 50%) 0 0 / 16px 16px;
    padding: 8px;
    aspect-ratio: 5 / 3;
}
[data-theme="dark"] .example__frame {
    background: repeating-conic-gradient(#242936 0% 25%, #1c212c 0% 50%) 0 0 / 16px 16px;
}

.example__frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

/* square responses (rounded) fit inside instead of cropping */
.example--contain .example__frame img { object-fit: contain; }

.example__caption {
    display: block;
    margin-top: 7px;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-dim);
    text-decoration: none;
}
.example:hover .example__caption, .example:focus-visible .example__caption { color: var(--accent); }

.snippets { display: grid; gap: 14px; }

.snippet h4 { margin: 0 0 6px; font-size: 13px; font-family: var(--mono); color: var(--text-dim); font-weight: 400; }

.snippet pre {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    overflow-x: auto;
    max-width: 100%;
    font-size: 12.5px;
    line-height: 1.6;
    margin: 0;
}

.snippet code { white-space: pre; }

.docs__params { display: grid; grid-template-columns: 1fr; gap: 26px; }

.paramgroup dl { margin: 0; }

.paramgroup dl > div {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 2px 16px;
    padding: 7px 0;
    align-items: baseline;
}

.paramgroup dt { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.paramgroup dd { margin: 0; font-size: 13.5px; color: var(--text); }

@media (max-width: 480px) {
    .paramgroup dl > div { grid-template-columns: 1fr; gap: 1px; }
}

.limits {
    margin: 18px 0 0;
    color: var(--text-dim);
    font-size: 14px;
    border-left: 2px solid var(--line);
    padding-left: 14px;
}

html, body { overflow-x: clip; }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--line); margin-top: 20px; padding: 22px 0 30px; }
.footer p { margin: 0 0 6px; color: var(--text-dim); font-size: 14px; }
.footer p:last-child { margin-bottom: 0; }
.footer .sublime-link { color: var(--text); }
.footer .sublime-link:hover { color: var(--accent); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
    .section { animation: rise 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
    @keyframes rise {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: none; }
    }
}

/* ---------- mobile ---------- */

@media (max-width: 880px) {
    .studio { grid-template-columns: 1fr; }
    .studio__out { position: static; order: -1; }
    .docs__params { grid-template-columns: 1fr; }
    .header-in { justify-content: center; text-align: center; }
}

@media (max-width: 520px) {
    .nav { gap: 14px; }
    .nav a { font-size: 14px; }
    .brand__text span { display: none; }
}
