/* Calculator Display */
#calc-container {
    width: 100%;
    max-width: 360px;
    justify-self: end;
}

.calculator-body {
    background: rgba(36, 199, 199, 0.08);
    border: 1px solid rgba(36, 199, 199, 0.5);
    border-radius: 16px;
    padding: 1.25rem;
    position: relative;
}

.calculator-body::before {
    content: none;
}

#calc-screen {
    background: #2a394f;
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 1rem;
    height: 26vh;
    position: relative;
}

#calc-screen::after {
    content: none;
}

.calc-screen-content {
    background: transparent;
    padding: 0;
    width: 100%;
    height: 100%;
    font-size: 0.95rem;
    line-height: 1.3;
    font-family: 'Share Tech Mono', monospace;
    overflow-y: auto;
    overflow-x: hidden;
}

.calc-line {
    color: #dbeafe;
    margin: 0.3rem 0;
    font-weight: 600;
}

.calc-line.highlight {
    background: rgba(34, 211, 238, 0.16);
    padding: 0.1rem 0.3rem;
    margin: 0.2rem -0.3rem;
    border-radius: 4px;
}

.cursor {
    display: inline-block;
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

.calc-keypad {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0.1rem;
    border-radius: 16px;
    padding: 1rem;
    padding-top: 0.85rem;
    background: rgba(36, 199, 199, 0.08);
    border: 1px solid rgba(36, 199, 199, 0.35);
}

.calc-nav-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.4rem;
    width: 100%;
}

.calc-main-grid-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 0 1.4rem;
    margin: 0 1rem;
}

.calc-main-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(6, 60px);
    gap: 0.4rem;
    width: fit-content;
    margin:0 0.5rem;
}

.calc-key {
    aspect-ratio: 1;
    height:88%;
    background: #1f2937;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(2, 6, 23, 0.4);
    transition: all 0.15s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: #e8e8e8;
    font-weight: 700;
    position: relative;
}

.calc-key::before {
    content: none;
}

.calc-key:hover {
    background: #273244;
    transform: translateY(-1px);
    border-color: rgba(34, 211, 238, 0.4);
}

.calc-key:focus-visible {
    outline: 2px solid rgba(34, 211, 238, 0.8);
    outline-offset: 2px;
    border-color: rgba(34, 211, 238, 0.6);
}

.calc-key:active,
.calc-key.pressed {
    transform: translateY(2px);
    box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.6);
}

/* Arrow pad container - single large circular button */
.arrow-pad-container {
    grid-column: 2 / 5;
    grid-row: 1 / 3;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.arrow-pad {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: #1f2937;
    border: 1px solid rgba(148, 163, 184, 0.25);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.12);
}

/* Inner circle decoration */
.arrow-pad::before {
    content: '';
    position: absolute;
    width: 50%;
    height: 50%;
    background: radial-gradient(circle, rgba(148, 163, 184, 0.16), transparent 70%);
    border-radius: 50%;
}

