/* ============================================================
   style.css — KriszzTzy Tool Site
   Design language: same as LippWangsaff portfolio
   Fonts: Bricolage Grotesque + DM Sans + DM Mono
   Themes: Dark (default) + Light via [data-theme="light"]
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700;12..96,800&family=DM+Sans:wght@400;500;600&family=DM+Mono:wght@400;500&display=swap');

/* ── DARK THEME (default) ── */
:root {
    --bg:         #080b12;
    --bg-raised:  #0e1320;
    --bg-card:    #121829;
    --border:     rgba(255,255,255,0.09);
    --border-lit: rgba(0,229,189,0.3);

    --cyan:   #00e5bd;
    --cyan-d: #00b899;
    --purple: #a78bfa;
    --rose:   #fb7185;
    --green:  #22c55e;

    --text-1: #f0f4ff;
    --text-2: #8b9ab0;
    --text-3: #4e5d70;

    --link:       #00e5bd;
    --backdrop:   rgba(8,11,18,0.55);
    --shadow:     0 8px 32px rgba(0,0,0,0.4);
    --shadow-sm:  0 2px 12px rgba(0,0,0,0.25);
}

/* ── LIGHT THEME ── */
[data-theme="light"] {
    --bg:         #f4f7ff;
    --bg-raised:  #eaeffa;
    --bg-card:    #ffffff;
    --border:     rgba(0,0,0,0.1);
    --border-lit: rgba(0,160,130,0.38);

    --cyan:   #008f7a;
    --cyan-d: #006f5e;
    --purple: #6d28d9;
    --rose:   #dc2626;
    --green:  #16a34a;

    --text-1: #0f172a;
    --text-2: #475569;
    --text-3: #94a3b8;

    --link:       #008f7a;
    --backdrop:   rgba(255,255,255,0.55);
    --shadow:     0 8px 32px rgba(0,0,0,0.12);
    --shadow-sm:  0 2px 12px rgba(0,0,0,0.08);
}

/* ── RESET ── */
*, *::before, *::after {
    box-sizing: border-box; margin: 0; padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body { height: 100%; }

body {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 14px; line-height: 1.6;
    color: var(--text-1);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-color: var(--bg);
    display: flex; justify-content: center; align-items: flex-start;
    min-height: 100vh;
    padding: 32px 20px 40px;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
}

/* Backdrop blur over background image */
body::before {
    content: '';
    position: fixed; inset: 0;
    background-color: var(--backdrop);
    backdrop-filter: blur(12px) saturate(180%);
    z-index: 0;
    transition: background-color 0.35s ease;
}

/* ── GLOBAL THEME TRANSITIONS ── */
*, *::before, *::after {
    transition-property: background-color, border-color, color, box-shadow;
    transition-duration: 0.28s;
    transition-timing-function: ease;
}
/* Exceptions */
.tool-section, .result-area, .drop-zone,
body::before { transition: unset; }
.tool-section {
    transition: opacity 0.4s ease-out, transform 0.4s ease-out,
                max-height 0.4s ease-out, padding 0.4s ease-out,
                margin 0.4s ease-out, box-shadow 0.4s ease-out !important;
}
.result-area { transition: opacity 0.25s ease, transform 0.25s ease !important; }

/* ============================================================
   THEME TOGGLE BUTTON (fixed position)
   ============================================================ */
.theme-toggle {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 999;
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-2);
    cursor: pointer; font-size: 0px; /* hide any text */
    display: flex; align-items: center; justify-content: center;
    box-shadow: var(--shadow-sm);
}
.theme-toggle:hover { border-color: var(--border-lit); color: var(--cyan); }
.theme-toggle.spin { animation: spin-once 0.4s ease; }
@keyframes spin-once {
    from { transform: rotate(0deg) scale(0.7); opacity: 0.3; }
    to   { transform: rotate(360deg) scale(1);  opacity: 1; }
}

/* ============================================================
   LAYOUT
   ============================================================ */
.main-container {
    position: relative; z-index: 1;
    width: 100%; max-width: 420px;
    display: flex; flex-direction: column; gap: 14px;
    padding-top: 8px;
}

