/*
 * Dave's Recipes — Modern rebuild with fridge-on-wallpaper aesthetic
 * Faithful recreation of the original davesrecipes.org design
 */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body { font: 1em Arial, Helvetica, sans-serif; height: 100%; margin: 0; padding: 0; color: #555; }
a { color: #375593; text-decoration: none; }
a:hover { text-decoration: underline; }
p.error { color: #f00 !important; }

/* ===== Wallpaper Background ===== */
#bg {
    background: url('/static/images/backgrounds/bg1.jpg') top center repeat-y;
    min-width: 1000px;
    min-height: 100%;
    padding-bottom: 80px;
}

/* ===== Main Container (Fridge Door) ===== */
#container {
    box-sizing: content-box;
    position: relative;
    width: 786px;
    margin: 0 auto;
    padding: 0 107px;
    background: url('/static/images/backgrounds/top1.jpg') top center no-repeat;
}

/* ===== Themes ===== */
body#greystar #bg        { background-image: url('/static/images/backgrounds/bg2.jpg'); }
body#greystar #container { background-image: url('/static/images/backgrounds/top2.jpg'); }
body#bluecool #bg        { background-image: url('/static/images/backgrounds/bg3.jpg'); }
body#bluecool #container { background-image: url('/static/images/backgrounds/top3.jpg'); }

/* ===== Top Menu ===== */
ul.topmenu {
    position: absolute;
    list-style: none;
    padding: 0;
    margin: 0;
    top: 66px;
    left: 430px;
    font-size: 11px;
    font-weight: bold;
    display: flex;
}

ul.topmenu li a {
    box-sizing: content-box;
    display: block;
    width: 56px;
    height: 16px !important;
    padding-bottom: 46px;
    border: 0;
    overflow: hidden;
    margin: 0;
    background-image: url('/static/images/ui/topbutton.png');
    background-repeat: no-repeat;
    background-position: 12px 16px;
    text-decoration: none;
    text-align: center;
    color: #777;
}

ul.topmenu li a.active,
ul.topmenu li a:hover {
    background-position: -44px 16px;
}

/* ===== Site Heading (Fridge Magnet Letters) ===== */
h1#heading {
    display: block;
    position: absolute;
    width: 870px;
    height: 180px;
    left: 90px;
    top: 150px;
    z-index: 20;
}

h1#heading a {
    display: block;
    width: 100%;
    height: 100%;
}

h1#heading span {
    display: block;
    position: absolute;
    background-repeat: no-repeat;
    height: 0px !important;
    overflow: hidden;
    filter: drop-shadow(1px 2px 1px rgba(0,0,0,0.35));
    cursor: grab;
}

h1#heading span:active {
    cursor: grabbing;
}