/* Individual arrow buttons inside the pad */
.arrow-pad .calc-key.arrow {
    position: absolute;
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: #e2e8f0;
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: -0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.arrow-pad .calc-key.arrow::before {
    content: '';
    position: absolute;
    inset: 10%;
    background: rgba(148, 163, 184, 0.12);
    border-radius: 20px;
    z-index: -1;
    pointer-events: none;
}

.arrow-pad .calc-key.arrow:hover {
    color: var(--calc-accent);
    transform: scale(1.15);
}

.arrow-pad .calc-key.arrow:active,
.arrow-pad .calc-key.arrow.pressed {
    color: var(--calc-accent);
    transform: scale(0.95);
}

/* Position arrows around the circle */
.arrow-pad .calc-key.arrow[data-key="up"] {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.arrow-pad .calc-key.arrow[data-key="down"] {
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
}

.arrow-pad .calc-key.arrow[data-key="left"] {
    left: 5%;
    top: 50%;
    transform: translateY(-50%);
}

.arrow-pad .calc-key.arrow[data-key="right"] {
    right: 5%;
    top: 50%;
    transform: translateY(-50%);
}

/* Menu buttons - blue theme */
.calc-key.menu-btn {
    background: #1f2937;
    border-color: rgba(148, 163, 184, 0.3);
    font-size: 0.7rem;
    padding: 0.4rem;
    aspect-ratio: auto;
    border-radius: 6px;
    color: #fff;
}

.calc-key.menu-btn::before {
    content: none;
}

.calc-key.menu-btn:hover {
    background: #273244;
    border-color: rgba(34, 211, 238, 0.45);
}

.calc-key.menu-btn.active {
    background: rgba(34, 211, 238, 0.18);
    border-color: rgba(34, 211, 238, 0.6);
    color: var(--calc-accent);
}

/* Enter key - bright cyan/blue */
.calc-key.enter {
    background: var(--calc-accent);
    border-color: rgba(34, 211, 238, 0.6);
    color: #041219;
    font-weight: 800;
}

/* ON key - dark red */
.calc-key.on {
    background: #b91c1c;
    border-color: rgba(239, 68, 68, 0.6);
    color: #fff;
}

/* Operators - lighter gray */
.calc-key.operator {
    background: #334155;
    border-color: rgba(148, 163, 184, 0.35);
    font-size: 1.1rem;
    color: #e2e8f0;
}

/* Function keys - very dark, almost black */
.calc-key.function {
    background: #0f172a;
    border-color: rgba(148, 163, 184, 0.2);
    font-size: 0.65rem;
    color: #cbd5e1;
}

/* Main grid positioning - Function keys */
.calc-main-grid > .calc-key:nth-child(1) { grid-column: 1; grid-row: 2; } /* LOG */
.calc-main-grid > .calc-key:nth-child(2) { grid-column: 1; grid-row: 3; } /* SIN */
.calc-main-grid > .calc-key:nth-child(3) { grid-column: 1; grid-row: 4; } /* COS */
.calc-main-grid > .calc-key:nth-child(4) { grid-column: 1; grid-row: 5; } /* TAN */

/* Arrow pad is child 5 (div container, not .calc-key) */

/* Number pad - shifted down one row to be inline with ON and ENTER */
.calc-main-grid > .calc-key:nth-child(6) { grid-column: 2; grid-row: 3; }  /* 7 */
.calc-main-grid > .calc-key:nth-child(7) { grid-column: 3; grid-row: 3; } /* 8 */
.calc-main-grid > .calc-key:nth-child(8) { grid-column: 4; grid-row: 3; } /* 9 */
.calc-main-grid > .calc-key:nth-child(9) { grid-column: 2; grid-row: 4; } /* 4 */
.calc-main-grid > .calc-key:nth-child(10) { grid-column: 3; grid-row: 4; } /* 5 */
.calc-main-grid > .calc-key:nth-child(11) { grid-column: 4; grid-row: 4; } /* 6 */
.calc-main-grid > .calc-key:nth-child(12) { grid-column: 2; grid-row: 5; } /* 1 */
.calc-main-grid > .calc-key:nth-child(13) { grid-column: 3; grid-row: 5; } /* 2 */
.calc-main-grid > .calc-key:nth-child(14) { grid-column: 4; grid-row: 5; } /* 3 */
.calc-main-grid > .calc-key:nth-child(15) { grid-column: 2; grid-row: 6; } /* 0 */
.calc-main-grid > .calc-key:nth-child(16) { grid-column: 3; grid-row: 6; } /* . */
.calc-main-grid > .calc-key:nth-child(17) { grid-column: 4; grid-row: 6; } /* (-) */

/* Operators (right side) - aligned with number pad */
.calc-main-grid > .calc-key:nth-child(18) { grid-column: 5; grid-row: 3; } /* + */
.calc-main-grid > .calc-key:nth-child(19) { grid-column: 5; grid-row: 4; } /* - */
.calc-main-grid > .calc-key:nth-child(20) { grid-column: 5; grid-row: 5; } /* * */
.calc-main-grid > .calc-key:nth-child(21) { grid-column: 5; grid-row: 2; } /* / */

/* Special keys */
.calc-main-grid > .calc-key:nth-child(22) { grid-column: 1; grid-row: 6; } /* ON */
.calc-main-grid > .calc-key:nth-child(23) { grid-column: 5; grid-row: 6; } /* ENTER */

.home-hero {
    padding: 2.5rem;
}

.hero-shell {
    display: grid;
    grid-template-columns: 1fr 0.45fr;
    gap: 4rem;
    align-items: start;
    max-width: 1000px;
    margin: 0 auto;
}

.hero-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 16px;
    background: rgba(36, 199, 199, 0.05);
    border: 1px solid rgba(36, 199, 199, 0.18);
}

.hero-brand img {
    width: 112px;
    height: 112px;
    border-radius: 12px;
}

.hero-copy {
    width:100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.hero-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.28em;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: inherit;
    margin: 0;
}

.hero-subtitle {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 36ch;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.cta-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    background: var(--calc-accent);
    color: #041219;
    font-weight: 600;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.cta-primary:hover {
    transform: translateY(-1px);
    opacity: 0.9;
}

.cta-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.65rem 1.3rem;
    border-radius: 999px;
    border: 1px solid var(--panel-border);
    color: var(--text-primary);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.cta-ghost:hover {
    border-color: rgba(36, 199, 199, 0.5);
    transform: translateY(-1px);
}

.hero-stats {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.hero-stat {
    padding: 0.45rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.hero-stat strong {
    color: var(--text-primary);
}

.hero-about {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.45rem 0.8rem;
    color: var(--text-secondary);
    max-width: 60ch;
}

.hero-about h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.hero-about p {
    margin: 0;
}

.home-featured {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
}

.section-head h3 {
    margin: 0;
}

.section-head p {
    margin: 0;
    color: var(--text-secondary);
    max-width: 42ch;
}

.featured-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
}

.featured-item {
    display: block;
    padding: 1.25rem;
    background: var(--surface-elevated);
    border: 1px solid var(--panel-border);
    border-left: 3px solid rgba(34, 211, 238, 0.5);
    border-radius: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.featured-item::before {
    content: none;
}

.featured-item:hover {
    border-color: rgba(34, 211, 238, 0.5);
    border-left-color: var(--calc-accent);
    transform: translateY(-2px);
}

.featured-item h4 {
    color: var(--calc-accent);
    margin: 0 0 0.6rem 0;
    font-size: 1.15rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.featured-item h4::before {
    content: '▸';
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.featured-item:hover h4::before {
    transform: translateX(4px);
}

.featured-item p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 1.5rem;
}

.view-all-link {
    display: block;
    margin-top: 1.5rem;
    padding: 1rem 1.5rem;
    background: rgba(34, 211, 238, 0.12);
    border: 1px solid rgba(34, 211, 238, 0.35);
    border-radius: 10px;
    text-align: center;
    text-decoration: none;
    color: var(--calc-accent);
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.view-all-link::before {
    content: none;
}

.view-all-link:hover {
    background: rgba(34, 211, 238, 0.2);
    border-color: rgba(34, 211, 238, 0.6);
    transform: translateY(-2px);
}

section#top-projects {
    padding: 1.5rem;
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .home-hero {
        padding: 1.75rem;
    }

    .hero-shell {
        grid-template-columns: 1fr;
    }

    #calc-container {
        order: 1;
        justify-self: center;
        margin: 0 auto;
    }

    .home-featured {
        padding: 1.75rem;
    }

    .section-head {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .home-hero {
        padding: 1.25rem;
    }

    #calc-container {
        max-width: 100%;
        justify-self: center;
        margin: 0 auto;
    }

    .calculator-body {
        padding: 0.75rem;
    }
    #calc-screen {
        height: 20vh;
        min-height: 120px;
    }

    .calc-screen-content {
        font-size: 0.85rem;
    }

    .calc-keypad {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .calc-nav-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .calc-main-grid-wrapper {
        padding: 0;
        margin: 0;
        width: 100%;
    }

    .calc-main-grid {
        width: 100%;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        grid-template-rows: repeat(6, minmax(48px, 1fr));
        gap: 0.3rem;
    }

    .calc-key {
        width: 100%;
        height: auto;
        aspect-ratio: 1;
        font-size: 0.7rem;
    }

    .arrow-pad {
        width: 100%;
        max-width: 96px;
        aspect-ratio: 1;
        height: auto;
    }

    .arrow-pad .calc-key.arrow {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .calc-key.menu-btn {
        font-size: 0.65rem;
        padding: 0.3rem;
    }

    .home-featured {
        padding: 1.25rem;
    }

    .featured-item {
        padding: 1rem;
    }

    .featured-item h4 {
        font-size: 1.05rem;
    }

    .featured-item p {
        font-size: 0.85rem;
        padding-left: 1.2rem;
    }
}
