:root {
      --bg: #1e1e1e;
      --bg2: #2a2a2a;
      --text: #f0f0f0;
      --muted: #aaaaaa;
      --accent: #f0f0f0;
      --nav-link: #e0e0e0;
      --border: #3a3a3a;
      --terminal-bg: #1a1a1a;
      --terminal-header: #2e2e2e;
      --term-green: #4ade80;
      --term-blue: #60a5fa;
      --term-text: #d4d4d4;
      --term-prompt: #4ade80;
      --btn-bg: #2a2a2a;
      --btn-text: #d4d4d4;
      --btn-hover: #3a3a3a;
      --btn-clear-bg: #b91c1c;
      --btn-clear-text: #fff;
      --card-bg: #252525;
      --section-title: #f0f0f0;
    }

    .light {
      --bg: #f5f5f5;
      --bg2: #ebebeb;
      --text: #1a1a1a;
      --muted: #555555;
      --accent: #1a1a1a;
      --nav-link: #333333;
      --border: #cccccc;
      --terminal-bg: #1a1a1a;
      --terminal-header: #2e2e2e;
      --term-green: #4ade80;
      --term-blue: #60a5fa;
      --term-text: #d4d4d4;
      --term-prompt: #4ade80;
      --btn-bg: #2a2a2a;
      --btn-text: #d4d4d4;
      --btn-hover: #3a3a3a;
      --btn-clear-bg: #b91c1c;
      --btn-clear-text: #fff;
      --card-bg: #e8e8e8;
      --section-title: #1a1a1a;
    }

    * { margin: 0; padding: 0; box-sizing: border-box; }

    html { scroll-behavior: smooth; }

    body {
      background: var(--bg);
      color: var(--text);
      font-family: 'Jersey 25', 'JetBrains Mono', monospace;
      transition: background 0.3s, color 0.3s;
      min-height: 100vh;
    }

    /* ─── CONTAINER ─── */
    .container {
      max-width: 900px;
      margin: 0 auto;
      width: 100%;
      padding: 0 2rem;
    }

    /* ─── NAVBAR ─── */
    nav {
      position: sticky;
      top: 0;
      z-index: 100;
      background: var(--bg);
      transition: background 0.3s;
    }

    .nav-inner {
      max-width: 900px;
      margin: 0 auto;
      padding: 1.2rem 2rem;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
    }

    .nav-controls {
      display: flex;
      align-items: center;
      gap: 0.8rem;
      justify-self: end;
    }

    .nav-section-indicator {
      justify-self: center;
      position: relative;
    }

    .nav-logo {
      font-size: 2rem;
      font-weight: 700;
      color: var(--text);
      text-decoration: none;
      letter-spacing: -0.5px;
    }

    .lang-btn {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text);
      cursor: pointer;
      padding: 0.3rem 0.6rem;
      border-radius: 6px;
      font-family: 'Jersey 25', monospace;
      font-size: 0.9rem;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s, border-color 0.2s;
    }

    /* Indicator */
    .nav-section-indicator {
      position: relative;
    }

    .nav-current {
      background: none;
      border: none;
      color: var(--text);
      font-family: 'Jersey 25', monospace;
      font-size: 1.4rem;
      cursor: pointer;
      padding: 0.2rem 0.4rem;
      border-radius: 4px;
      transition: background 0.2s;
      white-space: nowrap;
    }

    .nav-current:hover {
      background: var(--bg2);
    }

    .nav-dropdown {
      display: none;
      position: absolute;
      right: 0;
      top: calc(100% + 0.5rem);
      background: var(--bg2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.5rem 0;
      list-style: none;
      min-width: 160px;
      box-shadow: 0 8px 24px rgba(0,0,0,0.3);
      z-index: 200;
    }

    .nav-dropdown.open {
      display: block;
    }

    .nav-dropdown li a {
      display: block;
      padding: 0.45rem 1rem;
      color: var(--text);
      text-decoration: none;
      font-family: 'Jersey 25', monospace;
      font-size: 1.2rem;
      transition: background 0.15s, color 0.15s;
      white-space: nowrap;
    }

    .nav-dropdown li a:hover {
      background: var(--border);
    }

    .nav-arrow {
      font-size: 1rem; 
      vertical-align: middle;
    }

    /* Hamburger */
    .hamburger {
      display: none;
      flex-direction: column;
      gap: 5px;
      cursor: pointer;
      background: transparent;
      border: none;
      padding: 4px;
      align-items: center;
    }

    .hamburger span {
      display: block;
      width: 22px;
      height: 2px;
      min-height: 2px;
      background: var(--text);
      border-radius: 2px;
      transition: 0.3s;
      flex-shrink: 0;
    }

    @media (max-width: 768px) {

      .nav-inner {
          grid-template-columns: auto 1fr;
        }

        .nav-controls {
          justify-self: end;
        }

      .hamburger { display: flex; }

      .nav-section-indicator { display: none; }
      
      /* mobile: dropdown pelo hamburger */
      .nav-links-mobile {
        display: none;
        flex-direction: column;
        gap: 1rem;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        padding: 1.5rem;
        border-bottom: 1px solid var(--border);
        z-index: 100;
      }

      .nav-links-mobile.open { display: flex; }

      .nav-links-mobile a {
        color: var(--nav-link);
        text-decoration: none;
        font-size: 1.5rem;
        font-family: 'Jersey 25', monospace;
      }

      .hero-content {
        text-align: center;
        align-items: center;
        width: 100%;
      }

      .hero-title {
        text-align: center;
        justify-content: center;
      }

      .hero-subtitle {
        margin-left: 0;
        text-align: center;
        width: 100%;
      }

    }
    /* ─── HERO ─── */
    #home {
      min-height: 55vh;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 4rem 0 2rem;
    }

    #home .container {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4rem;
    }

    .hero-content {
      flex: 1;
    }

    .hero-title {
      font-size: clamp(2rem, 5vw, 4.2rem);
      font-weight: 700;
      color: var(--text);
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.6rem;
      line-height: 1.1;
    }

    .hero-title .caret {
      color: var(--text);
      font-weight: 400;
    }

    .hero-subtitle {
      color: var(--muted);
      font-size: 1.2rem;
      font-style: italic;
      margin-left: 2.2rem;
    }

    .hero-avatar {
      flex-shrink: 0;
    }

    .avatar-wrapper {
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .avatar-circle {
      width: 270px;
      height: 270px;
      border-radius: 50%;
      background: #d8d8d8;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
    }

    .avatar-circle svg {
      display: block;
    }

    .avatar-placeholder {
      width: 70%;
      height: 70%;
      background: #ececec;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    /* ─── TERMINAL ─── */
    #about {
      padding: 2rem 0 4rem;
    }

    .terminal-window {
      background: var(--terminal-bg);
      border-radius: 10px;
      overflow: hidden;
      max-width: 700px;
      box-shadow: 0 8px 32px rgba(0,0,0,0.5);
      margin: 0 auto;
    }

    .terminal-header {
      background: var(--terminal-header);
      padding: 0.5rem 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .terminal-title {
      color: #888;
      font-size: 0.75rem;
      font-family: 'JetBrains Mono', monospace;
      margin: 0;
    }


    .terminal-body {
      padding: 1rem 1.2rem;
      min-height: 180px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.82rem;
      line-height: 1.6;
    }

    .term-line {
      margin-bottom: 0.3rem;
    }

    .term-cmd {
      color: var(--term-green);
    }

    .term-output {
      color: var(--term-text);
      margin-left: 0;
      margin-bottom: 0.6rem;
    }

    .term-cursor {
      display: inline-block;
      width: 8px;
      height: 14px;
      background: var(--term-green);
      animation: blink 1s step-end infinite;
      vertical-align: middle;
    }

    .win-controls {
      display: flex;
      align-items: center;
      gap: 0;
    }
    @keyframes blink {
      50% { opacity: 0; }
    }

    .terminal-buttons {
      display: flex;
      gap: 0;
      border-top: 1px solid #333;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none; /* esconde scrollbar no Firefox */
    }

    .terminal-buttons::-webkit-scrollbar {
      display: none; /* esconde scrollbar no Chrome/Safari */
    }

    .term-btn {
      flex-shrink: 0;
      flex: 1;
      padding: 0.55rem 0.5rem;
      background: var(--btn-bg);
      color: var(--btn-text);
      border: none;
      border-right: 1px solid #333;
      cursor: pointer;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.72rem;
      transition: background 0.2s;
      white-space: nowrap;
    }

    .term-btn:last-child {
      border-right: none;
      background: var(--btn-clear-bg);
      color: var(--btn-clear-text);
    }

    .term-btn:hover:not(:last-child) {
      background: var(--btn-hover);
    }

    .term-btn:last-child:hover {
      background: #991b1b;
    }

    .win-btn {
      color: #888;
      font-size: 0.75rem;
      width: 2rem;
      height: 2rem;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
      user-select: none;
      background: none;
      border: none;
      font-family: 'JetBrains Mono', monospace;
    }

    .win-btn:hover {
      background: #444;
      color: #fff;
    }

    .win-close:hover {
      background: #c42b1c;
      color: #fff;
    } 

    .term-input::placeholder {
      color: #444;
    }

    /* ─── PROJECTS ─── */
    #projects {
      padding: 4rem 0;
    }

    .section-title {
      font-size: 1.7rem;
      font-weight: 700;
      color: var(--section-title);
      margin-bottom: 2rem;
    }

    .section-title .caret { font-weight: 400; }

    .projects-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
      gap: 1.5rem;
    }

    .project-card {
      background: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 1.1rem;
      transition: border-color 0.2s, transform 0.2s;
    }

    .project-card:hover {
      border-color: #666;
      transform: translateY(-2px);
    }

    .project-card h3 {
      font-size: 1.1rem;
      margin-bottom: 0.5rem;
      color: var(--text);
      font-family: 'JetBrains Mono', monospace;
    }

    .project-card p {
      color: var(--muted);
      font-size: 1rem;
      line-height: 1.5;
    }

    .project-tags {
      display: flex;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-top: 0.8rem;
    }

    .tag {
      background: var(--bg2);
      border: 1px solid var(--border);
      color: var(--muted);
      font-size: 0.9rem;
      padding: 0.2rem 0.5rem;
      border-radius: 4px;
    }

    /* ─── CONTACT ─── */
    #contact {
      padding: 4rem 0;
      border-top: 1px solid var(--border);
    }

    .contact-form-wrap {
      max-width: 560px;
      margin: 0 auto; 
      margin-bottom: 2.5rem;
    }

    .contact-form-box {
      background: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: 10px;
      padding: 1.8rem 2rem;
    }

    .form-field {
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
      margin-bottom: 1.1rem;
    }

    .form-field--msg { margin-bottom: 1.4rem; }

    .form-label {
      font-family: 'Jersey 25', monospace;
      font-size: 1.2rem;
      color: var(--term-green);
      letter-spacing: 0.5px;
    }

    .form-input {
      background: var(--bg);
      border: 1px solid var(--border);
      border-radius: 6px;
      color: var(--text);
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.80rem;
      padding: 0.55rem 0.8rem;
      outline: none;
      transition: border-color 0.2s, box-shadow 0.2s;
      resize: none;
    }

    .form-input::placeholder { color: var(--muted); opacity: 0.6; }

    .form-input:focus {
      border-color: #555;
      box-shadow: 0 0 0 2px rgba(255,255,255,0.05);
    }

    .form-textarea { min-height: 100px; }

    .form-actions {
      display: flex;
      align-items: center;
      gap: 1rem;
    }

    .form-submit {
      background: var(--text);
      color: var(--bg);
      border: none;
      border-radius: 6px;
      padding: 0.6rem 1.3rem;
      font-family: 'Jersey 25', monospace;
      font-size: 1.2rem;
      cursor: pointer;
      transition: opacity 0.2s, transform 0.1s;
    }

    .form-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    }


    .form-submit:hover { opacity: 0.85; }
    .form-submit:active { transform: scale(0.97); }

    .form-status {
      display: block;
      text-align: center;
      font-size: 0.8rem;
      color: var(--term-green);
      font-family: 'JetBrains Mono', monospace;
      opacity: 0;
      transition: opacity 0.4s;
      margin-top: 0.5rem;
    }

    .form-input:-webkit-autofill,
    .form-input:-webkit-autofill:hover,
    .form-input:-webkit-autofill:focus {
      -webkit-box-shadow: 0 0 0px 1000px var(--bg) inset;
      -webkit-text-fill-color: var(--text);
      transition: background-color 5000s ease-in-out 0s;
    }

    .form-status.visible { opacity: 1; }

    /* Social links */
    .social-links {
      display: flex;
      gap: 1rem;
      justify-content: center;
    }

    .social-link {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      background: var(--card-bg);
      border: 1px solid var(--border);
      color: var(--text);
      text-decoration: none;
      padding: 0.65rem 1.2rem;
      border-radius: 8px;
      font-family: 'Jersey 25', monospace;
      font-size: 1rem;
      transition: background 0.2s, border-color 0.2s, transform 0.15s;
    }

    .social-link:hover {
      background: var(--bg2);
      border-color: #666;
      transform: translateY(-2px);
    }

    /* ─── FOOTER ─── */
    footer {
      padding: 2rem 0;
      border-top: 1px solid var(--border);
      color: var(--muted);
      font-size: 0.90rem;
      text-align: center;
    }

    /* Esconde por defeito em desktop */
    .nav-links-mobile {
      display: none;
    }

    /* ─── RESPONSIVE ─── */
    @media (max-width: 768px) {

      .hero-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        width: 100%;
      }

      .hero-subtitle {
        margin-left: 0;
        text-align: center;
        width: 100%;
      }

      .nav-links {
        display: none;
        flex-direction: column;
        gap: 1rem;
        position: relative;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg);
        padding: 1.5rem;
        border-bottom: 1px solid var(--border);
      }

      .nav-links.open { display: flex; }

      .hamburger { display: flex; }

      #home {
        padding: 3rem 0 2rem;
      }

      #home .container {
        flex-direction: column-reverse;
        align-items: center;
        gap: 2rem;
      }

      .hero-avatar { margin-left: 0; }

      .avatar-circle { width: 180px; height: 180px; }

      .container { padding: 0 1.5rem; }

      #about, #projects, #contact {
        padding: 2.5rem 0;
      }

      .terminal-window { max-width: 100%; }

      .term-btn { font-size: 0.65rem; padding: 0.5rem 0.3rem; }
    }

    @media (max-width: 480px) {
      .hero-title { font-size: 1.8rem; }
      .projects-grid { grid-template-columns: 1fr; }
    }

    /* ─── BOOT SCREEN ─── */
    #boot-screen {
      position: fixed;
      inset: 0;
      background: #000;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 2rem;
      z-index: 9999;
    }

    .boot-container {
      width: 100%;
      max-width: 700px;
      display: flex;
      flex-direction: column;
    }

    .boot-bar {
      height: 4px;
      background: var(--term-green);
      width: 0%;
      margin-bottom: 1.5rem;
      transition: width 0.4s ease;
    }

    #boot-lines {
      font-family: 'JetBrains Mono', monospace;
      font-size: clamp(0.75rem, 2vw, 0.9rem);
      line-height: 1.6;
    }

    .boot-ok {
      color: var(--term-green);
      font-weight: 600;
    }

    .boot-text {
      color: #ffffff; 
    }

    /* ─── TERMINAL INPUT MOBILE ─── */
    /* Adiciona isto ao fim do style.css */
    .term-mobile-row {
      display: none;
      align-items: center;
      padding: 0 1.2rem 1rem 0; /* alinha com o texto do terminal */
      background: var(--terminal-bg);
      gap: 0.4rem;
    }
    .term-mobile-prefix {
      color: var(--term-green);
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.82rem;
      white-space: nowrap;
    }
    #termMobileInput {
      flex: 1;
      background: transparent;
      border: none;
      border-bottom: 1px solid #333;
      outline: none;
      color: var(--term-text);
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.82rem;
      padding: 0.2rem 0.3rem;
      caret-color: var(--term-green);
    }
    #termMobileInput::placeholder { color: #444; font-size: 0.82rem; }
    #termMobileSubmit {
      background: none;
      border: none;
      color: var(--term-green);
      font-family: 'JetBrains Mono', monospace;
      font-size: 1rem;
      padding: 0.2rem 0.4rem;
      cursor: pointer;
      opacity: 0.7;
    }
    @media (hover: none) and (pointer: coarse) {
      .term-mobile-row { display: flex; }
      #termCursorLine { display: none; }
    }