/* LEFO practice library — single stylesheet, styled by Element 3 later; keep markup semantic. */

:root{
  --bg:#f7f6f3; --surface:#ffffff; --text:#1c1b18; --muted:#5b584f; --line:#e6e3db;
  --accent:#e0752c; --accent-2:#2f6fa8; --free:#1f8a4c; --paid:#b8830a; --radius:14px;
  --shadow:0 2px 10px rgba(20,18,10,.06);
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#15140f; --surface:#1f1d17; --text:#f1efe8; --muted:#b3ae9f; --line:#38352a;
    --accent:#f28a45; --accent-2:#5ea0e0; --free:#3fbf74; --paid:#e0b23e;
    --shadow:0 2px 10px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"]{
  --bg:#15140f; --surface:#1f1d17; --text:#f1efe8; --muted:#b3ae9f; --line:#38352a;
  --accent:#f28a45; --accent-2:#5ea0e0; --free:#3fbf74; --paid:#e0b23e;
  --shadow:0 2px 10px rgba(0,0,0,.4);
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{
  margin:0; background:var(--bg); color:var(--text);
  font-family:Inter,Poppins,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  line-height:1.5;
}
img,audio{max-width:100%}
a{color:var(--accent-2)}

.site-header{
  display:flex; align-items:center; justify-content:space-between; gap:1rem;
  padding:.75rem 1rem; padding-top:calc(.75rem + env(safe-area-inset-top));
  border-bottom:1px solid var(--line); background:var(--surface);
}
.site-header .brand{font-weight:700; font-size:1.1rem; text-decoration:none; color:var(--text)}
.site-header nav{display:flex; gap:1rem}
.site-header nav a{text-decoration:none; color:var(--muted); font-size:.95rem}
.site-header nav a:hover{color:var(--text)}

.wrap{max-width:72rem; margin:0 auto; padding:1rem}

.crumbs{font-size:.85rem; color:var(--muted); margin-bottom:1rem; display:flex; flex-wrap:wrap; gap:.4rem; align-items:center}
.crumbs a{color:var(--muted); text-decoration:none}
.crumbs a:hover{color:var(--accent-2)}
.crumbs span{color:var(--muted)}

.site-footer{
  text-align:center; color:var(--muted); font-size:.85rem;
  padding:1.5rem 1rem; padding-bottom:calc(1.5rem + env(safe-area-inset-bottom));
}

/* library */
.library-head{padding:1rem 0 1.5rem}
.library-head h1{margin:0 0 .35rem; font-size:1.8rem}
.library-head .sub{color:var(--muted); margin:0}

.grid{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(16rem,1fr)); gap:1rem;
  padding-bottom:2rem;
}
.card{
  display:block; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:1.1rem; text-decoration:none; color:var(--text); box-shadow:var(--shadow);
  transition:transform .15s ease, box-shadow .15s ease;
}
.card:hover{transform:translateY(-2px); box-shadow:0 6px 20px rgba(20,18,10,.1)}
.card-icon{font-size:1.8rem; display:block; margin-bottom:.4rem}
.card-title{margin:0 0 .35rem; font-size:1.15rem}
.card-desc{margin:0 0 .6rem; color:var(--muted); font-size:.92rem}

/* theme */
.theme-head{padding:1rem 0 1.25rem}
.theme-head h1{margin:.35rem 0; font-size:1.7rem}
.theme-icon{font-size:1.3rem}
.theme-head .lead{color:var(--muted); margin:0}

.unit-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:.6rem}
.unit-row{
  display:flex; flex-wrap:wrap; align-items:center; gap:.5rem .75rem;
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:.85rem 1rem; text-decoration:none; color:var(--text); box-shadow:var(--shadow);
}
.unit-row:hover{border-color:var(--accent-2)}
.unit-row-title{font-weight:600; flex:1 1 auto; min-width:10rem}
.unit-row-desc{width:100%; color:var(--muted); font-size:.9rem; order:5}
.unit-row-meta{display:flex; gap:.4rem; flex-wrap:wrap}

