/*
 * Aquest programa és programari lliure: pots redistribuir-lo i/o modificar-lo
 * sota els termes de la GNU General Public License (GPLv3).
*/

/* --- Variables & Dark Mode --- */
:root {
    --bg: #FAF9F5;  
    --font-serif: 'Cormorant Garamond', 'Garamond', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;  
    --text-main: #1A1C20; 
    --text-muted: #8B949E;
    --border: #E0D8D0;
    --card-hover: #EFE8E0;
    --accent: #000000;
    --bento-bg: #F4EFEA; 
    --bento-border: rgba(0,0,0,0.04);
    --toggle-bg: #E5E5E5;
    --shadow: rgba(0, 0, 0, 0.08);
    --connect-link-color: #000000;
    --selection-bg: #171717;
    --selection-text: #FAFAF9;
    --status-bg: #FAF9F5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1A1816; 
        --text-main: #EFE8E0;
        --text-muted: #A39D98;
        --border: #332F2A;
        --card-hover: #2A2622;
        --accent: #EFE8E0;
        --bento-bg: #221F1C;
        --bento-border: rgba(255, 255, 255, 0.03);
        --toggle-bg: #332F2A;
        --shadow: rgba(0, 0, 0, 0.6);
        --connect-link-color: #EFE8E0;
        --selection-bg: #EFE8E0;
        --selection-text: #1A1816;
        --status-bg: #1A1816;
    }
    .avatar {
        content: url('logo.png');
    }
    body.dark-mode .avatar,
    body:has(.theme-toggle-btn:checked) .avatar {
    content: url('logo.png'); }
}
body.dark-mode,
body:has(.theme-toggle-btn:checked) {
        --bg: #1A1816; 
        --text-main: #EFE8E0;
        --text-muted: #A39D98;
        --border: #332F2A;
        --card-hover: #2A2622;
        --accent: #EFE8E0;
        --bento-bg: #221F1C;
        --bento-border: rgba(255, 255, 255, 0.03);
        --toggle-bg: #332F2A;
        --shadow: rgba(0, 0, 0, 0.6);
        --connect-link-color: #EFE8E0;
        --selection-bg: #EFE8E0;
        --selection-text: #1A1816;
        --status-bg: #1A1816;
    .avatar {
        content: url('logo.png');
    }
}

/* --- Base & Typo --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }
::selection { background: var(--selection-bg); color: var(--selection-text); }

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: var(--font-serif); 
    line-height: 1.7; 
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
h1 {
    font-family: var(--font-serif); 
    font-size: 2.2rem; 
    font-weight: 600; 
    line-height: 1.1;
    margin-bottom: 8px;
    letter-spacing: -0.04em; 
}
p { 
    margin-bottom: 16px;
    font-size: 1.2rem; 
    color: var(--text-main);
    opacity: 0.9;
    max-width: 65ch; 
}
.highlight { 
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
    color: var(--text-main);
}

/* --- Toggle LightDark --- */
.theme-toggle-btn {
    --size: 20px;
    position: fixed;
    top: 24px; right: 24px;
    border: none;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    font-size: 18px;
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease;
    box-shadow: inset calc(var(--size) * 0.33) calc(var(--size) * -0.25) 0;
    appearance: none;
}
.theme-toggle-btn:checked {
  --ray-size: calc(var(--size) * -0.4);
  --offset-orthogonal: calc(var(--size) * 0.65);
  --offset-diagonal: calc(var(--size) * 0.45);
  transform: scale(0.75);
  color: hsl(40, 100%, 50%);
  box-shadow: 
    inset 0 0 0 var(--size),
    calc(var(--offset-orthogonal) * -1) 0 0 var(--ray-size),
    var(--offset-orthogonal) 0 0 var(--ray-size),
    0 calc(var(--offset-orthogonal) * -1) 0 var(--ray-size),
    0 var(--offset-orthogonal) 0 var(--ray-size),
    calc(var(--offset-diagonal) * -1) calc(var(--offset-diagonal) * -1) 0 var(--ray-size),
    var(--offset-diagonal) var(--offset-diagonal) 0 var(--ray-size),
    calc(var(--offset-diagonal) * -1) var(--offset-diagonal) 0 var(--ray-size),
    var(--offset-diagonal) calc(var(--offset-diagonal) * -1) 0 var(--ray-size);
}
.theme-toggle-btn:hover { transform: rotate(15deg) scale(1.1); }

