/* 
   _____ _        __                  _______             _                              _                     
  / ____| |      / _|                |__   __|           | |                            | |                    
 | (___ | |_ ___| |_ __ _ _ __  ___     | | __ _ ___  ___| |__   ___ _ __  _ __ ___  ___| |__  _ __   ___ _ __ 
  \___ \| __/ _ \  _/ _` | '_ \/ __|    | |/ _` / __|/ __| '_ \ / _ \ '_ \| '__/ _ \/ __| '_ \| '_ \ / _ \ '__|
  ____) | ||  __/ || (_| | | | \__ \    | | (_| \__ \ (__| | | |  __/ | | | | |  __/ (__| | | | | | |  __/ |   
 |_____/ \__\___|_| \__,_|_| |_|___/    |_|\__,_|___/\___|_| |_|\___|_| |_|_|  \___|\___|_| |_|_| |_|\___|_|   
                                                                                                          
*/

/*! @license MIT
 * Copyright (c) 2025 Stefan Weise
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

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

:root {
    /* Black/Grey Design - angepasst für bessere Kontraste (WCAG AA) */
    --bg-page: #0a0a0a;
    --card-bg: #1a1a1a;
    --display-bg: #0d0d0d;
    --display-text: #f5f5f5;
    --history-text: #b0b0b0;
    --btn-primary: #2a2a2a;
    --btn-hover: #3a3a3a;
    --btn-operator: #f5a623;
    --btn-operator-hover: #e09515;
    --btn-equals: #2c7a4d;
    --btn-equals-hover: #349e63;
    --btn-clear: #c0392b;
    --btn-clear-hover: #e74c3c;
    --btn-function: #2c2c2c;
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
    --border-radius: 20px;
    --btn-radius: 12px;
    --transition: all 0.12s ease;
}

body {
    background: var(--bg-page);
    font-family: 'Segoe UI', system-ui, -apple-system, 'Roboto', 'Helvetica Neue', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

/* Hauptcontainer - Taschenrechner */
.calculator {
    max-width: 520px;
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    padding: 1.8rem;
    transition: transform 0.2s;
    margin-bottom: 2rem;
}

/* Display + Verlauf */
.display-section {
    background: var(--display-bg);
    border-radius: 1rem;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.8rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.5), 0 1px 2px rgba(255,255,255,0.05);
}

.history {
    font-size: 0.9rem;
    color: var(--history-text);
    min-height: 1.6rem;
    text-align: right;
    font-family: 'Courier New', monospace;
    word-break: break-word;
    letter-spacing: 0.3px;
    border-bottom: 1px solid rgba(176, 176, 176, 0.25);
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
}

.current-input {
    font-size: 2.2rem;
    font-weight: 500;
    color: var(--display-text);
    text-align: right;
    font-family: 'Segoe UI', monospace;
    word-wrap: break-word;
    word-break: break-all;
    line-height: 1.2;
    min-height: 3.2rem;
}

/* Button Grid – mobiles zuerst */
.buttons {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.7rem;
}

button {
    background: var(--btn-primary);
    border: none;
    color: #f0f0f0;
    font-size: 1.3rem;
    font-weight: 600;
    padding: 1rem 0;
    border-radius: var(--btn-radius);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-family: inherit;
    letter-spacing: 0.5px;
    outline: none;
}

button:focus-visible {
    outline: 3px solid #f5a623;
    outline-offset: 2px;
}

button:active {
    transform: scale(0.96);
    background: var(--btn-hover);
}

/* Spezielle Buttons */
.operator {
    background: var(--btn-operator);
    color: #1a1a1a;
    font-size: 1.5rem;
    font-weight: 700;
}

.operator:hover {
    background: var(--btn-operator-hover);
}

.equal {
    background: var(--btn-equals);
    color: white;
    font-weight: 700;
}

.equal:hover {
    background: var(--btn-equals-hover);
}

.clear-btn {
    background: var(--btn-clear);
    color: white;
}

.clear-btn:hover {
    background: var(--btn-clear-hover);
}

.function-btn {
    background: var(--btn-function);
}

.function-btn:hover {
    background: #3a3a3a;
}

/* Footer Styling - Unterhalb des Taschenrechners */
.site-footer {
    width: 100%;
    max-width: 520px;
    text-align: center;
    padding: 1.2rem 1rem;
    background: transparent;
    border-top: 1px solid rgba(176, 176, 176, 0.15);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.2rem;
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: #bbbbbb;
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.2s ease;
    padding: 0.2rem 0;
}

.footer-links a:hover {
    color: #f5a623;
    text-decoration: underline;
}

.license-notice {
    font-size: 0.7rem;
    color: #888888;
    line-height: 1.5;
}

.license-notice strong {
    color: #aaaaaa;
    font-weight: 600;
}

.license-notice a {
    color: #999999;
    text-decoration: underline;
    transition: color 0.2s ease;
}

.license-notice a:hover {
    color: #f5a623;
}

.separator {
    color: #555555;
    margin: 0 0.2rem;
}

/* Visuell versteckte Klasse für Screenreader */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Responsive Anpassungen */
@media (max-width: 550px) {
    body {
        padding: 1.5rem 0.8rem;
    }
    .calculator {
        padding: 1.2rem;
    }
    .buttons {
        gap: 0.5rem;
    }
    button {
        font-size: 1.1rem;
        padding: 0.8rem 0;
    }
    .current-input {
        font-size: 1.8rem;
    }
    .history {
        font-size: 0.75rem;
    }
    .operator {
        font-size: 1.3rem;
    }
    .footer-links a {
        font-size: 0.75rem;
    }
    .license-notice {
        font-size: 0.65rem;
    }
}

@media (max-width: 400px) {
    .buttons {
        gap: 0.4rem;
    }
    button {
        font-size: 1rem;
        padding: 0.7rem 0;
    }
    .operator {
        font-size: 1.2rem;
    }
}