/* ============================================================
   PROFILE CARD
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.banner {
    overflow: hidden;
    border-radius: 17px 17px 0 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}
.banner img {
    width: 100%; height: 130px; object-fit: cover; display: block;
    transition: transform 0.4s ease !important;
}
.card:hover .banner img { transform: scale(1.03); }

.profile-content {
    padding: 0 20px 22px;
    position: relative;
    margin-top: -44px;
}

.pfp-container {
    position: relative;
    width: 90px; height: 90px;
    display: inline-block;
}
.pfp {
    width: 90px; height: 90px; border-radius: 50%;
    object-fit: cover; display: block;
    border: 3px solid var(--bg-card);
    box-shadow: 0 0 0 1px var(--border-lit);
    position: relative; z-index: 1;
    transition: transform 0.3s ease !important;
}
.pfp:hover { transform: scale(1.05); }
.pfp-ring {
    position: absolute; inset: -3px; border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--cyan), var(--purple)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out; mask-composite: exclude;
    animation: ring-spin 6s linear infinite !important;
    transition: none !important;
}
@keyframes ring-spin { to { transform: rotate(360deg); } }

.profile-details { padding-top: 14px; }
.site-name {
    display: block;
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 1.35rem; font-weight: 800;
    letter-spacing: -0.03em; color: var(--text-1);
    line-height: 1.1;
}
.about-text {
    font-size: 13px; color: var(--text-2);
    margin-top: 5px; line-height: 1.55;
}

/* GitHub section */
.opensource-section {
    margin-top: 18px; padding-top: 16px;
    border-top: 1px solid var(--border);
}
.opensource-label {
    font-family: 'DM Mono', monospace;
    font-size: 0.65rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--text-3); margin-bottom: 8px;
    display: flex; align-items: center; gap: 8px;
}
.opensource-label::before {
    content: ''; display: block; width: 18px; height: 1px; background: var(--border);
}

.github-btn {
    text-decoration: none;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 14px; border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-raised);
    color: var(--text-1);
    font-size: 13px; font-weight: 600;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease !important;
}
.github-btn:hover {
    border-color: var(--border-lit);
    color: var(--cyan);
    background: rgba(0,229,189,0.06);
    transform: translateY(-2px);
}

/* Action buttons */
.actions {
    display: flex; gap: 10px; margin-top: 14px;
}
.actions button { flex: 1; }

/* ============================================================
   BUTTONS
   ============================================================ */
button {
    font-family: 'DM Sans', system-ui, sans-serif;
    font-size: 13px; font-weight: 600;
    color: var(--text-1);
    padding: 10px 14px; border-radius: 10px; cursor: pointer;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease !important;
}
button:hover {
    border-color: var(--border-lit);
    color: var(--cyan);
    background: rgba(0,229,189,0.06);
    transform: translateY(-2px);
}
button:active { transform: translateY(0); box-shadow: none; }

button.active {
    background: linear-gradient(135deg, var(--cyan), var(--cyan-d));
    color: #fff; border-color: transparent;
    box-shadow: 0 4px 16px rgba(0,229,189,0.3);
}
button.active:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,229,189,0.4); }

.btn-primary {
    background: linear-gradient(135deg, var(--cyan), var(--cyan-d));
    color: #fff !important; border-color: transparent;
    box-shadow: 0 4px 16px rgba(0,229,189,0.28);
}
.btn-primary:hover {
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,229,189,0.42);
    background: linear-gradient(135deg, var(--cyan), var(--cyan-d));
}

/* ============================================================
   TOOL SECTIONS
   ============================================================ */
.tool-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow);
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(-10px);
}
.tool-section.show {
    padding: 22px 20px;
    opacity: 1;
    max-height: 520px;
    pointer-events: auto;
    transform: translateY(0);
}

.tool-description {
    display: flex; align-items: center; gap: 6px;
    text-align: center; justify-content: center;
    font-size: 12px; color: var(--text-3);
    margin-bottom: 16px;
    font-family: 'DM Mono', monospace; letter-spacing: 0.02em;
}
.tool-description svg { color: var(--cyan); flex-shrink: 0; }

/* ── DROP ZONE ── */
.drop-zone {
    border: 1.5px dashed var(--border);
    border-radius: 12px; padding: 32px 20px;
    text-align: center; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.2s ease !important;
    background: var(--bg-raised);
}
.drop-zone:hover { border-color: var(--border-lit); transform: scale(1.01); }
.drop-zone:active { transform: scale(0.98); }
.drop-zone.dragover { border-color: var(--cyan); background: rgba(0,229,189,0.05); }