/* --- Sections --- */
.wrapper {
    max-width: 700px;
    margin: 0 auto;
    padding: 80px 24px;
    display: flex;
    flex-direction: column;
    gap: 60px;
}

/* --- Profile --- */
.profile-section {
    position: relative;
    top: 0;
    text-align: left;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 20px;
}

.avatar-container {
    width: 60px;
    height: 60px;
    flex-shrink: 0;
    display: block;
}

.avatar {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    border-radius: 12px;
    box-shadow: 0 10px 30px -10px rgba(0,0,0,0.1);
    transition: transform 0.1s ease-out, box-shadow 0.4s ease;
}

.profile-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.profile-section h1 {
    font-size: 2rem;
    margin-bottom: 2px;
}

.avatar-description {
    font-family: monospace, sans-serif;
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 0;
}

/* --- Contact --- */
.contact-button {
    font-family: monospace, sans-serif;
    font-size: 13px;
    background: var(--bento-bg);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 6px;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-variant-numeric: tabular-nums;
    cursor: default;
    min-width: 180px;
    justify-content: center;
    box-shadow: 0 2px 5px var(--shadow);
}
.contact-toggle {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.5ch;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.3s;
}
.contact-toggle:hover {
  color: var(--connect-link-color);
}
.contact-toggle input {
  display: none; 
}
.contact-toggle span {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  margin-left: 0;
  font-weight: normal;
  font-family: monospace, sans-serif;
  color: var(--text-main);
  transition: all 0.4s ease-in-out;
}
.contact-toggle input:checked ~ span {
  max-width: 300px;
  opacity: 1;
  margin-left: 10px;
}

/* --- Social & Comment--- */
.social-links {
    display: flex;
    gap: 20px;
    justify-content: center;
}
.social-links a {
    color: var(--text-main);
    font-size: 20px;
    transition: transform 0.3s, color 0.3s;
}
.social-links a:hover { 
    transform: translateY(-4px); 
    color: var(--text-muted); 
}

/* --- Content --- */
.section-header {
    font-family: var(--font-mono); 
    font-size: 12px; 
    font-weight: 500; 
    text-transform: uppercase;
    letter-spacing: 0.15em; 
    color: var(--text-muted); 
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.section-header::after {
    content: "";
    height: 1px;
    flex-grow: 1;
    background: var(--border);
}
.block {
    margin-bottom: 60px;
}

/* --- Box --- */
.box-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.box {
    background: var(--bento-bg);
    border: 1px solid var(--bento-border);
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px var(--shadow);
    display: flex;
    flex-direction: column;
}
.box:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -6px var(--shadow);
    border-color: var(--border);
    z-index: 2;
}
.box-header {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
    z-index: 5;
}
.box-content {
    padding: 0 8px 60px 16px;
    flex-grow: 1;
    z-index: 5;
}

.box-content p {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 0.9rem;
    color: var(--accent);
    margin: 0;
    line-height: 1.5;
    opacity: 0.58;
    max-width: none;
}
.box-esq {
    grid-column: 1 / 2;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}
.box-dreta {
    grid-column: 2 / 3;
    min-height: 180px;
    padding: 0;
    position: relative;
    overflow: hidden;
    display: block; 
}
.box-tot {
    grid-column: 1 / 3;
    min-height: 200px;
    display: flex;
    flex-direction: column;
}
.box-link {
    position: absolute; inset: 0; z-index: 10;
}

/* --- Project Status --- */
.status {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    height: 44px;
    background: var(--status-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--bento-border);
    border-radius: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}
