@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@300;400;600;700&family=Inter:wght@300;400;500;600&display=swap');

:root {
    --color-soil: #3d2817;
    --color-bark: #5c4033;
    --color-moss: #4a7c59;
    --color-leaf: #6b9080;
    --color-bamboo: #7d8f69;
    --color-stone: #c9cba3;
    --color-sand: #f4f1de;
    --color-water: #a8dadc;
    --color-sky: #e8f4f8;
    --color-accent: #d4a574;

    --font-heading: 'Crimson Pro', sans-serif;
    --font-body: 'Inter', sans-serif;
}

:root.night-mode {
    --color-soil: #e8f4f8;
    --color-bark: #c9cba3;
    --color-moss: #90ea2f;
    --color-leaf: #ddf830;
    --color-bamboo: #a2ab00;
    --color-stone: #b8b8a6;
    --color-sand: #2a2a1f;
    --color-water: #203539;
    --color-sky: #1a1a15;
    --color-accent: #a8895a;
}

*{
    box-sizing: border-box;
    padding: 0;
    margin: 0; /*might change later*/
    overscroll-behavior: none;
    scroll-behavior: smooth;
}

body{
    display: flex;
    flex-direction: column;
    text-align: center;
    font-family: var(--font-body, sans-serif);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-soil, #3d2817);
    background: linear-gradient(
        color-mix(in srgb, var(--color-sky) 90%, var(--color-water) 10%),
        color-mix(in srgb, var(--color-sand) 95%, var(--color-accent) 5%)
    );
    min-width: 100%;
    min-height: 100vh;
}

