:root{font-family:system-ui,sans-serif;font-size:112.5%;color:#26382d;background:#f8f2e6;line-height:1.6;--green:#163629;--paper:#fffaf1;--muted:#5a5346;--line:#d9c8aa;--gold:#8e5825}
*{box-sizing:border-box}
body{margin:0}
a{color:var(--green)}
h1,h2,h3{font-family:Georgia,serif;line-height:1.18;color:#223d2d}
h1{font-size:clamp(2.05rem,5vw,3.25rem);margin:.2em 0 .45em}
h2{font-size:1.55rem}
h3{font-size:1.2rem}
.shell{width:min(73.8rem,calc(100% - 5rem));margin-inline:auto}
.masthead{background:var(--green);color:white;border-bottom:4px solid #bf9255}
.header-inner{min-height:4.5rem;display:flex;justify-content:space-between;align-items:center;gap:1rem;flex-wrap:wrap;padding-block:.6rem}
.brand{display:inline-flex;align-items:center;gap:.65rem;font:700 clamp(1.28rem,3vw,1.9rem) Georgia,serif;text-decoration:none;color:#fffaf1}
nav{display:flex;align-items:center;gap:clamp(.25rem,1.25vw,1rem);flex-wrap:wrap;font-size:.9rem;font-weight:650}
nav a,nav .quiet{padding:.55rem .65rem;color:white;text-decoration:none}
nav a.active{text-decoration:underline;text-decoration-color:#e4b578;text-decoration-thickness:2px;text-underline-offset:.45rem}
nav form{margin:0}
.main{padding-block:2rem 4rem}
.panel{background:var(--paper);border:1px solid var(--line);border-radius:.75rem;padding:clamp(1.2rem,4vw,2.5rem);margin-bottom:1rem}
.hero{padding-block:clamp(2rem,6vw,4rem);background:linear-gradient(120deg,#fffaf1,#f2e7d1)}
.hero p{max-width:38rem}
.eyebrow{font-weight:700;color:var(--muted);margin:0 0 .5rem}
.countdown{font-weight:700}
.login{max-width:34rem;margin-inline:auto}
button,.button{display:inline-block;border:1px solid transparent;border-radius:.45rem;padding:.68rem 1rem;min-height:2.7rem;background:var(--green);color:white;font:inherit;font-weight:650;cursor:pointer;text-decoration:none}
button:hover,.button:hover{background:#173525;color:white}
button.quiet{background:transparent;color:inherit;text-decoration:underline;text-underline-offset:.18em}
button.quiet:hover{background:#e7dcc7;color:#223d2d}
:focus-visible{outline:3px solid #b87024;outline-offset:4px}
label{display:block;font-weight:650;margin-top:.65rem}
input:not([type=checkbox]),textarea{width:min(100%,36rem);display:block;border:1px solid #776e5d;border-radius:.3rem;padding:.6rem;font:inherit;margin:.25rem 0 1rem;background:#fffdf8;color:inherit;}
textarea{min-height:6rem}
.check{display:flex;gap:.65rem;align-items:center;margin-block:.75rem}
.check input{width:1.25rem;height:1.25rem}
.choices,.actions{display:flex;gap:.65rem;flex-wrap:wrap;margin-block:1rem}
.book-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,13rem),1fr));gap:1rem}
.book-card{padding:1rem;background:#fffdf8;border:1px solid var(--line);border-radius:.7rem;box-shadow:0 3px 10px #4935210a;overflow-wrap:anywhere}
.book-cover{min-height:10rem;height:13rem;display:grid;place-items:center;background:#eee3cf;border-radius:.25rem;padding:.65rem;text-align:center;font:700 1.3rem Georgia,serif}
.book-cover img{max-width:100%;width:auto;height:100%;min-height:0;object-fit:contain;filter:drop-shadow(0 4px 7px #33221140)}
.book-card h2{margin-bottom:.25rem}
.book-card p{margin-top:.25rem}
details{margin-top:.75rem}
summary{cursor:pointer;padding-block:.3rem}
details button{display:block}
.notice{background:#f5e3c2;padding:.65rem;border-radius:.3rem}
.skip{position:absolute;left:1rem;top:-6rem;background:white;padding:.5rem;z-index:3}
.skip:focus{top:1rem}
#blazor-error-ui{display:none;position:fixed;bottom:0;left:0;right:0;background:#f5e3c2;padding:.8rem}
.validation-message,.validation-errors{color:#891b17}

select{min-height:2.7rem;display:block;margin:.25rem 0 1rem;padding:.55rem;font:inherit;color:inherit;background:#fffdf8;border:1px solid #776e5d;border-radius:.3rem;max-width:100%}
.history-item{border-top:1px solid var(--line);padding:1rem 0}
.hero .book-cover,.history-item .book-cover{max-width:11rem}

/* Reader homepage */
.reader-hero {
    display: grid;
    grid-template-columns: minmax(0, .91fr) minmax(0, 1.09fr);
    min-height: clamp(25rem, 38vw, 32rem);
    overflow: hidden;
    background: #f3e9d6;
    border: 1px solid var(--line);
    border-radius: 1rem;
}
.reader-hero-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(1.65rem, 4.3vw, 3.6rem);
}
.reader-hero .eyebrow, .chooser .eyebrow { color: var(--gold); }
.reader-hero h1 {
    color: var(--green);
    font-size: clamp(2.45rem, 5.25vw, 4.25rem);
    line-height: 1.03;
    letter-spacing: -.045em;
    text-wrap: balance;
    margin: .2em 0 .3em;
}
.reader-hero-copy > p:not(.eyebrow) { max-width: 35ch; margin: .35rem 0 1.2rem; }
.reader-hero-copy .button { display: inline-flex; align-items: center; gap: .85rem; }
.reader-hero-copy .book-cover { max-width: 11rem; margin-bottom: .8rem; }
.reader-hero-photo { position: relative; min-height: 14rem; background: #694529; }
.bookshop-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 54% 50%; }
.grandpa-portrait {
    position: relative;
    display: block;
    width: clamp(2.4rem, 4.5vw, 3.1rem);
    flex: 0 0 auto;
    aspect-ratio: 1;
    overflow: hidden;
    border: 2px solid #fcf1dc;
    border-radius: 50%;
    background: #b0cad7;
}
.grandpa-portrait img { position: absolute; width: 180%; height: auto; max-width: none; left: -40%; top: -78.5%; }
.home-shortcuts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 1rem 0; }
.home-shortcuts a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    min-height: 4.6rem;
    padding: .85rem 1.35rem;
    color: var(--green);
    background: #fbf6ec;
    border: 1px solid var(--line);
    border-radius: .65rem;
    text-decoration: none;
    font: 700 1.45rem/1.2 Georgia, serif;
}
.home-shortcuts a:hover { background: #f3e9d6; }
.home-shortcuts span { color: var(--gold); }
.photo-credit { text-align: right; color: var(--muted); font-size: .75rem; margin: 0; }

/* Reader choices */
.chooser h1 { text-wrap: balance; }
.chooser .choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); max-width: 44rem; }
.chooser .choices button { min-height: 3.4rem; text-align: left; }
.chooser .recommendation-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.recommendation-grid .book-card { display: flex; flex-direction: column; align-items: stretch; }
.recommendation-grid .book-card > button:first-of-type { margin-top: auto; }
.book-card .want-to-read {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .5rem;
    width: 100%;
    margin-top: .55rem;
    background: var(--paper);
    color: var(--green);
    border-color: var(--green);
}
.book-card .want-to-read:hover,
.book-card .want-to-read[aria-pressed="true"] {
    background: #e7efe0;
    color: var(--green);
}
.recommendation-grid .book-card > p:last-of-type { margin-bottom: 1rem; }
.recommendation-grid summary { border: 1px solid var(--line); border-radius: .4rem; padding: .55rem .7rem; }
button:disabled { opacity: .62; cursor: not-allowed; }

/* Feedback */
.feedback-toast {
    position: fixed;
    inset: auto 1.05rem 1.05rem auto;
    width: min(26rem, calc(100% - 2.1rem));
    max-height: calc(100dvh - 2.1rem);
    margin: 0;
    padding: .95rem 3.15rem .95rem 1rem;
    color: var(--green);
    background: #f8fff1;
    border: 1px solid #9bb49a;
    border-inline-start: .32rem solid #2b643f;
    border-radius: .65rem;
    box-shadow: 0 8px 34px #192c2140;
    overflow-wrap: anywhere;
}
.feedback-toast:has([role="alert"]) { color: #642620; background: #fff1ed; border-color: #d49b8f; border-inline-start-color: #ad4437; }
.feedback-toast-message strong { display: block; }
.feedback-toast-message p { margin: .22rem 0 0; }
.toast-dismiss {
    position: absolute;
    inset: .45rem .45rem auto auto;
    display: grid;
    place-items: center;
    width: 2.3rem;
    min-height: 2.3rem;
    padding: 0;
    color: inherit;
    background: transparent;
    font-size: 1.55rem;
    line-height: 1;
}
.toast-dismiss:hover { color: inherit; background: #192c2115; }
#blazor-error-ui {
    z-index: 5;
    inset: auto 1.05rem 1.05rem auto;
    max-width: min(26rem, calc(100% - 2.1rem));
    border: 1px solid #d49b8f;
    border-inline-start: .32rem solid #ad4437;
    border-radius: .65rem;
    background: #fff1ed;
    box-shadow: 0 8px 34px #192c2140;
}
@media (max-width: 53rem) {
    .shell { width: calc(100% - 2.5rem); }
    .header-inner { gap: .25rem 1rem; }
    nav a, nav .quiet { padding: .45rem .4rem; }
}
@media (max-width: 44rem) {
    .chooser .recommendation-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 36rem) {
    .shell { width: calc(100% - 1.65rem); }
    .header-inner { padding-block: .85rem; }
    .main { padding-top: 1rem; }
    .reader-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
    .reader-hero h1 { font-size: clamp(2rem, 10vw, 3rem); }
    .reader-hero-photo { min-height: 0; aspect-ratio: 3 / 2; }
    .home-shortcuts { grid-template-columns: 1fr; gap: .55rem; }
    .home-shortcuts a { min-height: 3.2rem; padding: .65rem .85rem; font-size: 1.25rem; }
    .chooser .recommendation-grid { grid-template-columns: 1fr; }
}
