:root{
  --pink:#ffb6c1;
  --lemon:#ffe135;
  --indigo:#4b0082;
  --raspberry:#ff1493;
  --paper:#fffafc;
  --sand:#faf0e6;
  --ink:#222;
  --muted:#ddd;
}

/* CSS Reset */
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
img{ max-width:100%; height:auto; display:block; }

body{
  font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans";
  line-height:1.5;
  color:var(--ink);
  background:#fff;
}

/* Focus visible for keyboard users */
:focus-visible{
  outline: 3px solid var(--raspberry);
  outline-offset: 2px;
}

/* Header */
.site-header{
  background:var(--pink);
  text-align:center;
  padding:1.25rem 1rem;
}
.site-header .brand{
  display:inline-flex;
  align-items:center;
  gap:.75rem;
  text-decoration:none;
}
.brand-title{
  font-size:1.75rem;
  font-weight:800;
  color:var(--indigo);
}
.tagline{ margin:.25rem 0 0; font-weight:500; }

/* Primary Nav */
.primary-nav{
  background:var(--lemon);
}
.primary-nav ul{
  list-style:none;
  display:flex;
  gap:1.25rem;
  justify-content:center;
  padding:.75rem 1rem;
  margin:0;
}
.primary-nav a{
  text-decoration:none;
  color:#000;
  font-weight:700;
}
.primary-nav a:hover,
.primary-nav a:focus,
.primary-nav a.active{
  color:var(--raspberry);
}

/* Mobile navicon (hidden on desktop) */
#navicon{
  display:none;
  padding:.75rem 1rem;
  font-weight:700;
  text-decoration:none;
}

/* Layout */
.container{
  display:grid;
  grid-template-columns: 2fr 1fr;
  gap:1rem;
  padding:1rem;
}
@media (max-width: 900px){
  .container{ grid-template-columns: 1fr; }
}

/* Main */
main{
  background:var(--paper);
  padding:1rem;
  border:1px solid var(--muted);
  border-radius:12px;
}
.feature{ margin-top:1rem; }
.cards{
  list-style:none;
  padding:0;
  margin:.75rem 0 0;
  display:grid;
  grid-template-columns: repeat(3,1fr);
  gap:1rem;
}
@media (max-width: 900px){
  .cards{ grid-template-columns: 1fr; }
}
.card{
  background:white;
  border:1px solid var(--muted);
  border-radius:12px;
  padding:1rem;
}
.button{
  display:inline-block;
  margin-top:.5rem;
  padding:.5rem .9rem;
  border-radius:999px;
  text-decoration:none;
  background:var(--indigo);
  color:white;
  font-weight:700;
}
.button:hover,
.button:focus{ filter:brightness(1.05); }

/* Candy table */
.candy-table{
  width:100%;
  border-collapse:collapse;
  margin-top:1rem;
  font-size:.95rem;
}

.candy-table th,
.candy-table td{
  border:1px solid var(--muted);
  padding:.5rem .75rem;
}

.candy-table thead{
  background:var(--pink);
}

.candy-table th{
  text-align:left;
}

/* Responsive table for small screens */
@media (max-width: 700px){
  .candy-table thead{
    display:none;
  }

  .candy-table,
  .candy-table tbody,
  .candy-table tr,
  .candy-table td{
    display:block;
    width:100%;
  }

  .candy-table tr{
    margin-bottom:1rem;
    border:1px solid var(--muted);
    border-radius:8px;
    overflow:hidden;
  }

  .candy-table td{
    border:none;
    border-bottom:1px solid var(--muted);
  }

  .candy-table td:last-child{
    border-bottom:none;
  }

  .candy-table td::before{
    content: attr(data-label) ": ";
    font-weight:700;
    display:inline-block;
    min-width:8rem;
  }
}

/* Form layout */
form{
  margin-top:1rem;
}

fieldset{
  border:1px solid var(--muted);
  border-radius:10px;
  padding:.75rem 1rem 1rem;
  margin-bottom:1rem;
}

legend{
  font-weight:700;
  padding:0 .25rem;
}

.form-row{
  margin-top:.5rem;
  display:flex;
  flex-direction:column;
  gap:.25rem;
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row textarea{
  padding:.4rem .5rem;
  border-radius:6px;
  border:1px solid var(--muted);
}

.form-row input[type="range"]{
  width:100%;
}

.form-actions{
  display:flex;
  gap:.75rem;
  margin-top:.5rem;
}

.form-actions button{
  padding:.5rem 1.2rem;
  border-radius:999px;
  border:none;
  font-weight:700;
  cursor:pointer;
}

.form-actions button[type="submit"]{
  background:var(--indigo);
  color:white;
}

.form-actions button[type="reset"]{
  background:var(--muted);
}

/* Error feedback */
input:invalid,
textarea:invalid{
  border-color:var(--raspberry);
}

#formFeedback{
  margin-top:.5rem;
  font-weight:600;
}

@media (max-width: 480px){
  .form-actions{
    flex-direction:column;
  }
}

/* Audio & video */
audio,
.candy-video{
  margin-top:.5rem;
  max-width:100%;
  display:block;
}

/* Sidebar */
.sidebar{
  background:var(--sand);
  padding:1rem;
  border:1px solid var(--muted);
  border-radius:12px;
}
.panel + .panel{ margin-top:1rem; }
.bullet{ padding-left:1.1rem; }

/* Footer */
.site-footer{
  margin-top:1rem;
  background:var(--muted);
  text-align:center;
  padding:.9rem 1rem;
  font-size:.95rem;
}

/* Mobile styles */
@media (max-width: 700px){
  /* Show navicon, hide full menu by default */
  #navicon{
    display:block;
    background:var(--lemon);
    color:#000;
  }

  .primary-nav ul{
    display:none;
    flex-direction:column;
    align-items:flex-start;
    padding:.5rem 1rem;
  }

  /* When user hovers or focuses navicon, show the menu */
  #navicon:hover + ul,
  #navicon:focus + ul{
    display:flex;
  }

  /* Hide sidebar on small screens to keep it clean */
  .sidebar{
    display:none;
  }
}