header{
    background-color: color-mix(in srgb, var(--color-bark) 95%, var(--color-soil) 5%);
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    nav {
        padding: 1rem;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0 auto;
        flex-wrap: wrap;

        & a {
            color: var(--color-sand, #f4f1de);
            padding: 0.5rem 1rem;
            text-decoration: none;
            transition: all 350ms;
            position: relative;
            border-radius: 0.75rem;

            &::before{
                content:'';
                position:absolute;
                bottom:0;
                left:50%;
                width: 0;
                height:2px;
                background-color: color-mix(in srgb, var(--color-bamboo) 80%, var(--color-accent) 20%);
                transform: translateX(-50%);
                transition: width 350ms;
            }

            &:hover{
                transform: translateY(-2px);
                
                &::before{
                    width: 80%;
                }
            }

            &:active{
                transform:translateY(0);
            }
        }
    }
}

.theme-toggle {
    background: none;
    border: 2px solid var(--color-sand, #f4f1de);
    border-radius: 1.5rem;
    min-width: 4.5rem;
    height: 2.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 350ms;
    padding: 0 1rem;
    margin-left: 1rem;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--color-sand, #f4f1de);

    &:hover {
        transform: scale(1.05);
    }

    &:active {
        transform: scale(0.98);
    }
}

.js-enabled .theme-toggle {
    display: flex;
}


main{
    flex: 1;
    padding: 0.1rem 1.5rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;

    & p{
        margin: 0 auto 1rem;
        text-align: center;
    }

    hr {
        border: none;
        height: 2px;
        background: linear-gradient(
            to right,
            transparent,
            var(--color-moss, #4a7c59),
            transparent
        );
        margin: 1.5rem 0;
        animation: growLine 1s ease-out;
    }
}

h1 {
  font-family: var(--font-heading, 'Crimson Pro', serif);
  font-weight: 700;
  color: var(--color-soil, #3d2817);
  margin-bottom: 1.5rem;
  text-wrap: balance;
  line-height: 1.2;
}

h2 {
  font-family: var(--font-heading, 'Crimson Pro', serif);
  font-weight: 600;
  color: var(--color-bark, #5c4033);
  margin-bottom: 1rem;
  text-wrap: balance;
}

p {
  margin-bottom: 1rem;
  max-width: 70ch;
  text-wrap: pretty;
}

.name {
  color: var(--color-moss, #4a7c59);
  font-weight: 700;
  position: relative;
  display: inline-block;
  animation: fadeInUp 0.8s ease-out;
}

#headshot{    
    & img{
        border-radius: 50%;
        border: 4px solid var(--color-moss, #4a7c59);
        object-fit: cover;
        transition: transform var(--transition-slow, 600ms);
        
        &:hover {
            transform: scale(1.05) rotate(2deg);
        }
    }

}

.logo-image {
    display: block;
    margin: 0 auto 1rem;
    max-width: 100%;

    img {
        width: 100%;
        max-width: 50%;
        height: auto;
        border-radius: 1rem;
    }
}

button{
    font-family: var(--font-body, sans-serif);
    font-size: 1rem;
    padding: 1rem 1.5rem;
    margin: 0.5rem;
    background-color: color-mix(in srgb, var(--color-moss) 85%, var(--color-leaf) 15%);
    color: var(--color-sand, #f4f1de);
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 350ms;
    position: relative;

    &:hover{
        background-color: color-mix(in srgb, var(--color-moss) 75%, var(--color-accent) 25%);
        transform: translateY(-3px);
    }

    &:active {
        transform: translateY(-1px);
    }
}

footer{
    background-color: var(--color-soil, #3d2817);
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-sand, #f4f1de);


    & p{
        margin: 0;
    }

    & a{
        color: var(--color-sand, #f4f1de);
        text-decoration: underline;
        transition: color 200ms;

        &:hover{
            color: var(--color-moss, #4a7c59);
        }
    }
}

.grid{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2.5rem;
    width: 100%;

}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
    margin: 1.5rem 0;
}

project-card {
    display: block;

    & article {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        height: 100%;

        &:hover {
            border-color: var(--color-moss, #4a7c59);
            transform: translateY(-5px);
        }

        &:hover picture img {
            transform: scale(1.03);
        }
    }

    & h2 {
        margin: 0 0 0.5rem 0;
    }

    & picture {
        display: block;
        margin: 0 auto;
        max-width: 100%;

        & img {
            width: 100%;
            max-width: 200px;
            height: auto;
            border-radius: 0.75rem;
            object-fit: cover;
            transition: transform 350ms ease;
        }
    }

    & p {
        text-align: center;
        margin: 0;
    }

    & .date {
        color: color-mix(in srgb, var(--color-soil, #3d2817) 70%, transparent);
        font-size: 0.9rem;
        font-style: italic;
    }

    & .keywords {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;

        & span {
            background-color: color-mix(in srgb, var(--color-leaf, #6b9080) 20%, transparent);
            color: var(--color-moss, #4a7c59);
            padding: 0.25rem 0.75rem;
            border-radius: 1rem;
            font-size: 0.8rem;
            font-weight: 500;
            border: 1px solid var(--color-leaf, #6b9080);
        }
    }

    & .progress {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        font-size: 0.85rem;

        & progress {
            width: 120px;
            height: 8px;
            border-radius: 4px;

            &::-webkit-progress-bar {
                background-color: var(--color-stone, #c9cba3);
                border-radius: 4px;
            }

            &::-webkit-progress-value {
                background-color: var(--color-moss, #4a7c59);
                border-radius: 4px;
            }

            &::-moz-progress-bar {
                background-color: var(--color-moss, #4a7c59);
                border-radius: 4px;
            }
        }
    }

    & a:last-child {
        display: inline-block;
        padding: 0.5rem 1.25rem;
        border: 2px solid var(--color-moss, #4a7c59);
        border-radius: 0.5rem;
        transition: all 250ms ease;
        margin-top: auto;

        &:hover {
            background-color: var(--color-moss, #4a7c59);
            color: var(--color-sand, #f4f1de);
        }
    }
}

.grid>article{
    transition: all 350ms;
    display:flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    
    &:hover{
        border-color: var(--color-moss, #4a7c59);
        transform: translateY(-5px);
    }


}

article{
    background: linear-gradient(
        to bottom,
        var(--color-sand, #f4f1de),
        color-mix(in srgb, var(--color-stone) 30%, transparent)
    );

    border: 3px solid var(--color-bark, #5c4033);
    padding: 1.5rem;
    border-radius: 1rem;
    position: relative;
    overflow: hidden;
    transition: all 350ms;

    & a{
        text-decoration: none;
        color: var(--color-moss, #4a7c59);
        font-weight: 600;
        transition: all 200ms;

        &:hover{
            color: var(--color-bamboo, #7d8f69);
        }
    }
}

form{
  margin: 0 auto;
  max-width: 750px;
  display: flex;
  flex-direction: column;
  min-width: 300px;
}

fieldset:has(legend){
  border: 2px solid var(--color-moss, #4a7c59);
  border-radius: 0.75rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background-color: color-mix(in srgb, white 50%, var(--color-sky) 10%);
}

fieldset legend{
  font-family: var(--font-heading, 'Crimson Pro', serif);
  font-size: 1.25rem;
  font-weight: 600;
  padding: 0 1rem;
  color: var(--color-moss, #4a7c59);
}

form label{
  display: flex;
  color: var(--color-soil, #3d2817);
}

form label span.required {
    color:red;
}

form output {
  text-align: center;
  width: 300px;
  min-width: 0;
  overflow-wrap: anywhere;
}

form textarea{
  min-height: 150px;
}

form input, form textarea{
  font-family: var(--font-body, sans-serif);
  width: 100%;
  padding: 0.75rem;
  border: 2px solid var(--color-stone, #c9cba3);
  border-radius: 0.75rem;
  transition: all 200ms;
}

form input:focus, form textarea:focus{
  border-color: var(--color-moss, #4a7c59);
  outline: none;
}

form input:hover, form textarea:hover{
  border-color: var(--color-bamboo, #7d8f69);
}

form input:invalid{
  border: 2px solid red;
}

project-summary {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 3px solid var(--color-bark, #5c4033);
  border-radius: 0.75rem;
  padding: 2.5rem;
  margin: 4rem auto;
  max-width: 800px;
  background: linear-gradient(
    135deg,
    var(--color-sand, #f4f1de) 0%,
    color-mix(in srgb, var(--color-water) 15%, transparent) 100%
  );
  position: relative;
  transition: all 350ms;

  &:hover{
    border-color: var(--color-moss, #4a7c59);
  }

  & h2 {
    font-family: var(--font-heading, 'Crimson Pro', serif);
    color: var(--color-moss, #4a7c59);
    font-weight: 600;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-stone, #c9cba3);
    text-wrap: balance;
    margin: 0;
  }
  
  & p {
    color: var(--color-soil, #3d2817);
    font-size: 1.05rem;
    margin: 0;
  }
  
  ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    
    li {
      padding: 1rem 1.5rem;
      background-color: color-mix(in srgb, white 70%, var(--color-sand) 30%);
      border-left: 4px solid var(--color-leaf, #6b9080);
      border-radius: 0.5rem;
      color: var(--color-soil, #3d2817);
      transition: all 350ms;
      font-size: 1rem;
      position: relative;
      overflow: hidden;
      
      &:hover {
        background-color: color-mix(in srgb, white 95%, var(--color-moss) 5%);
        transform: translateX(8px);
        border-left-color: var(--color-moss, #4a7c59);
      }
    }
  }
}

iframe{
    border: 3px solid var(--color-bark, #5c4033);
    border-radius: 1rem;
    width: 100%;
    height: 400px;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--color-moss);
    color: var(--color-sand);
    padding: 0.5rem 1rem;
    z-index: 100;
    transition: top 200ms;
}

.skip-link:focus {
    top: 0;
}

@view-transition {
    navigation: auto;
}

::view-transition-group(root) {
    animation-duration: 300ms;
    animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
    mix-blend-mode: normal;
    width: 100%;
    height: 100%;
}

::view-transition-old(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both fade-out, 
               300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-to-left;
}

::view-transition-new(root) {
    animation: 300ms cubic-bezier(0.4, 0, 0.2, 1) both fade-in,
               300ms cubic-bezier(0.4, 0, 0.2, 1) both slide-from-right;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slide-to-left {
    from { transform: translateX(0); }
    to { transform: translateX(-30px); }
}

@keyframes slide-from-right {
    from { transform: translateX(30px); }
    to { transform: translateX(0); }
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid var(--color-moss, #4a7c59);
    outline-offset: 2px;
}

@media (max-width: 500px) {
    header{
        nav {
            padding: 0.25rem;
            gap: 0.075rem;
            flex-wrap: wrap;

            & a {
                padding: 0.25rem 0.6rem;
                font-size: 0.75rem;
                border-radius: 0.5rem;
            }
        }
    }

    .theme-toggle {
        min-width: 3rem;
        height: 1.75rem;
        font-size: 0.65rem;
        padding: 0 0.5rem;
        margin-left: 0.5rem;
        border-radius: 1rem;
    }
}

.data-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.data-controls button {
    min-width: 120px;
}

#data-type {
    display: block;
    margin: 0 auto 1.5rem;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-body, sans-serif);
    font-size: 1rem;
    border: 2px solid var(--color-stone, #c9cba3);
    border-radius: 0.75rem;
    background-color: var(--color-sand, #f4f1de);
    color: var(--color-soil, #3d2817);
    cursor: pointer;
    transition: all 200ms;
}

#data-type:hover {
    border-color: var(--color-bamboo, #7d8f69);
}

#data-type:focus {
    border-color: var(--color-moss, #4a7c59);
    outline: none;
}

#item-form fieldset {
    border: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

#item-form fieldset label {
    margin-bottom: 0.25rem;
    font-weight: 500;
}

#item-form footer {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 0;
    background: none;
}

button[data-action="delete"] {
    background-color: #c0392b;
}

button[data-action="update"] {
    background-color: var(--color-bamboo, #7d8f69);
}

#items-list {
    margin-top: 2rem;
}

#items-list h3 {
    color: var(--color-moss, #4a7c59);
    margin-bottom: 1rem;
}

#items-container {
    list-style: none;
    padding: 0;
    margin: 0;
}

#items-container li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: color-mix(in srgb, var(--color-sand) 80%, white 20%);
    border: 2px solid var(--color-stone, #c9cba3);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 200ms;
}

#items-container li > span:first-child {
    font-weight: 500;
    color: var(--color-soil, #3d2817);
}

#items-container li > span:last-child {
    display: flex;
    gap: 0.5rem;
}

#items-container li button {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    margin: 0;
}

@media print {
  header, footer, button {
    display: none;
  }
  
  body {
    background: white;
    color: black;
  }
  
  article {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

@media (prefers-contrast: more) {
  * {
    --color-soil: #000000;
    --color-sand: #ffffff;
    font-weight: 700;
  }
  
  button, article {
    border-width: 3px;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes growLine {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}