.status-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.1;
}
.status-header {
    font-family: monospace, sans-serif;
    font-weight: 700;
    font-size: 13px;
    color: var(--text-main);
}
.status-description {
    font-size: 10px;
    color: var(--text-muted);
    font-family: 'Inter', monospace;
    opacity: 0.8;
}
.status-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0,0,0,0.05);
    padding: 4px 8px;
    border-radius: 4px;
}
.badge-description {
    font-family: monospace, sans-serif;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
}
.pulsing-dot-true {
    width: 6px;
    height: 6px;
    background-color: #10b981;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.pulsing-dot-false {
    width: 6px;
    height: 6px;
    background-color: #b91610;
    border-radius: 50%;
    animation: pulse-red 2s infinite;
}
@keyframes pulse-red {
    0% { box-shadow: 0 0 0 0 rgba(185, 22, 16, 0.7); }
    70% { box-shadow: 0 0 0 4px rgba(185, 22, 16, 0); }
    100% { box-shadow: 0 0 0 0 rgba(185, 22, 16, 0); }
}
.pulsing-dot-standby {
    width: 6px;
    height: 6px;
    background-color: #f3c034;
    border-radius: 50%;
    animation: pulse-yellow 2s infinite;
}
@keyframes pulse-yellow {
    0% { box-shadow: 0 0 0 0 rgba(243, 192, 52, 0.7); }
    70% { box-shadow: 0 0 0 4px rgba(243, 192, 52, 0); }
    100% { box-shadow: 0 0 0 0 rgba(243, 192, 52, 0); }
}

/* --- Discreet Link --- */
.discreet-link {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease;
    opacity: 0.8;
}

.discreet-link:hover {
    color: var(--text-main);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 4px;
    opacity: 1;
}

/* --- Footer --- */
.footer {
    margin-top: 80px;
    color: var(--text-muted);
    font-size: 13px;
    font-family: monospace, sans-serif;
    opacity: 0.6;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 20px;
    margin-top: 10px;
}

/* --- Language Selector --- */
.lang-selector {
    position: fixed;
    top: 28px; /* Alineado verticalmente con el botón de tema */
    left: 24px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono); /* Usamos tu tipografía técnica */
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.05em;
    z-index: 1000;
}

.lang-selector a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s ease, transform 0.2s ease;
    padding: 2px 4px; /* Área de clic un poco más grande */
}

.lang-selector a:hover {
    color: var(--text-main);
    transform: translateY(-1px); /* Pequeño salto al pasar el ratón */
}

/* Estilo para el idioma que estás viendo actualmente */
.lang-selector a.active {
    color: var(--text-main);
    font-weight: 600;
    cursor: default;
    pointer-events: none; /* Evita que el usuario haga clic en el idioma en el que ya está */
}

.lang-selector .separator {
    color: var(--border); /* Se funde sutilmente con el fondo */
    font-size: 11px;
    user-select: none; /* Evita que se pueda seleccionar el texto de la barra '/' */
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .wrapper { grid-template-columns: 1fr; gap: 50px; padding: 60px 20px; }
    .social-links { justify-content: center; }
    .timeline-item { flex-direction: column; }
    .tl-right { text-align: left; padding-left: 0; margin-top: 6px; }
    .theme-toggle-btn { 
        top: 24px;
        right: 20px; 
        transform: scale(1.2);
        position: absolute; 
    }
    .theme-toggle-btn:hover { 
        transform: scale(1.2) rotate(15deg); 
    }
    .footer { text-align: center; margin-bottom: 40px; }
    .box-grid { 
        grid-template-columns: 1fr;
    }
    .box-esq, .box-dreta, .box-tot { 
        grid-column: 1 / -1;
        height: auto;
        min-height: 180px;
    }
    .profile-section { text-align: left; }
    .profile-header { 
        flex-direction: row;
        text-align: left; 
        gap: 16px; 
    }
    .avatar-container { 
        width: 60px;
        height: 60px; 
        margin: 0; 
    }
    .profile-text { align-items: flex-start; }

    .lang-selector { 
        top: 24px; 
        left: 20px;
        position: absolute; 
    }
}