/* ============================================
   ROOT VARIABLES
   ============================================ */
:root {
    --primary: #FF8303;
    --secondary: #1C1C1E;        
    --dark: #0F0F0F;
    --light: #9099A8;
    --lighter: #C5CAD4;
    --white: #EEEEEE;
    --accent: #FF8303;
    --card-bg: #252527;          
    --highlight: #FFA940;
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--dark);
    color: var(--lighter);
    line-height: 1.6;
}

/* ============================================
   LAYOUT
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ============================================
   NAVIGATION
   ============================================ */
/* Hamburger Menu Button */
.hamburger {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    background: var(--card-bg);
    border: 1px solid var(--accent);
    padding: 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all 0.3s;
}

.hamburger:hover {
    background: rgba(84, 18, 18, 0.2);
    border-color: var(--highlight);
}

.hamburger span {
    width: 25px;
    height: 2px;
    background: var(--accent);
    transition: all 0.3s;
    border-radius: 2px;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Navigation */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 300px;
    height: 100vh;
    background: var(--secondary);
    z-index: 999;
    transition: right 0.3s ease;
    padding: 6rem 2rem 2rem;
    border-left: 1px solid rgba(70, 138, 154, 0.1);
}

.mobile-nav.active {
    right: 0;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--lighter);
    text-decoration: none;
    transition: color 0.3s;
    font-size: 1.3rem;
    display: block;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: var(--highlight);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
    position: relative;
    padding: 8rem 0 6rem;
    text-align: center;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h2 {
    font-size: 4rem;
    color: var(--white);
    margin-bottom: 1rem;
    font-weight: 700;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--accent);
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--light);
}

#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

/* ============================================
   SECTIONS & CARDS
   ============================================ */
.section {
    padding: 5rem 0;
}

.section-alt {
    background: var(--secondary);
}

.section h3 {
    font-size: 2.5rem;
    color: var(--white);
    margin-bottom: 3rem;
    text-align: center;
}

/* Cards Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(70, 138, 154, 0.1);
    transition: transform 0.3s, border-color 0.3s;
}

.card:hover {
    transform: translateY(-5px);
    border-color: var(--highlight);
}

.card h4 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* ============================================
   PROJECTS
   ============================================ */
.project-list {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.project {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border-left: 3px solid var(--highlight);
}

.project h4 {
    color: var(--white);
    margin-bottom: 0.8rem;
    font-size: 1.4rem;
}

/* Tags */
.tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.tag {
    background: rgba(84, 18, 18, 0.3);
    color: var(--accent);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(84, 18, 18, 0.5);
}

/* ============================================
   BLOG
   ============================================ */
.blog-list {
    max-width: 800px;
    margin: 0 auto;
}

/* Blog Section with Canvas */
.blog-section {
    position: relative;
    overflow: hidden;
}

#blog-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.blog-content {
    position: relative;
    z-index: 1;
}

/* Blog Preview on Homepage */
.blog-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.blog-preview-card {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(70, 138, 154, 0.1);
    transition: transform 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
}

.blog-preview-card:hover {
    transform: translateY(-5px);
    border-color: var(--highlight);
}

.blog-preview-meta {
    color: var(--light);
    font-size: 0.85rem;
    margin-bottom: 0.8rem;
}

.blog-preview-card h4 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.blog-preview-card h4 a {
    color: var(--white);
    text-decoration: none;
    transition: color 0.3s;
}

.blog-preview-card h4 a:hover {
    color: var(--accent);
}