/* "dave and rachels recipes" — 21 letters, two rows */
/* d */  h1#heading span#h11  { background-image: url('/static/images/ui/h11.png');  padding-top: 78px; width: 50px; left: 49px;  top: 0px; }
/* a */  h1#heading span#h12  { background-image: url('/static/images/ui/h12.png');  padding-top: 58px; width: 50px; left: 94px;  top: 18px; }
/* v */  h1#heading span#h13  { background-image: url('/static/images/ui/h13.png');  padding-top: 59px; width: 56px; left: 141px; top: 20px; }
/* e */  h1#heading span#h14  { background-image: url('/static/images/ui/h14.png');  padding-top: 58px; width: 48px; left: 193px; top: 25px; }
/* a */  h1#heading span#h15  { background-image: url('/static/images/ui/h15.png');  padding-top: 58px; width: 50px; left: 281px; top: 21px; }
/* n */  h1#heading span#h16  { background-image: url('/static/images/ui/h16.png');  padding-top: 58px; width: 50px; left: 333px; top: 23px; }
/* d */  h1#heading span#h17  { background-image: url('/static/images/ui/h17.png');  padding-top: 78px; width: 50px; left: 380px; top: 7px; }
/* r */  h1#heading span#h18  { background-image: url('/static/images/ui/h18.png');  padding-top: 58px; width: 50px; left: 468px; top: 17px; }
/* a */  h1#heading span#h19  { background-image: url('/static/images/ui/h19.png');  padding-top: 58px; width: 50px; left: 516px; top: 15px; }
/* c */  h1#heading span#h110 { background-image: url('/static/images/ui/h110.png'); padding-top: 56px; width: 47px; left: 564px; top: 15px; }
/* h */  h1#heading span#h111 { background-image: url('/static/images/ui/h111.png'); padding-top: 79px; width: 50px; left: 607px; top: 0px; }
/* e */  h1#heading span#h112 { background-image: url('/static/images/ui/h112.png'); padding-top: 58px; width: 48px; left: 656px; top: 21px; }
/* l */  h1#heading span#h113 { background-image: url('/static/images/ui/h113.png'); padding-top: 78px; width: 27px; left: 701px; top: 0px; }
/* s */  h1#heading span#h114 { background-image: url('/static/images/ui/h114.png'); padding-top: 57px; width: 49px; left: 725px; top: 21px; }
/* r */  h1#heading span#h115 { background-image: url('/static/images/ui/h115.png'); padding-top: 58px; width: 50px; left: 366px; top: 84px; }
/* e */  h1#heading span#h116 { background-image: url('/static/images/ui/h116.png'); padding-top: 58px; width: 48px; left: 416px; top: 85px; }
/* c */  h1#heading span#h117 { background-image: url('/static/images/ui/h117.png'); padding-top: 56px; width: 47px; left: 464px; top: 85px; }
/* i */  h1#heading span#h118 { background-image: url('/static/images/ui/h118.png'); padding-top: 76px; width: 24px; left: 509px; top: 67px; }
/* p */  h1#heading span#h119 { background-image: url('/static/images/ui/h119.png'); padding-top: 80px; width: 52px; left: 535px; top: 80px; }
/* e */  h1#heading span#h120 { background-image: url('/static/images/ui/h120.png'); padding-top: 58px; width: 48px; left: 586px; top: 80px; }
/* s */  h1#heading span#h121 { background-image: url('/static/images/ui/h121.png'); padding-top: 57px; width: 49px; left: 631px; top: 82px; }

/* ===== Home Button ===== */
a#home {
    position: absolute;
    top: 50px;
    left: 140px;
    display: block;
    width: 95px;
    height: 0px !important;
    overflow: hidden;
    padding-top: 95px;
    background: url('/static/images/ui/home.png') no-repeat;
}

/* ===== Content Area ===== */
div.content {
    padding: 330px 25px 20px 100px;
    background: url('/static/images/ui/handle.jpg') 35px 450px no-repeat;
    min-height: 770px;
}

/* ===== Homepage ===== */
div.content.home {
    min-height: 800px;
}

div.homepage div.about {
    box-sizing: content-box;
    position: absolute;
    top: 340px;
    left: 300px;
    width: 140px;
    height: 150px;
    background: #f8e87c;
    box-shadow: 2px 3px 6px rgba(0,0,0,0.25);
    padding: 25px 20px 15px 20px;
    color: #333;
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 14px;
    font-weight: 300;
    overflow: hidden;
    transform: rotate(-2deg);
}

div.homepage div.recipe1 {
    position: absolute;
    top: 340px;
    right: 180px;
    width: 185px;
    height: 200px;
    transform: rotate(2deg);
}

div.homepage div.links {
    position: absolute;
    top: 500px;
    left: 210px;
    width: 140px;
    height: 160px;
    background: url('/static/images/ui/postit1.jpg') 100% 0 no-repeat;
    padding: 10px 20px;
    color: #333;
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 13px;
}