/* badges / chips */
.badges{display:flex; gap:.4rem; flex-wrap:wrap; margin:0 0 .6rem; padding:0; list-style:none}
.badge{
  display:inline-block; font-size:.75rem; font-weight:600; padding:.2rem .55rem;
  border-radius:999px; background:var(--bg); border:1px solid var(--line); color:var(--muted);
}
.badge--free{color:var(--free); border-color:var(--free)}
.badge--paid{color:var(--paid); border-color:var(--paid)}
.badge--learn{color:var(--accent); border-color:var(--accent)}
.badge--speak{color:var(--accent-2); border-color:var(--accent-2)}
.badge--pronounce{color:var(--accent); border-color:var(--accent)}
.chips{display:flex; gap:.4rem; flex-wrap:wrap; margin:0}
.chip{font-size:.7rem; padding:.15rem .5rem; border-radius:999px; background:var(--bg); border:1px solid var(--line); color:var(--muted)}

/* unit page */
.unit-head{padding:1rem 0 1.25rem}
.unit-head h1{margin:.35rem 0; font-size:1.7rem}
.unit-head .lead{color:var(--muted); margin:0}

.unit-audio{display:block; width:100%; margin:0 0 1rem}

.unit-content{
  max-width:68ch; margin:0 auto 1.25rem; background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius); padding:1.25rem 1.4rem; box-shadow:var(--shadow);
}
.unit-content h2,.unit-content h3,.unit-content h4{line-height:1.3; margin:1.1em 0 .5em}
.unit-content h2:first-child,.unit-content h3:first-child,.unit-content h4:first-child{margin-top:0}
.unit-content p{margin:0 0 1em}
.unit-content ul,.unit-content ol{margin:0 0 1em; padding-left:1.4em}
.unit-content li{margin:.3em 0}
.unit-content strong{color:var(--text)}
.unit-content em{color:var(--muted)}
.unit-content blockquote{
  margin:1em 0; padding:.5em 1em; border-left:3px solid var(--accent); color:var(--muted);
}
.unit-content table{border-collapse:collapse; width:100%}
.unit-content code{background:var(--bg); padding:.1em .35em; border-radius:.3em; font-size:.9em}
.unit-content table, .unit-content pre{overflow-x:auto; display:block}
.word-list{list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:.5rem}
.word-list li{
  background:var(--bg); border:1px solid var(--line); border-radius:999px; padding:.3rem .8rem; font-weight:600;
}

.tool{
  background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
  padding:1.25rem; margin:0 auto 1.5rem; box-shadow:var(--shadow); text-align:center;
}
.tool-msg{color:var(--muted); margin:0}
.tool-frame{width:100%; border:0; border-radius:var(--radius)}
.tool-frame--learn{height:800px; max-height:85vh}
.tool-frame--speak{height:600px; max-width:600px; margin:0 auto; display:block}
.tool-frame--pronounce{height:650px; max-width:480px; margin:0 auto; display:block}

.paywall{
  background:var(--bg); border:1px dashed var(--paid); border-radius:var(--radius);
  padding:1.5rem; text-align:center;
}
.btn{
  display:inline-block; padding:.55rem 1.2rem; border-radius:999px; text-decoration:none;
  font-weight:600; border:1px solid var(--line); color:var(--text);
}
.btn-primary{background:var(--accent); border-color:var(--accent); color:#fff}

.pager{
  display:flex; flex-wrap:wrap; justify-content:space-between; gap:.75rem;
  padding:1rem 0 2rem; font-size:.9rem;
}
.pager a{text-decoration:none}

@media (max-width:480px){
  .wrap{padding:.75rem}
  .library-head h1,.theme-head h1,.unit-head h1{font-size:1.4rem}
  .unit-content{padding:1rem}
  .pager{flex-direction:column; align-items:flex-start}
}
.paywall-title{font-weight:600}