.blog-preview-card p {
    flex-grow: 1;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.blog-preview-card .read-more {
    align-self: flex-start;
}

/* Blog Post List */
.blog-post-preview {
    background: var(--card-bg);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.blog-post-preview h2 {
    margin-bottom: 0.5rem;
}

.blog-post-preview h2 a {
    color: var(--white);
    text-decoration: none;
    transition: color 0.3s;
}

.blog-post-preview h2 a:hover {
    color: var(--accent);
}

.post-meta {
    color: var(--light);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.read-more {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

.read-more:hover {
    color: var(--highlight);
}

/* Blog Post Content */
.post-content {
    font-size: 1.1rem;
}

.post-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 131, 3, 0.3);
    transition: all 0.3s;
}

.post-content a:hover {
    color: var(--highlight);
    border-bottom-color: var(--highlight);
}

.post-content a:visited {
    color: var(--primary);
    opacity: 0.8;
}

.post-content h2 {
    color: var(--white);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h3 {
    color: var(--accent);
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.post-content code {
    background: var(--card-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: var(--accent);
}

.post-content pre {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content pre code {
    background: none;
    padding: 0;
}

/* ============================================
   LORAWAN CALCULATOR
   ============================================ */
.calculator-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

.calculator-form,
.calculator-results {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border: 1px solid rgba(70, 138, 154, 0.1);
}

.calculator-form h3,
.calculator-results h3 {
    color: var(--accent);
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: var(--lighter);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group select,
.form-group input[type="number"] {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--dark);
    border: 1px solid rgba(255, 131, 3, 0.2);
    border-radius: 6px;
    color: var(--lighter);
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: all 0.3s;
    cursor: pointer;
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23FF8303' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 131, 3, 0.05);
    box-shadow: 0 0 0 3px rgba(255, 131, 3, 0.1);
}

.form-group select:hover,
.form-group input[type="number"]:hover {
    border-color: var(--accent);
}

.form-group input[type="number"] {
    cursor: text;
}

/* Number input arrows styling */
.form-group input[type="number"]::-webkit-inner-spin-button,
.form-group input[type="number"]::-webkit-outer-spin-button {
    opacity: 0.5;
}

.form-group input[type="number"]:hover::-webkit-inner-spin-button,
.form-group input[type="number"]:hover::-webkit-outer-spin-button {
    opacity: 1;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: color 0.3s;
}

.checkbox-group label:hover {
    color: var(--white);
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--accent);
}

/* Calculator Results */
.result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(70, 138, 154, 0.1);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--light);
}

.result-value {
    color: var(--accent);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.duty-cycle-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid rgba(70, 138, 154, 0.2);
}

.duty-cycle-info h4 {
    color: var(--accent);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.duty-cycle-info p {
    margin-bottom: 0.5rem;
    color: var(--lighter);
    line-height: 1.6;
}

.duty-cycle-info strong {
    color: var(--white);
}

/* Calculator Info */
.calculator-info {
    background: var(--card-bg);
    padding: 2rem;
    border-radius: 8px;
    border-left: 3px solid var(--highlight);
}

.calculator-info h3 {
    color: var(--white);
    margin-bottom: 1rem;
}

.calculator-info p {
    margin-bottom: 1rem;
    line-height: 1.7;
}

.calculator-info ul {
    margin-left: 1.5rem;
    line-height: 1.8;
}

.calculator-info li {
    margin-bottom: 0.5rem;
}

.calculator-info strong {
    color: var(--highlight);
}

/* ============================================
   CONTACT & BUTTONS
   ============================================ */
.contact-info {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.contact-info p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background: transparent;
    color: var(--accent);
    padding: 1rem 2rem;
    border: 2px solid var(--accent);
    border-radius: 4px;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

.btn:hover {
    background: var(--highlight);
    border-color: var(--highlight);
    color: var(--white);
}

.back-link {
    display: inline-block;
    color: var(--accent);
    text-decoration: none;
    border: 1px solid var(--accent);
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    transition: all 0.3s;
}

.back-link:hover {
    background: rgba(84, 18, 18, 0.2);
    border-color: var(--highlight);
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    background: var(--secondary);
    padding: 2rem 0;
    text-align: center;
    border-top: 2px solid var(--highlight);
}

.footer-links {
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.footer-links a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--highlight);
}

.footer-links .separator {
    color: var(--light);
    margin: 0 0.5rem;
}

/* GitHub Link */
.github-link {
    color: var(--accent) !important;
    border: 1px solid var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-top: 1rem;
    display: inline-block;
    text-align: center;
    transition: all 0.3s;
}

.github-link:hover {
    background: rgba(84, 18, 18, 0.2);
    border-color: var(--highlight);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .hero h2 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.2rem;
    }
    
    .mobile-nav {
        width: 250px;
    }
    
    .content-grid,
    .blog-preview-grid {
        grid-template-columns: 1fr;
    }
    
    .calculator-container {
        grid-template-columns: 1fr;
    }
}