div.homepage div.links a       { text-decoration: none; color: #333; }
div.homepage div.links h3 a    { border-bottom: 1px dotted #333; }
div.homepage div.links p       { font-weight: normal; }
div.homepage div.links p a strong { border-bottom: 1px dotted #333; }

div.homepage div.magnets {
    position: absolute;
    top: 600px;
    right: 200px;
    width: 140px;
    height: 160px;
    background: url('/static/images/ui/postit1.jpg') 100% 0 no-repeat;
    padding: 10px 20px;
    color: #333;
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 14px;
    font-weight: bold;
}

div.homepage div.magnets a     { color: #333; text-decoration: none; border-bottom: 1px dotted #333; }
div.homepage div.magnets img   { border: 0; float: right; }
div.homepage div.magnets p a   { border: 0; }

div.homepage div.poetry {
    position: absolute;
    top: 740px;
    left: 260px;
}

div.homepage div.poetry a {
    display: inline;
    text-decoration: none;
    line-height: 1.6;
}

.poetry-word {
    display: inline-block;
    border: 1px solid #666;
    background: #ddd;
    color: #333;
    font-size: 14px;
    font-family: Arial, sans-serif;
    padding: 2px 5px;
    white-space: nowrap;
}

/* Homepage fridge magnets */
.fridge-magnet {
    position: absolute;
    z-index: 10;
}

.magnet-1 { top: 600px; left: 250px; transform: rotate(-5deg); }
.magnet-2 { top: 550px; left: 460px; transform: rotate(3deg); }
.magnet-3 { top: 690px; left: 580px; transform: rotate(-2deg); }

/* ===== Polaroid ===== */
a.polaroid {
    position: relative;
    display: block;
    border: 0;
    z-index: 10;
}

a.polaroid img {
    box-sizing: content-box;
    width: 165px;
    height: 160px;
    object-fit: cover;
    border: 0;
    padding: 8px 8px 30px 8px;
    background: white;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

a.polaroid em {
    display: block;
    text-align: center;
    font-family: 'Comic Sans MS', 'Marker Felt', cursive;
    font-style: italic;
    font-size: 13px;
    color: #444;
    margin-top: -26px;
    position: relative;
    z-index: 1;
    width: 165px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 4px;
    box-sizing: border-box;
}

a.polaroid span {
    width: 165px;
    height: 160px;
    background: url('/static/images/magnets/magnet-carrots.png') 100% 30px no-repeat;
    position: absolute;
    top: -10px;
    right: -20px;
    left: auto;
    z-index: 11;
}

.polaroid-placeholder {
    width: 185px;
    height: 200px;
    background: #f0ebe3;
}

/* ===== Browse: Category Magnets + Search ===== */
div.content.browse { padding-top: 330px; }

.browse-filters {
    margin-bottom: 25px;
}

.category-magnets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
}

.category-magnet {
    display: inline-block;
    border: 1px solid #666;
    background: #ddd;
    color: #333;
    font-weight: bold;
    padding: 4px 10px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
}

.category-magnet:hover {
    background: #ccc;
    text-decoration: none;
}

.category-magnet:nth-child(8n+1) { transform: rotate(-1.5deg); margin-top: 2px; }
.category-magnet:nth-child(8n+2) { transform: rotate(1deg); margin-top: 0; }
.category-magnet:nth-child(8n+3) { transform: rotate(-0.5deg); margin-top: 4px; }
.category-magnet:nth-child(8n+4) { transform: rotate(2deg); margin-top: 1px; }
.category-magnet:nth-child(8n+5) { transform: rotate(-2deg); margin-top: 3px; }
.category-magnet:nth-child(8n+6) { transform: rotate(0.5deg); margin-top: 0; }
.category-magnet:nth-child(8n+7) { transform: rotate(1.5deg); margin-top: 5px; }
.category-magnet:nth-child(8n)   { transform: rotate(-1deg); margin-top: 2px; }

.category-magnet.active {
    background: #bbb;
    box-shadow: inset 1px 1px 3px rgba(0,0,0,0.3);
}

.search-postit {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f8e87c;
    padding: 12px 20px;
    box-shadow: 2px 3px 6px rgba(0,0,0,0.25);
}

.search-postit input[type="text"] {
    border: none;
    background: transparent;
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 14px;
    color: #333;
    width: 180px;
    outline: none;
    padding: 2px 0;
    border-bottom: 1px dotted #999;
}

.search-postit input[type="text"]::placeholder {
    color: #888;
    font-style: italic;
}

.search-postit .search-btn {
    border: 1px solid #999;
    background: rgba(255,255,255,0.4);
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 13px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    padding: 2px 10px;
}

.search-postit .search-btn:hover {
    background: rgba(255,255,255,0.7);
}

/* ===== Browse: Recipe List ===== */
.recipe-grid { width: 620px; }
.recipe-grid .recipe-card {
    position: relative;
    display: block;
    width: 620px;
    min-height: 240px;
    padding: 0;
    margin: 0 0 25px 0;
    background-image: url('/static/images/ui/fixedpaper.png');
    background-repeat: no-repeat;
    background-position: 150px 10px;
}

.recipe-card h4 {
    padding: 85px 40px 0 220px;
    color: #375593;
    margin: 0;
}

.recipe-card.nopic h4 { padding-left: 70px; padding-top: 95px; }

.recipe-card p {
    padding: 8px 40px 0 220px;
    color: #666;
    margin: 0;
    font-weight: bold;
    font-size: 14px;
    line-height: 1.6;
}

.recipe-card.nopic p { padding-left: 70px; }

.recipe-card h4 a {
    text-decoration: none;
    color: #375593;
    font-size: 18px;
    font-weight: normal;
    border-bottom: 1px dotted #375593;
}

/* Browse polaroid overrides */
.recipe-grid a.polaroid {
    position: absolute;
    top: 0;
    left: 30px;
}

.recipe-grid a.polaroid img {
    width: 145px;
    height: 140px;
}

.recipe-grid a.polaroid span {
    width: 185px;
    height: 160px;
    background-position: 100% 0;
    top: -30px;
    left: 10px;
}

.recipe-card.rec2 a.polaroid span { background-image: url('/static/images/magnets/magnet-banana.png'); }
.recipe-card.rec3 a.polaroid span { background-image: url('/static/images/magnets/magnet-apple.png'); }
.recipe-card.rec4 a.polaroid span { background-image: url('/static/images/magnets/magnet-grapes.png'); }
.recipe-card.rec5 a.polaroid span { background-image: url('/static/images/magnets/magnet-cherries.png'); }

/* ===== Pagination ===== */
p.pagination, .pagination {
    clear: both;
    width: 100%;
    text-align: right;
    padding: 10px 0;
}

.pagination a, p.nav a {
    display: inline-block;
    width: 138px;
    height: 58px;
    line-height: 1;
    padding-top: 30px;
    box-sizing: border-box;
    background: url('/static/images/ui/cata.png') no-repeat;
    text-align: center;
    color: #375593;
    text-decoration: none;
    font-weight: bold;
    font-size: 16px;
    border: none;
}

.pagination a:hover, p.nav a:hover {
    background: url('/static/images/ui/catc.png') no-repeat;
    text-decoration: none;
}

/* ===== Recipe Detail (Note Paper) ===== */
div.content.recipe { padding-top: 330px; }

.recipe-layout {
    display: flex;
    gap: 0;
}

.recipe-images {
    width: 180px;
    float: left;
    list-style: none;
}

.recipe-photo {
    margin-bottom: 15px;
}

.recipe-photo img {
    width: 100%;
    border: 6px solid white;
    box-shadow: 2px 3px 6px rgba(0,0,0,0.25);
}

.recipe-photo:nth-child(4n+1) img { transform: rotate(-1.5deg); }
.recipe-photo:nth-child(4n+2) img { transform: rotate(2deg); }
.recipe-photo:nth-child(4n+3) img { transform: rotate(-0.5deg); }
.recipe-photo:nth-child(4n)   img { transform: rotate(1deg); }

.recipe-detail {
    float: left;
    position: relative;
    background: url('/static/images/ui/note-middle.png') 0 0 repeat-y;
    padding: 0 0 20px 0;
    margin: 60px 0 0 30px;
    width: 437px;
}

.recipe-detail h2 {
    background: url('/static/images/ui/note-top.png') -2px 0 no-repeat;
    margin: 0;
    width: 437px;
    padding: 60px 20px 0 20px;
    position: absolute;
    left: 0;
    top: -60px;
    color: #375593;
    font-size: 20px;
}

.recipe-detail h2 .magnet-decor {
    width: 437px;
    height: 100px;
    background: url('/static/images/magnets/magnet-carrots.png') 100% 0 no-repeat;
    position: absolute;
    top: -10px;
    left: 20px;
    z-index: 11;
}

.recipe-detail p {
    padding: 10px 20px 0 20px;
    margin: 0;
    font-size: 14px;
    color: #666;
}

.recipe-detail p.intro {
    padding-top: 40px;
    font-weight: bold;
}

.recipe-detail p.intro em {
    display: block;
    font-weight: normal;
    font-style: normal;
    padding: 0 0 8px 0;
}

.recipe-detail h4 {
    padding: 16px 20px 0 20px;
    margin: 0;
    font-size: 16px;
    color: #375593;
}

.recipe-detail ul, .recipe-detail ol {
    padding: 8px 20px 0 40px;
    margin: 0;
    font-size: 14px;
    color: #666;
}

.recipe-detail li {
    padding: 0 0 6px 0;
}

.recipe-detail .notes {
    font-size: 14px;
    color: #888;
    font-style: italic;
}

.recipe-detail .note-bottom {
    width: 437px;
    position: absolute;
    left: 0;
    bottom: -21px;
    height: 31px;
    background: url('/static/images/ui/note-bottom.png') 0 0 no-repeat;
    padding: 0;
    margin: 0;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block;
    padding: 6px 16px;
    background: #eee;
    border: 1px solid #375593;
    color: #375593;
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover { background: #f99; text-decoration: none; }
.btn-small { padding: 4px 12px; font-size: 12px; }

/* ===== Poetry ===== */
div.content.poetry { padding-top: 0; }
body.poetry #container { height: 1100px; }

.poetry-page { padding: 0; }

#poetry-canvas {
    display: block;
    position: absolute;
    width: 775px;
    height: 800px;
    left: 108px;
    top: 300px;
    z-index: 20;
}

.word-magnet {
    display: block;
    position: absolute;
    border: 1px solid #666;
    background: #ddd;
    color: #333;
    font-weight: bold;
    padding: 1px 3px;
    font-size: 13px;
    cursor: grab;
    user-select: none;
    white-space: nowrap;
    z-index: 1;
}

.word-magnet:active {
    cursor: grabbing;
    z-index: 100;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}

/* ===== Admin ===== */
div.content.admin { padding-top: 330px; }

.admin-page {
    max-width: 650px;
}

.admin-page .note-paper {
    position: relative;
    background: white;
    box-shadow: 2px 3px 8px rgba(0,0,0,0.2);
    padding: 30px 30px 30px 30px;
    margin: 0;
}

.admin-page .note-paper h2 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 20px;
}

.admin-page .note-paper .note-bottom { display: none; }

.admin-inner { padding: 0; }

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.error { color: #f00; font-weight: bold; }

.input-table { margin: 15px 0 15px 30px; }
.input-table th { color: #666; font-weight: normal; vertical-align: top; padding: 6px 10px 6px 0; text-align: right; }
.input-table td { padding: 4px 0; }

.input-table input[type="text"],
.input-table input[type="password"],
.input-table textarea,
.input-table select {
    border: 1px solid #375593;
    padding: 4px 6px;
    color: #375593;
    font-size: 14px;
    font-family: inherit;
    width: 300px;
}

.input-table textarea { resize: vertical; width: 350px; }

p.button { text-align: right; padding: 0 20px; }
p.button input, p.button button {
    border: 1px solid #375593;
    background: #eee;
    color: #375593;
    font-weight: bold;
    font-size: 15px;
    cursor: pointer;
    padding: 6px 16px;
}
p.button input:hover, p.button button:hover { background-color: #f99; }

.admin-recipe-list { list-style: none; margin: 15px 0; padding: 0; }
.admin-recipe-list li {
    padding: 8px 0;
    border-bottom: 1px dotted #ccc;
    margin: 0;
    position: relative;
}
.admin-recipe-list h4 { margin: 0; padding: 0; }
.admin-recipe-list h4 a { color: #333; text-decoration: none; border-bottom: 1px solid #333; }
.admin-recipe-list em { color: #999; font-size: 12px; }
.draft-badge { background: #e74c3c; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 3px; font-weight: bold; vertical-align: middle; }
.recipe-byline { color: #999; font-size: 12px; display: block; margin-bottom: 4px; padding: 10px 0 0 220px; }

.recipe-actions { float: right; }
.recipe-actions a { color: #333; margin-left: 10px; font-size: 13px; }

.link-btn {
    background: none;
    border: none;
    color: #c00;
    cursor: pointer;
    font-size: 13px;
    padding: 0;
    margin-left: 10px;
}
.link-btn:hover { text-decoration: underline; }

.admin-images { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 20px; }
.admin-image-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    width: 140px;
    text-align: center;
}
.admin-image-card .admin-image-thumb {
    position: relative;
    margin-bottom: 6px;
}
.admin-image-card .admin-image-thumb img {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 1px 1px 4px rgba(0,0,0,0.2);
}
.main-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: #375593;
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
}
.image-meta-form input {
    display: block;
    width: 100%;
    font-size: 11px;
    margin-bottom: 4px;
    padding: 3px 4px;
    border: 1px solid #ccc;
    border-radius: 2px;
    box-sizing: border-box;
}
.image-meta-form .btn-small {
    font-size: 11px;
    padding: 2px 10px;
    margin-bottom: 4px;
}
.image-actions { font-size: 11px; }
.link-btn-danger { color: #c00 !important; }

.back { padding: 0 20px; }
.back a { color: #666; font-size: 13px; }

/* ===== Lightbox ===== */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.lightbox-overlay.active {
    display: flex;
}
.lightbox-content {
    text-align: center;
    max-width: 90vw;
    max-height: 90vh;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border: 8px solid white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: block;
    margin: 0 auto;
}
.lightbox-caption {
    color: #fff;
    font-size: 15px;
    margin-top: 12px;
    font-style: italic;
}
.lightbox-close {
    position: fixed;
    top: 16px;
    right: 24px;
    background: none;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    z-index: 10000;
    line-height: 1;
}
.lightbox-close:hover { color: #ccc; }
.lightbox-prev, .lightbox-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #fff;
    font-size: 48px;
    cursor: pointer;
    z-index: 10000;
    padding: 10px;
    line-height: 1;
}
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover, .lightbox-next:hover { color: #ccc; }

/* ===== Login Post-it ===== */
.login-postit {
    width: 200px;
    height: 200px;
    background: #f8e87c;
    box-shadow: 2px 3px 6px rgba(0,0,0,0.25);
    padding: 20px;
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    color: #333;
    transform: rotate(-2deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-postit label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 2px;
}

.login-postit input {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    border-bottom: 1px dotted #999;
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 14px;
    color: #333;
    padding: 2px 0;
    margin-bottom: 12px;
    outline: none;
    box-sizing: border-box;
}

.login-postit button {
    border: 1px solid #999;
    background: rgba(255,255,255,0.4);
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    font-size: 13px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    padding: 3px 14px;
    margin-top: 2px;
}

.login-postit button:hover {
    background: rgba(255,255,255,0.7);
}

.login-postit .error {
    font-size: 12px;
    margin: 0 0 6px;
}

/* ===== Error Page ===== */
.error-page { max-width: 500px; margin: 60px auto 0; text-align: center; position: relative; left: -60px; }
.error-postit {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    width: 200px;
    height: 200px;
    background: #f8e87c;
    padding: 10px 20px;
    box-shadow: 2px 3px 6px rgba(0,0,0,0.25);
    font-family: 'Trebuchet MS', Trebuchet, sans-serif;
    color: #333;
    transform: rotate(-2deg);
}
.error-postit h2 {
    font-size: 28px;
    margin: 0 0 4px;
}
.error-postit p { margin: 4px 0; font-size: 15px; }
.error-postit a { color: #333; text-decoration: none; border-bottom: 1px dotted #333; }
.error-postit a:hover { border-bottom-style: solid; }

/* ===== Print ===== */
@media print {
    body { background: transparent; }
    ul.topmenu, a#home { display: none; }
    #bg { background: none; min-width: auto; }
    #container { width: auto; height: auto; background: transparent; padding: 0; }
    h1#heading { display: block; position: relative; width: auto; height: auto; left: 0; top: 0; padding: 0 20px; }
    h1#heading span { display: inline; position: relative !important; top: 0 !important; left: 0 !important; height: auto !important; width: auto !important; background: transparent; }
    div.content { padding: 0; margin: 0; background: transparent; }
    .recipe-detail { background: transparent; width: auto; margin: 0; }
    .recipe-detail h2 { background: transparent; padding: 0 20px 15px 20px; clear: both; position: relative; top: 0; left: 0; margin: 0; }
    .recipe-detail h2 .magnet-decor { display: none; }
    .recipe-detail .note-bottom { display: none; }
    .recipe-images { padding: 0 20px 15px 20px; }
    .recipe-images .recipe-photo { float: left; margin: 0 20px 0 0; }
}

/* ===== Responsive ===== */
@media (max-width: 840px) {
    #bg { min-width: auto; }
    #container { width: auto; padding: 0 24px; }
    h1#heading { width: 870px; transform: scale(0.85); transform-origin: left top; }
    h1#heading span { transform: none; }
    ul.topmenu { left: 330px; }
}

@media (max-width: 700px) {
    h1#heading { width: 870px; left: 20px; right: auto; transform: scale(0.8); transform-origin: left top; }
    h1#heading span { transform: none; }

    ul.topmenu { left: auto; right: 20px; }
    a#home { left: 40px; }

    div.content { padding: 280px 15px 20px 15px; }

    /* Homepage responsive */
    div.homepage div.about,
    div.homepage div.recipe1,
    div.homepage div.links,
    div.homepage div.magnets,
    div.homepage div.poetry {
        position: relative;
        top: auto;
        left: auto;
        right: auto;
        margin-bottom: 20px;
    }

    div.homepage { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; }

    /* Browse responsive */
    .recipe-grid { width: auto; }
    .recipe-grid .recipe-card { width: auto; }

    /* Recipe detail responsive */
    .recipe-detail { width: auto; max-width: 437px; margin-left: 15px; }
    .recipe-detail h2 { width: auto; }

    .recipe-images { width: 140px; }

    /* Poetry responsive */
    #poetry-canvas { position: relative; left: auto; top: auto; width: 100%; max-width: 775px; height: 600px; margin: 0 auto; }

    /* Admin responsive */
    .admin-page .note-paper { width: auto; max-width: 500px; }
    .admin-page .note-paper h2 { width: auto; }
}

@media (max-width: 600px) {
    /* Container: reduce padding to show sliver of wallpaper */
    #bg { min-width: auto; }
    #container { padding: 0 15px; }

    /* Heading: scale entire block to fit ~375px screen */
    h1#heading { height: 70px; top: 75px; left: 10px; right: auto; width: 870px; transform: scale(0.4); transform-origin: left top; }
    h1#heading span { transform: none; }

    /* Nav: simple text links, no dome buttons */
    ul.topmenu {
        top: 50px;
        right: 15px;
        left: auto;
        font-size: 11px;
    }
    ul.topmenu li a {
        background-image: none;
        padding-bottom: 0;
        height: auto !important;
        width: auto;
        padding: 4px 8px;
        color: #555;
    }
    ul.topmenu li a.active,
    ul.topmenu li a:hover {
        background-image: none;
        color: #375593;
    }

    /* Home button: hide on mobile */
    a#home { display: none; }

    /* Content: hide fridge handle, reduce padding, shrink min-height */
    div.content {
        padding: 160px 10px 20px 10px;
        background-image: none;
        min-height: 300px;
    }

    /* Error page: center the post-it */
    .error-page { left: 0; }

    /* Browse: reduce top padding, stack cards vertically */
    div.content.browse { padding-top: 160px; }

    .recipe-grid .recipe-card {
        min-height: auto;
        padding-bottom: 15px;
        background-image: none;
        border-bottom: 1px solid #ddd;
        margin-bottom: 15px;
        display: flex;
        gap: 12px;
        align-items: flex-start;
    }

    .recipe-grid a.polaroid {
        position: relative;
        top: auto;
        left: auto;
        flex-shrink: 0;
    }

    .recipe-grid a.polaroid img {
        width: 80px;
        height: 80px;
    }

    .recipe-grid a.polaroid span {
        display: none;
    }

    .recipe-card h4,
    .recipe-card.nopic h4 {
        padding: 0;
    }

    .recipe-card h4 a {
        font-size: 16px;
    }

    .recipe-card .recipe-byline {
        padding: 3px 0 0;
    }

    .recipe-card p,
    .recipe-card.nopic p {
        padding: 3px 0 0;
        font-size: 13px;
    }

    .recipe-card .recipe-card-text {
        flex: 1;
        min-width: 0;
    }

    /* Pagination: plain text links */
    .pagination a, p.nav a {
        background: none;
        width: auto;
        height: auto;
        line-height: normal;
        padding: 4px 8px;
        font-size: 14px;
    }
    .pagination a:hover, p.nav a:hover {
        background: none;
    }

    /* Homepage */
    div.content.home { padding-top: 160px; min-height: auto; }

    div.homepage div.about {
        transform: scale(0.85);
        transform-origin: left top;
        top: 30px;
    }

    div.homepage div.poetry {
        top: 80px;
    }

    .magnet-1 { left: 200px; top: 290px; }
    .magnet-2 { left: 180px; top: 620px; }
    .magnet-3 { display: none; }

    .recipe-layout { flex-direction: column; }
    .recipe-images { width: auto; float: none; display: flex; gap: 10px; overflow-x: auto; padding: 0; margin-bottom: 0; margin-top: 15px; }
    .recipe-photo { flex: 0 0 120px; }
    .recipe-detail { float: none; margin-left: 0; margin-top: 0; width: auto; }
    .recipe-detail h2 { position: relative; top: 0; padding: 60px 0 0 20px; width: auto; }
    .recipe-detail .note-bottom { display: none; }
    .recipe-detail p.intro { padding-top: 10px; }
    .recipe-detail h2 .magnet-decor { left: -80px; top: -40px; }
    div.content.recipe { padding-top: 160px; }

    /* Admin */
    div.content.admin { padding-top: 160px; }
    .login-postit { margin-top: 30px; }

    .input-table input[type="text"],
    .input-table input[type="password"],
    .input-table textarea,
    .input-table select { width: 100%; box-sizing: border-box; }

    .input-table { margin: 15px 0; width: 100%; }
    .input-table tr { display: block; margin-bottom: 10px; }
    .input-table th { display: block; text-align: left; padding: 0 0 2px; }
    .input-table td { display: block; padding: 0; }
    .input-table textarea { width: 100%; box-sizing: border-box; }

    .admin-page .note-paper { padding: 20px 15px; }

    /* Poetry: scale down and make read-only */
    div.content.poetry { padding-top: 170px; padding-left: 0; padding-right: 0; }
    body.poetry #container { height: auto; }
    .poetry-page {
        overflow: hidden;
        width: 100%;
    }
    #poetry-canvas {
        display: block;
        position: relative;
        left: 50%;
        top: auto;
        width: 775px;
        height: 800px;
        transform: translateX(-50%) scale(0.65);
        transform-origin: center top;
        margin-bottom: -280px;
    }
    .word-magnet { cursor: default; pointer-events: none; }
    h1#heading span { pointer-events: none; cursor: default; }
}