.drop-zone-icon {
    width: 60px; height: 60px; border-radius: 16px;
    background: rgba(0,229,189,0.08); border: 1px solid rgba(0,229,189,0.2);
    display: flex; align-items: center; justify-content: center;
    color: var(--cyan); margin-bottom: 4px;
}
.drop-zone-title { font-weight: 600; font-size: 14px; color: var(--text-1); }
.drop-zone-sub   { font-size: 12px; color: var(--text-3); font-family: 'DM Mono', monospace; }

/* ── INPUT GROUP (ShortURL) ── */
.input-group {
    display: flex; flex-direction: column; gap: 10px;
}

.input-wrap {
    position: relative; display: flex; align-items: center;
}
.input-wrap svg {
    position: absolute; left: 12px; color: var(--text-3); flex-shrink: 0;
    pointer-events: none;
}
.input-wrap input { padding-left: 34px; }

.input-group input {
    font-family: 'DM Sans', system-ui, sans-serif;
    background: var(--bg-raised);
    border: 1px solid var(--border); color: var(--text-1);
    padding: 10px 14px; border-radius: 10px;
    width: 100%; font-size: 13px; outline: none;
    transition: border-color 0.25s ease, background 0.25s ease !important;
}
.input-group input::placeholder { color: var(--text-3); }
.input-group input:focus {
    border-color: var(--border-lit);
    background: rgba(0,229,189,0.03);
    box-shadow: 0 0 0 3px rgba(0,229,189,0.08);
}

/* ── RESULT AREA ── */
.result-area {
    margin-top: 14px; min-height: 44px;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transform: translateY(8px);
}
.result-area.visible { opacity: 1; transform: translateY(0); }

.result-area-content {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--bg-raised); padding: 10px 14px;
    border-radius: 10px; border: 1px solid var(--border);
    width: 100%; cursor: pointer; position: relative; overflow: hidden;
    transition: border-color 0.25s ease !important;
}
.result-area-content:hover { border-color: var(--border-lit); }

.result-url {
    font-size: 12px; font-family: 'DM Mono', monospace;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--link); font-weight: 500; text-decoration: none;
    flex: 1;
}
.result-url:hover { text-decoration: underline; }

.result-area-content .copy-icon {
    width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3);
}

/* "Copied!" toast overlay */
.result-area-content::after {
    content: 'Copied!';
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: linear-gradient(135deg, var(--cyan), var(--cyan-d));
    color: #fff; padding: 4px 12px; border-radius: 6px;
    font-size: 11px; font-weight: 600; font-family: 'DM Mono', monospace;
    opacity: 0; pointer-events: none;
    transition: opacity 0.2s ease !important;
}
.result-area-content.copied::after { opacity: 1; }

/* ── LOADER ── */
.loader {
    width: 40px; aspect-ratio: 1;
    --c: no-repeat linear-gradient(var(--cyan) 0 0);
    background: var(--c), var(--c), var(--c);
    animation: l16-1 1s infinite, l16-2 1s infinite !important;
    transition: none !important;
}
@keyframes l16-1 { 0%,100% { background-size: 20% 100%; } 33%,66% { background-size: 20% 40%; } }
@keyframes l16-2 {
    0%,33%   { background-position: 0 0, 50% 100%, 100% 0; }
    66%,100% { background-position: 0 100%, 50% 0, 100% 100%; }
}

/* ── ERROR PAGE ── */
body.error-page {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh; padding: 20px;
}
.error-container {
    text-align: center; color: var(--text-1);
    background: var(--bg-card); padding: 32px 36px;
    border-radius: 18px; border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.error-container img { width: 90px; height: 90px; display: block; margin: 0 auto 16px; border-radius: 50%; }
.error-container span { font-family: 'Bricolage Grotesque', system-ui, sans-serif; font-size: 1.1rem; font-weight: 700; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 480px) {
    body { padding: 20px 14px 32px; }
    .main-container { gap: 12px; }
    .actions { gap: 8px; }
    button { font-size: 12px; padding: 9px 10px; }
    .site-name { font-size: 1.2rem; }
}
